From 7266fe8a43975b9e2aefdb75f48f895903270ba9 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Fri, 12 Jul 2024 03:12:04 +0200 Subject: [PATCH] [youtube] Always add id and url to playlist results. --- platypush/schemas/piped.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/platypush/schemas/piped.py b/platypush/schemas/piped.py index d1f4167525..f6feaca3aa 100644 --- a/platypush/schemas/piped.py +++ b/platypush/schemas/piped.py @@ -199,12 +199,22 @@ class PipedPlaylistSchema(Schema): }, ) + url = fields.Url( + metadata={ + 'description': 'Playlist URL', + 'example': 'https://youtube.com/playlist?list=1234567890', + }, + ) + @pre_dump def fill_urls(self, data: dict, **_): for attr in ('url', 'uploaderUrl'): if data.get(attr) and not data[attr].startswith('https://'): data[attr] = f'https://youtube.com{data[attr]}' + if not data.get('id') and data.get('url'): + data['id'] = data['url'].split('=')[-1] + return data @pre_dump