From ae8d5094428521aeeb651b1711a61c544a0a427c Mon Sep 17 00:00:00 2001 From: mozbug Date: Thu, 19 Mar 2020 18:30:19 +0800 Subject: [PATCH] [bilibili] Add embedded URL with player.html Pattern: 'http://player.bilibili.com/player.html?aid=92494333&cid=157926707&page=1' --- youtube_dl/extractor/bilibili.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/youtube_dl/extractor/bilibili.py b/youtube_dl/extractor/bilibili.py index 80bd696e2..af60553dd 100644 --- a/youtube_dl/extractor/bilibili.py +++ b/youtube_dl/extractor/bilibili.py @@ -24,7 +24,7 @@ from ..utils import ( class BiliBiliIE(InfoExtractor): - _VALID_URL = r'https?://(?:www\.|bangumi\.|)bilibili\.(?:tv|com)/(?:video/av|anime/(?P\d+)/play#)(?P\d+)' + _VALID_URL = r'https?://(?:www\.|bangumi\.|)bilibili\.(?:tv|com)/(?:video/av|anime/(?P\d+)/play#)(?P\d+)|https?://player\.bilibili\.com/player\.html\?aid=(?P\d+)&cid=(?P\d+)' _TESTS = [{ 'url': 'http://www.bilibili.tv/video/av1074402/', @@ -109,6 +109,11 @@ class BiliBiliIE(InfoExtractor): url, smuggled_data = unsmuggle_url(url, {}) mobj = re.match(self._VALID_URL, url) + if "/player.html" in url: + vid = mobj.group("vid") + url = "https://www.bilibili.com/video/av%s/" % vid + return self._real_extract(url) + video_id = mobj.group('id') anime_id = mobj.group('anime_id') webpage = self._download_webpage(url, video_id)