forked from platypush/platypush
[youtube] Always add id and url to playlist results.
This commit is contained in:
parent
c8fa53e62f
commit
7266fe8a43
1 changed files with 10 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue