aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/bilibili.py
diff options
context:
space:
mode:
authorLuca Steeb <contact@luca-steeb.com>2018-01-06 20:27:26 +0100
committerChih-Hsuan Yen <yan12125@gmail.com>2018-01-08 01:30:04 +0800
commit3a513f29adc42fc46fd8b754806d38444bcee151 (patch)
tree08cfe56ed27d203c0d66cd8d959f515c2da43c25 /youtube_dl/extractor/bilibili.py
parent950b5f296986ed0a2dd9feeb69dbb950592b6047 (diff)
fix bilibili extraction (closes #15171)
Diffstat (limited to 'youtube_dl/extractor/bilibili.py')
-rw-r--r--youtube_dl/extractor/bilibili.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/youtube_dl/extractor/bilibili.py b/youtube_dl/extractor/bilibili.py
index 1e57310d6..beffcecd0 100644
--- a/youtube_dl/extractor/bilibili.py
+++ b/youtube_dl/extractor/bilibili.py
@@ -102,6 +102,7 @@ class BiliBiliIE(InfoExtractor):
video_id, anime_id, compat_urlparse.urljoin(url, '//bangumi.bilibili.com/anime/%s' % anime_id)))
headers = {
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
+ 'Referer': url
}
headers.update(self.geo_verification_headers())
@@ -116,10 +117,15 @@ class BiliBiliIE(InfoExtractor):
payload = 'appkey=%s&cid=%s&otype=json&quality=2&type=mp4' % (self._APP_KEY, cid)
sign = hashlib.md5((payload + self._BILIBILI_KEY).encode('utf-8')).hexdigest()
+ headers = {
+ 'Referer': url
+ }
+ headers.update(self.geo_verification_headers())
+
video_info = self._download_json(
'http://interface.bilibili.com/playurl?%s&sign=%s' % (payload, sign),
video_id, note='Downloading video info page',
- headers=self.geo_verification_headers())
+ headers=headers)
if 'durl' not in video_info:
self._report_error(video_info)