]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/extractor/yandexmusic.py
[ie/crunchyroll] Fix stream extraction (#10005)
[yt-dlp.git] / yt_dlp / extractor / yandexmusic.py
index c30c438f8b941854fe97284d0003524704814a18..794dc3eaea2c99553ae2611409e92b1acff34dd1 100644 (file)
@@ -1,9 +1,5 @@
-# coding: utf-8
-from __future__ import unicode_literals
-
 import hashlib
 import itertools
-import re
 
 from .common import InfoExtractor
 from ..compat import compat_str
@@ -109,7 +105,7 @@ class YandexMusicTrackIE(YandexMusicBaseIE):
     }]
 
     def _real_extract(self, url):
-        mobj = re.match(self._VALID_URL, url)
+        mobj = self._match_valid_url(url)
         tld, album_id, track_id = mobj.group('tld'), mobj.group('album_id'), mobj.group('id')
 
         track = self._call_api(
@@ -119,8 +115,7 @@ def _real_extract(self, url):
 
         download_data = self._download_json(
             'https://music.yandex.ru/api/v2.1/handlers/track/%s:%s/web-album_track-track-track-main/download/m' % (track_id, album_id),
-            track_id, 'Downloading track location url JSON',
-            headers={'X-Retpath-Y': url})
+            track_id, 'Downloading track location url JSON', query={'hq': 1}, headers={'X-Retpath-Y': url})
 
         fd_data = self._download_json(
             download_data['src'], track_id,
@@ -291,7 +286,7 @@ def suitable(cls, url):
         return False if YandexMusicTrackIE.suitable(url) else super(YandexMusicAlbumIE, cls).suitable(url)
 
     def _real_extract(self, url):
-        mobj = re.match(self._VALID_URL, url)
+        mobj = self._match_valid_url(url)
         tld = mobj.group('tld')
         album_id = mobj.group('id')
 
@@ -342,7 +337,7 @@ class YandexMusicPlaylistIE(YandexMusicPlaylistBaseIE):
     }]
 
     def _real_extract(self, url):
-        mobj = re.match(self._VALID_URL, url)
+        mobj = self._match_valid_url(url)
         tld = mobj.group('tld')
         user = mobj.group('user')
         playlist_id = mobj.group('id')
@@ -381,7 +376,7 @@ def _call_artist(self, tld, url, artist_id):
             })
 
     def _real_extract(self, url):
-        mobj = re.match(self._VALID_URL, url)
+        mobj = self._match_valid_url(url)
         tld = mobj.group('tld')
         artist_id = mobj.group('id')
         data = self._call_artist(tld, url, artist_id)
@@ -410,7 +405,7 @@ class YandexMusicArtistTracksIE(YandexMusicArtistBaseIE):
     _ARTIST_WHAT = 'tracks'
 
     def _real_extract(self, url):
-        mobj = re.match(self._VALID_URL, url)
+        mobj = self._match_valid_url(url)
         tld = mobj.group('tld')
         artist_id = mobj.group('id')
         data = self._call_artist(tld, url, artist_id)
@@ -440,7 +435,7 @@ class YandexMusicArtistAlbumsIE(YandexMusicArtistBaseIE):
     _ARTIST_WHAT = 'albums'
 
     def _real_extract(self, url):
-        mobj = re.match(self._VALID_URL, url)
+        mobj = self._match_valid_url(url)
         tld = mobj.group('tld')
         artist_id = mobj.group('id')
         data = self._call_artist(tld, url, artist_id)