mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-06-28 09:28:33 +00:00
feat: artist list, thumbnail, tests for them
This commit is contained in:
parent
2e5faa1540
commit
84ef9661aa
@ -768,9 +768,26 @@ class VKMusicIE(VKBaseIE):
|
|||||||
'title': 'Skillet - Feel Invincible',
|
'title': 'Skillet - Feel Invincible',
|
||||||
'duration': 230,
|
'duration': 230,
|
||||||
'uploader': 'Skillet',
|
'uploader': 'Skillet',
|
||||||
'artist': 'Skillet',
|
|
||||||
'artists': ['Skillet'],
|
'artists': ['Skillet'],
|
||||||
'track': 'Feel Invincible',
|
'track': 'Feel Invincible',
|
||||||
|
'thumbnail': r're:https?://.*\.jpg',
|
||||||
|
},
|
||||||
|
'params': {
|
||||||
|
'skip_download': True,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'note': 'artists are in meta[17], 18th item contains empty string',
|
||||||
|
'url': 'https://vk.com/audio-2001844083_29844083',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '-2001844083_29844083',
|
||||||
|
'ext': 'm4a',
|
||||||
|
'title': 'Pusha T, Stormzy - Good Goodbye (feat. Pusha T and Stormzy)',
|
||||||
|
'duration': 211,
|
||||||
|
'uploader': 'Pusha T, Stormzy',
|
||||||
|
'artists': ['Pusha T', 'Stormzy'],
|
||||||
|
'track': 'Good Goodbye (feat. Pusha T and Stormzy)',
|
||||||
|
'thumbnail': r're:https?://.*\.jpg',
|
||||||
},
|
},
|
||||||
'params': {
|
'params': {
|
||||||
'skip_download': True,
|
'skip_download': True,
|
||||||
@ -782,20 +799,24 @@ def _parse_track_meta(self, meta, track_id=None):
|
|||||||
len_ = len(meta)
|
len_ = len(meta)
|
||||||
info = {}
|
info = {}
|
||||||
|
|
||||||
info['id'] = track_id \
|
info['id'] = f'{meta[1]}_{meta[0]}' \
|
||||||
if len_ < 2 or not meta[1] or not meta[0] \
|
if len_ >= 2 and meta[1] and meta[0] \
|
||||||
else f'{meta[1]}_{meta[0]}'
|
else track_id
|
||||||
|
|
||||||
title = meta[3] if len_ >= 3 else None
|
title = meta[3] if len_ >= 3 else None
|
||||||
artist = meta[4] if len_ >= 4 else None
|
artist = meta[4] if len_ >= 4 else None # artists in one string, may include "feat."
|
||||||
info['title'] = join_nonempty(artist, title, delim=' - ')
|
info['title'] = join_nonempty(artist, title, delim=' - ')
|
||||||
if title:
|
|
||||||
info['track'] = title
|
info['track'] = title
|
||||||
if artist:
|
info['uploader'] = artist
|
||||||
info['artist'] = info['uploader'] = artist
|
|
||||||
|
# artists as list
|
||||||
|
info['artists'] = (
|
||||||
|
traverse_obj((*meta[17], *meta[18]), ({dict}, 'name', ...))
|
||||||
|
if len_ >= 18 else None
|
||||||
|
) or [artist]
|
||||||
|
|
||||||
info['duration'] = int_or_none(meta[5]) if len_ >= 5 else None
|
info['duration'] = int_or_none(meta[5]) if len_ >= 5 else None
|
||||||
# info['thumbnail'] = meta[14] if len_ >= 14 else None
|
info['thumbnails'] = [{'url': meta[14]}] if len_ >= 14 else []
|
||||||
|
|
||||||
return info
|
return info
|
||||||
|
|
||||||
@ -830,7 +851,6 @@ def _real_extract(self, url):
|
|||||||
**self._parse_track_meta(meta, track_id),
|
**self._parse_track_meta(meta, track_id),
|
||||||
'formats': [{
|
'formats': [{
|
||||||
'url': url,
|
'url': url,
|
||||||
# XXX: copied from VKWallPostIE._real_extract
|
|
||||||
'ext': 'm4a',
|
'ext': 'm4a',
|
||||||
'vcodec': 'none',
|
'vcodec': 'none',
|
||||||
'acodec': 'mp3',
|
'acodec': 'mp3',
|
||||||
@ -859,9 +879,6 @@ def _real_extract(self, url):
|
|||||||
|
|
||||||
entries = []
|
entries = []
|
||||||
for ent in tracks:
|
for ent in tracks:
|
||||||
# XXX: repeating code
|
|
||||||
# meta-parsers for track and playlist items should be unified
|
|
||||||
|
|
||||||
info = self._parse_track_meta(ent)
|
info = self._parse_track_meta(ent)
|
||||||
track_id = info.pop('id')
|
track_id = info.pop('id')
|
||||||
title = info.pop('title')
|
title = info.pop('title')
|
||||||
|
Loading…
Reference in New Issue
Block a user