From d67bd9697052a2e3280ee734bca67793ab6d04a5 Mon Sep 17 00:00:00 2001 From: balibell Date: Tue, 13 Mar 2018 18:53:49 +0800 Subject: [PATCH 1/2] keep the old pattern for player parameters in bilibily.py --- youtube_dl/extractor/bilibili.py | 1 + 1 file changed, 1 insertion(+) diff --git a/youtube_dl/extractor/bilibili.py b/youtube_dl/extractor/bilibili.py index 82320f866..729dbad9f 100644 --- a/youtube_dl/extractor/bilibili.py +++ b/youtube_dl/extractor/bilibili.py @@ -94,6 +94,7 @@ class BiliBiliIE(InfoExtractor): if 'anime/' not in url: cid = compat_parse_qs(self._search_regex( [r'EmbedPlayer\([^)]+,[^)]+,\s*\\"([^"]+)\\"\)', + r'EmbedPlayer\([^)]+,[^)]+,\s*"([^"]+)"\)', r']+src="https://secure\.bilibili\.com/secure,([^"]+)"'], webpage, 'player parameters'))['cid'][0] else: From 05a1554b3c7858ca67203b64e9a268e789ee82c6 Mon Sep 17 00:00:00 2001 From: balibell Date: Wed, 14 Mar 2018 16:36:26 +0800 Subject: [PATCH 2/2] bilibili payload updated to v2 --- youtube_dl/extractor/bilibili.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/youtube_dl/extractor/bilibili.py b/youtube_dl/extractor/bilibili.py index 729dbad9f..85d4472b7 100644 --- a/youtube_dl/extractor/bilibili.py +++ b/youtube_dl/extractor/bilibili.py @@ -115,7 +115,9 @@ class BiliBiliIE(InfoExtractor): self._report_error(js) cid = js['result']['cid'] - payload = 'appkey=%s&cid=%s&otype=json&quality=2&type=mp4' % (self._APP_KEY, cid) + + # payload = 'appkey=%s&cid=%s&otype=json&quality=2&type=mp4' % (self._APP_KEY, cid) + payload = 'appkey=%s&cid=%s&otype=json&qn=0&quality=0&type=' % (self._APP_KEY, cid) sign = hashlib.md5((payload + self._BILIBILI_KEY).encode('utf-8')).hexdigest() headers = { @@ -124,7 +126,7 @@ class BiliBiliIE(InfoExtractor): headers.update(self.geo_verification_headers()) video_info = self._download_json( - 'http://interface.bilibili.com/playurl?%s&sign=%s' % (payload, sign), + 'http://interface.bilibili.com/v2/playurl?%s&sign=%s' % (payload, sign), video_id, note='Downloading video info page', headers=headers)