Skip to content

Commit

Permalink
[yandexmusic:album] Improve album title extraction (closes ytdl-org#2…
Browse files Browse the repository at this point in the history
  • Loading branch information
dstftw authored and ThirumalaiK committed Jan 28, 2021
1 parent 3b5bb29 commit 0261add
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion youtube_dl/extractor/yandexmusic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -273,7 +281,10 @@ def _real_extract(self, url):

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
Expand Down

0 comments on commit 0261add

Please sign in to comment.