mirror of
https://github.com/RicterZ/nhentai.git
synced 2025-04-19 10:21:19 +02:00
fix #341
This commit is contained in:
parent
4223326c13
commit
4ed4523782
@ -35,6 +35,11 @@ FAV_URL = f'{BASE_URL}/favorites/'
|
||||
|
||||
|
||||
IMAGE_URL = f'{urlparse(BASE_URL).scheme}://i.{urlparse(BASE_URL).hostname}/galleries'
|
||||
IMAGE_URL_MIRRORS = [
|
||||
f'{urlparse(BASE_URL).scheme}://i3.{urlparse(BASE_URL).hostname}'
|
||||
f'{urlparse(BASE_URL).scheme}://i5.{urlparse(BASE_URL).hostname}'
|
||||
f'{urlparse(BASE_URL).scheme}://i7.{urlparse(BASE_URL).hostname}'
|
||||
]
|
||||
|
||||
NHENTAI_HOME = get_nhentai_home()
|
||||
NHENTAI_HISTORY = os.path.join(NHENTAI_HOME, 'history.sqlite3')
|
||||
|
@ -67,10 +67,14 @@ class Downloader(Singleton):
|
||||
try:
|
||||
response = request('get', url, stream=True, timeout=self.timeout, proxies=proxy)
|
||||
if response.status_code != 200:
|
||||
raise NHentaiImageNotExistException
|
||||
|
||||
except NHentaiImageNotExistException as e:
|
||||
raise e
|
||||
path = urlparse(url).path
|
||||
for mirror in constant.IMAGE_URL_MIRRORS:
|
||||
print(f'{mirror}{path}')
|
||||
mirror_url = f'{mirror}{path}'
|
||||
response = request('get', mirror_url, stream=True,
|
||||
timeout=self.timeout, proxies=proxy)
|
||||
if response.status_code == 200:
|
||||
break
|
||||
|
||||
except Exception as e:
|
||||
i += 1
|
||||
|
@ -135,7 +135,7 @@ def doujinshi_parser(id_, counter=0):
|
||||
logger.warning(f'Error: {e}, ignored')
|
||||
return None
|
||||
|
||||
print(response)
|
||||
# print(response)
|
||||
html = BeautifulSoup(response, 'html.parser')
|
||||
doujinshi_info = html.find('div', attrs={'id': 'info'})
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user