diff options
author | Remita Amine <[email protected]> | 2017-11-29 20:36:55 +0100 |
---|---|---|
committer | Remita Amine <[email protected]> | 2017-11-29 20:36:55 +0100 |
commit | 1663b329460b8b83b4eb0381ccb4f201374647db (patch) | |
tree | e11367c6c55fe880fa35dc3e6373b3910e83f1e0 /youtube_dl/extractor/xiami.py | |
parent | 5ea765fb720523efb2702358e188e5157d08775b (diff) | |
download | youtube-dl-1663b329460b8b83b4eb0381ccb4f201374647db.tar.gz youtube-dl-1663b329460b8b83b4eb0381ccb4f201374647db.zip |
[xiami] add Referer header to api request
Diffstat (limited to 'youtube_dl/extractor/xiami.py')
-rw-r--r-- | youtube_dl/extractor/xiami.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/youtube_dl/extractor/xiami.py b/youtube_dl/extractor/xiami.py index d017e03de..7f871c8ec 100644 --- a/youtube_dl/extractor/xiami.py +++ b/youtube_dl/extractor/xiami.py @@ -40,9 +40,12 @@ class XiamiBaseIE(InfoExtractor): 'subtitles': subtitles, } - def _extract_tracks(self, item_id, typ=None): + def _extract_tracks(self, item_id, referer, typ=None): playlist = self._download_json( - '%s/%s%s' % (self._API_BASE_URL, item_id, '/type/%s' % typ if typ else ''), item_id) + '%s/%s%s' % (self._API_BASE_URL, item_id, '/type/%s' % typ if typ else ''), + item_id, headers={ + 'Referer': referer, + }) return [ self._extract_track(track, item_id) for track in playlist['data']['trackList']] @@ -135,13 +138,13 @@ class XiamiSongIE(XiamiBaseIE): }] def _real_extract(self, url): - return self._extract_tracks(self._match_id(url))[0] + return self._extract_tracks(self._match_id(url), url)[0] class XiamiPlaylistBaseIE(XiamiBaseIE): def _real_extract(self, url): item_id = self._match_id(url) - return self.playlist_result(self._extract_tracks(item_id, self._TYPE), item_id) + return self.playlist_result(self._extract_tracks(item_id, url, self._TYPE), item_id) class XiamiAlbumIE(XiamiPlaylistBaseIE): |