diff options
author | Sergey M․ <dstftw@gmail.com> | 2020-12-13 22:18:40 +0700 |
---|---|---|
committer | Sergey M․ <dstftw@gmail.com> | 2020-12-13 22:18:40 +0700 |
commit | 9c33eb027e4a798045706f669679a4f9305e1fdf (patch) | |
tree | 349290a7ba7e4681cde61732616fe9abb5053ea6 /youtube_dl | |
parent | 679b711395c2d6a75b376e8f7b8b2529669c4c27 (diff) | |
download | youtube-dl-9c33eb027e4a798045706f669679a4f9305e1fdf.tar.xz |
[yandexmusic:album] Improve album title extraction (closes #27418)
Diffstat (limited to 'youtube_dl')
-rw-r--r-- | youtube_dl/extractor/yandexmusic.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/youtube_dl/extractor/yandexmusic.py b/youtube_dl/extractor/yandexmusic.py index 324ac8bba..6bd44abbc 100644 --- a/youtube_dl/extractor/yandexmusic.py +++ b/youtube_dl/extractor/yandexmusic.py @@ -260,6 +260,14 @@ class YandexMusicAlbumIE(YandexMusicPlaylistBaseIE): }, 'playlist_count': 33, # 'skip': 'Travis CI servers blocked by YandexMusic', + }, { + # empty artists + 'url': 'https://music.yandex.ru/album/9091882', + 'info_dict': { + 'id': '9091882', + 'title': 'ТЕД на русском', + }, + 'playlist_count': 187, }] def _real_extract(self, url): @@ -273,7 +281,10 @@ class YandexMusicAlbumIE(YandexMusicPlaylistBaseIE): entries = self._build_playlist([track for volume in album['volumes'] for track in volume]) - title = '%s - %s' % (album['artists'][0]['name'], album['title']) + title = album['title'] + artist = try_get(album, lambda x: x['artists'][0]['name'], compat_str) + if artist: + title = '%s - %s' % (artist, title) year = album.get('year') if year: title += ' (%s)' % year |