[yandexmusic] fetch artist's albums

This commit is contained in:
Sergey Alirzaev 2019-09-01 23:03:53 +03:00
parent d7da1e37c7
commit fe5bcc504f
No known key found for this signature in database
GPG Key ID: F0A35EA6008ACF1E
2 changed files with 22 additions and 0 deletions

View File

@ -1456,6 +1456,7 @@ from .yandexmusic import (
YandexMusicTrackIE,
YandexMusicAlbumIE,
YandexMusicPlaylistIE,
YandexMusicArtistIE,
)
from .yandexvideo import YandexVideoIE
from .yapfiles import YapFilesIE

View File

@ -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<id>\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)