mirror of
https://github.com/soimort/you-get.git
synced 2025-01-23 13:35:16 +03:00
add support for BVID in watchlater mode.
This commit is contained in:
parent
d6afc2e829
commit
f12943aa00
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user