From 1607edbfe5c8a22b61c4d46ffb160d38b78beb82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=3D=3FUTF-8=3Fq=3FSergey=3D20M=3DE2=3D80=3DA4=3F=3D?= Date: Sat, 20 Mar 2021 20:40:26 +0100 Subject: [PATCH] [yandexmusic:album] Improve album title extraction (closes #27418) --- haruhi_dl/extractor/yandexmusic.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/haruhi_dl/extractor/yandexmusic.py b/haruhi_dl/extractor/yandexmusic.py index 7f6527f47..c707b247d 100644 --- a/haruhi_dl/extractor/yandexmusic.py +++ b/haruhi_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