mirror of
https://github.com/ytdl-org/youtube-dl
synced 2024-12-22 20:20:09 +09:00
Compare commits
3 Commits
b79df1b68d
...
c98052c5da
Author | SHA1 | Date | |
---|---|---|---|
|
c98052c5da | ||
|
ab62bc5838 | ||
|
bc87ba8424 |
@ -15,6 +15,8 @@ from ..utils import (
|
|||||||
|
|
||||||
|
|
||||||
class YandexMusicBaseIE(InfoExtractor):
|
class YandexMusicBaseIE(InfoExtractor):
|
||||||
|
_VALID_URL_BASE = r'https?://music\.yandex\.(?P<tld>ru|kz|ua|by|com)'
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _handle_error(response):
|
def _handle_error(response):
|
||||||
if isinstance(response, dict):
|
if isinstance(response, dict):
|
||||||
@ -62,7 +64,7 @@ class YandexMusicBaseIE(InfoExtractor):
|
|||||||
class YandexMusicTrackIE(YandexMusicBaseIE):
|
class YandexMusicTrackIE(YandexMusicBaseIE):
|
||||||
IE_NAME = 'yandexmusic:track'
|
IE_NAME = 'yandexmusic:track'
|
||||||
IE_DESC = 'Яндекс.Музыка - Трек'
|
IE_DESC = 'Яндекс.Музыка - Трек'
|
||||||
_VALID_URL = r'https?://music\.yandex\.(?P<tld>ru|kz|ua|by)/album/(?P<album_id>\d+)/track/(?P<id>\d+)'
|
_VALID_URL = r'%s/album/(?P<album_id>\d+)/track/(?P<id>\d+)' % YandexMusicBaseIE._VALID_URL_BASE
|
||||||
|
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'http://music.yandex.ru/album/540508/track/4878838',
|
'url': 'http://music.yandex.ru/album/540508/track/4878838',
|
||||||
@ -100,6 +102,9 @@ class YandexMusicTrackIE(YandexMusicBaseIE):
|
|||||||
'track_number': 9,
|
'track_number': 9,
|
||||||
},
|
},
|
||||||
# 'skip': 'Travis CI servers blocked by YandexMusic',
|
# 'skip': 'Travis CI servers blocked by YandexMusic',
|
||||||
|
}, {
|
||||||
|
'url': 'http://music.yandex.com/album/540508/track/4878838',
|
||||||
|
'only_matching': True,
|
||||||
}]
|
}]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
@ -242,7 +247,7 @@ class YandexMusicPlaylistBaseIE(YandexMusicBaseIE):
|
|||||||
class YandexMusicAlbumIE(YandexMusicPlaylistBaseIE):
|
class YandexMusicAlbumIE(YandexMusicPlaylistBaseIE):
|
||||||
IE_NAME = 'yandexmusic:album'
|
IE_NAME = 'yandexmusic:album'
|
||||||
IE_DESC = 'Яндекс.Музыка - Альбом'
|
IE_DESC = 'Яндекс.Музыка - Альбом'
|
||||||
_VALID_URL = r'https?://music\.yandex\.(?P<tld>ru|kz|ua|by)/album/(?P<id>\d+)/?(\?|$)'
|
_VALID_URL = r'%s/album/(?P<id>\d+)' % YandexMusicBaseIE._VALID_URL_BASE
|
||||||
|
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'http://music.yandex.ru/album/540508',
|
'url': 'http://music.yandex.ru/album/540508',
|
||||||
@ -270,6 +275,10 @@ class YandexMusicAlbumIE(YandexMusicPlaylistBaseIE):
|
|||||||
'playlist_count': 187,
|
'playlist_count': 187,
|
||||||
}]
|
}]
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def suitable(cls, url):
|
||||||
|
return False if YandexMusicTrackIE.suitable(url) else super(YandexMusicAlbumIE, cls).suitable(url)
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
tld = mobj.group('tld')
|
tld = mobj.group('tld')
|
||||||
@ -295,7 +304,7 @@ class YandexMusicAlbumIE(YandexMusicPlaylistBaseIE):
|
|||||||
class YandexMusicPlaylistIE(YandexMusicPlaylistBaseIE):
|
class YandexMusicPlaylistIE(YandexMusicPlaylistBaseIE):
|
||||||
IE_NAME = 'yandexmusic:playlist'
|
IE_NAME = 'yandexmusic:playlist'
|
||||||
IE_DESC = 'Яндекс.Музыка - Плейлист'
|
IE_DESC = 'Яндекс.Музыка - Плейлист'
|
||||||
_VALID_URL = r'https?://music\.yandex\.(?P<tld>ru|kz|ua|by)/users/(?P<user>[^/]+)/playlists/(?P<id>\d+)'
|
_VALID_URL = r'%s/users/(?P<user>[^/]+)/playlists/(?P<id>\d+)' % YandexMusicBaseIE._VALID_URL_BASE
|
||||||
|
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'http://music.yandex.ru/users/music.partners/playlists/1245',
|
'url': 'http://music.yandex.ru/users/music.partners/playlists/1245',
|
||||||
@ -374,7 +383,7 @@ class YandexMusicArtistBaseIE(YandexMusicPlaylistBaseIE):
|
|||||||
class YandexMusicArtistTracksIE(YandexMusicArtistBaseIE):
|
class YandexMusicArtistTracksIE(YandexMusicArtistBaseIE):
|
||||||
IE_NAME = 'yandexmusic:artist:tracks'
|
IE_NAME = 'yandexmusic:artist:tracks'
|
||||||
IE_DESC = 'Яндекс.Музыка - Артист - Треки'
|
IE_DESC = 'Яндекс.Музыка - Артист - Треки'
|
||||||
_VALID_URL = r'https?://music\.yandex\.(?P<tld>ru|kz|ua|by)/artist/(?P<id>\d+)/tracks'
|
_VALID_URL = r'%s/artist/(?P<id>\d+)/tracks' % YandexMusicBaseIE._VALID_URL_BASE
|
||||||
|
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'https://music.yandex.ru/artist/617526/tracks',
|
'url': 'https://music.yandex.ru/artist/617526/tracks',
|
||||||
@ -404,7 +413,7 @@ class YandexMusicArtistTracksIE(YandexMusicArtistBaseIE):
|
|||||||
class YandexMusicArtistAlbumsIE(YandexMusicArtistBaseIE):
|
class YandexMusicArtistAlbumsIE(YandexMusicArtistBaseIE):
|
||||||
IE_NAME = 'yandexmusic:artist:albums'
|
IE_NAME = 'yandexmusic:artist:albums'
|
||||||
IE_DESC = 'Яндекс.Музыка - Артист - Альбомы'
|
IE_DESC = 'Яндекс.Музыка - Артист - Альбомы'
|
||||||
_VALID_URL = r'https?://music\.yandex\.(?P<tld>ru|kz|ua|by)/artist/(?P<id>\d+)/albums'
|
_VALID_URL = r'%s/artist/(?P<id>\d+)/albums' % YandexMusicBaseIE._VALID_URL_BASE
|
||||||
|
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'https://music.yandex.ru/artist/617526/albums',
|
'url': 'https://music.yandex.ru/artist/617526/albums',
|
||||||
|
Loading…
Reference in New Issue
Block a user