mirror of
https://github.com/soimort/you-get.git
synced 2025-02-09 03:37:52 +03:00
[bilibili] there's a solution you're not seeing (close #2642)
This commit is contained in:
parent
a062be55f8
commit
2d8bf0e556
@ -115,7 +115,7 @@ class Bilibili(VideoExtractor):
|
|||||||
self.url = 'http://www.bilibili.com/video/av{}/'.format(aid)
|
self.url = 'http://www.bilibili.com/video/av{}/'.format(aid)
|
||||||
|
|
||||||
self.ua = fake_headers['User-Agent']
|
self.ua = fake_headers['User-Agent']
|
||||||
self.url = url_locations([self.url])[0]
|
self.url = url_locations([self.url], faker=True)[0]
|
||||||
frag = urllib.parse.urlparse(self.url).fragment
|
frag = urllib.parse.urlparse(self.url).fragment
|
||||||
# http://www.bilibili.com/video/av3141144/index_2.html#page=3
|
# http://www.bilibili.com/video/av3141144/index_2.html#page=3
|
||||||
if frag:
|
if frag:
|
||||||
@ -125,7 +125,7 @@ class Bilibili(VideoExtractor):
|
|||||||
aid = re.search(r'av(\d+)', self.url).group(1)
|
aid = re.search(r'av(\d+)', self.url).group(1)
|
||||||
self.url = 'http://www.bilibili.com/video/av{}/index_{}.html'.format(aid, page)
|
self.url = 'http://www.bilibili.com/video/av{}/index_{}.html'.format(aid, page)
|
||||||
self.referer = self.url
|
self.referer = self.url
|
||||||
self.page = get_content(self.url)
|
self.page = get_content(self.url, headers=fake_headers)
|
||||||
|
|
||||||
m = re.search(r'<h1.*?>(.*?)</h1>', self.page) or re.search(r'<h1 title="([^"]+)">', self.page)
|
m = re.search(r'<h1.*?>(.*?)</h1>', self.page) or re.search(r'<h1 title="([^"]+)">', self.page)
|
||||||
if m is not None:
|
if m is not None:
|
||||||
|
Loading…
Reference in New Issue
Block a user