mirror of
https://github.com/RicterZ/nhentai.git
synced 2025-04-20 11:01:17 +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 = 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_HOME = get_nhentai_home()
|
||||||
NHENTAI_HISTORY = os.path.join(NHENTAI_HOME, 'history.sqlite3')
|
NHENTAI_HISTORY = os.path.join(NHENTAI_HOME, 'history.sqlite3')
|
||||||
|
@ -67,10 +67,14 @@ class Downloader(Singleton):
|
|||||||
try:
|
try:
|
||||||
response = request('get', url, stream=True, timeout=self.timeout, proxies=proxy)
|
response = request('get', url, stream=True, timeout=self.timeout, proxies=proxy)
|
||||||
if response.status_code != 200:
|
if response.status_code != 200:
|
||||||
raise NHentaiImageNotExistException
|
path = urlparse(url).path
|
||||||
|
for mirror in constant.IMAGE_URL_MIRRORS:
|
||||||
except NHentaiImageNotExistException as e:
|
print(f'{mirror}{path}')
|
||||||
raise e
|
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:
|
except Exception as e:
|
||||||
i += 1
|
i += 1
|
||||||
|
@ -135,7 +135,7 @@ def doujinshi_parser(id_, counter=0):
|
|||||||
logger.warning(f'Error: {e}, ignored')
|
logger.warning(f'Error: {e}, ignored')
|
||||||
return None
|
return None
|
||||||
|
|
||||||
print(response)
|
# print(response)
|
||||||
html = BeautifulSoup(response, 'html.parser')
|
html = BeautifulSoup(response, 'html.parser')
|
||||||
doujinshi_info = html.find('div', attrs={'id': 'info'})
|
doujinshi_info = html.find('div', attrs={'id': 'info'})
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user