mirror of
https://github.com/soimort/you-get.git
synced 2025-01-23 21:45:02 +03:00
The bilibili got 502 occasionally
This commit is contained in:
parent
b554f9f9bc
commit
611cb6acdf
@ -1,6 +1,7 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
|
import urllib
|
||||||
|
|
||||||
from you_get.extractors import (
|
from you_get.extractors import (
|
||||||
imgur,
|
imgur,
|
||||||
@ -32,12 +33,23 @@ class YouGetTests(unittest.TestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def test_bilibili(self):
|
def test_bilibili(self):
|
||||||
|
maxRetry = 3
|
||||||
|
|
||||||
|
# the bilibi is not stable, it got 502 occasionally
|
||||||
|
for i in range(maxRetry):
|
||||||
|
try:
|
||||||
bilibili.download(
|
bilibili.download(
|
||||||
'https://www.bilibili.com/video/av16907446/', info_only=True
|
'https://www.bilibili.com/video/av16907446/', info_only=True
|
||||||
)
|
)
|
||||||
bilibili.download(
|
bilibili.download(
|
||||||
'https://www.bilibili.com/video/av13228063/', info_only=True
|
'https://www.bilibili.com/video/av13228063/', info_only=True
|
||||||
)
|
)
|
||||||
|
return
|
||||||
|
except urllib.error.HTTPError as e:
|
||||||
|
if e.error == 502 and i + 1 < maxRetry:
|
||||||
|
continue
|
||||||
|
else:
|
||||||
|
raise e
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
Loading…
Reference in New Issue
Block a user