提交 f12943aa 编写于 作者: E e

add support for BVID in watchlater mode.

上级 d6afc2e8
......@@ -132,10 +132,10 @@ class Bilibili(VideoExtractor):
# r'<h1 title="([^"]+)"')
# redirect: watchlater
if re.match(r'https?://(www\.)?bilibili\.com/watchlater/#/av(\d+)', self.url):
avid = match1(self.url, r'/av(\d+)')
if re.match(r'https?://(www\.)?bilibili\.com/watchlater/#/(av(\d+)|BV(\S+)/?)', self.url):
avid = match1(self.url, r'/(av\d+)') or match1(self.url, r'/(BV\w+)')
p = int(match1(self.url, r'/p(\d+)') or '1')
self.url = 'https://www.bilibili.com/video/av%s?p=%s' % (avid, p)
self.url = 'https://www.bilibili.com/video/%s?p=%s' % (avid, p)
html_content = get_content(self.url, headers=self.bilibili_headers())
# redirect: bangumi/play/ss -> bangumi/play/ep
......
......@@ -7,7 +7,8 @@ from you_get.extractors import (
magisto,
youtube,
missevan,
acfun
acfun,
bilibili
)
......@@ -37,5 +38,12 @@ class YouGetTests(unittest.TestCase):
def test_acfun(self):
acfun.download('https://www.acfun.cn/v/ac11701912', info_only=True)
def test_bilibil(self):
bilibili.download(
"https://www.bilibili.com/watchlater/#/BV1PE411q7mZ/p6", info_only=True
)
bilibili.download(
"https://www.bilibili.com/watchlater/#/av74906671/p6", info_only=True
)
if __name__ == '__main__':
unittest.main()
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册