diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py index 4adcae1e5..8e1d12ea3 100644 --- a/youtube_dl/extractor/extractors.py +++ b/youtube_dl/extractor/extractors.py @@ -1456,6 +1456,7 @@ from .yandexmusic import ( YandexMusicTrackIE, YandexMusicAlbumIE, YandexMusicPlaylistIE, + YandexMusicArtistIE, ) from .yandexvideo import YandexVideoIE from .yapfiles import YapFilesIE diff --git a/youtube_dl/extractor/yandexmusic.py b/youtube_dl/extractor/yandexmusic.py index 08d35e04c..fd350762e 100644 --- a/youtube_dl/extractor/yandexmusic.py +++ b/youtube_dl/extractor/yandexmusic.py @@ -311,3 +311,24 @@ class YandexMusicPlaylistIE(YandexMusicPlaylistBaseIE): self._build_playlist(tracks), compat_str(playlist_id), playlist.get('title'), playlist.get('description')) + + +class YandexMusicArtistIE(YandexMusicPlaylistBaseIE): + IE_NAME = 'yandexmusic:artist' + IE_DESC = 'Яндекс.Музыка - Артист' + _VALID_URL = r'https?://music\.yandex\.(?:ru|kz|ua|by)/artist/(?P\d+)/?(\?|$)' + + def _real_extract(self, url): + artist_id = self._match_id(url) + + artist = self._download_json( + 'http://music.yandex.ru/handlers/artist.jsx?artist=%s' % artist_id, + artist_id, 'Downloading artist JSON') + + entries = [ + self.url_result( + 'http://music.yandex.ru/album/%s' % (album['id']) + ) for album in artist['albums'] + ] + + return self.playlist_result(entries)