[bilibili] quick hack for #2377 (enforce timeout 1)

This commit is contained in:
Mort Yao 2017-09-20 22:50:37 +02:00
parent d1c0810742
commit 5019d9d23f
No known key found for this signature in database
GPG Key ID: 07DA00CB78203251

View File

@ -104,6 +104,8 @@ class Bilibili(VideoExtractor):
self.parse_bili_xml(api_xml) self.parse_bili_xml(api_xml)
def prepare(self, **kwargs): def prepare(self, **kwargs):
socket.setdefaulttimeout(1) # fail fast, very speedy!
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])[0]
frag = urllib.parse.urlparse(self.url).fragment frag = urllib.parse.urlparse(self.url).fragment