mirror of
https://github.com/RicterZ/nhentai.git
synced 2025-04-20 02:41:19 +02:00
fix bug #24
This commit is contained in:
parent
f316c3243b
commit
8546b9e759
@ -50,8 +50,16 @@ def login_parser(username, password):
|
|||||||
logger.error('Cannot get count of your favorites, maybe login failed.')
|
logger.error('Cannot get count of your favorites, maybe login failed.')
|
||||||
|
|
||||||
count = int(count.text.strip('(').strip(')'))
|
count = int(count.text.strip('(').strip(')'))
|
||||||
pages = count / 25
|
if count == 0:
|
||||||
|
logger.warning('No favorites found')
|
||||||
|
return []
|
||||||
|
pages = int(count / 25)
|
||||||
|
|
||||||
|
if pages:
|
||||||
pages += 1 if count % (25 * pages) else 0
|
pages += 1 if count % (25 * pages) else 0
|
||||||
|
else:
|
||||||
|
pages = 1
|
||||||
|
|
||||||
logger.info('Your have %d favorites in %d pages.' % (count, pages))
|
logger.info('Your have %d favorites in %d pages.' % (count, pages))
|
||||||
|
|
||||||
if os.getenv('DEBUG'):
|
if os.getenv('DEBUG'):
|
||||||
@ -68,7 +76,7 @@ def login_parser(username, password):
|
|||||||
for page in range(1, pages+1):
|
for page in range(1, pages+1):
|
||||||
try:
|
try:
|
||||||
logger.info('Getting doujinshi id of page %d' % page)
|
logger.info('Getting doujinshi id of page %d' % page)
|
||||||
resp = s.get(constant.FAV_URL + '?page=%d' % page).content
|
resp = s.get(constant.FAV_URL + '?page=%d' % page).text
|
||||||
ids = doujinshi_id.findall(resp)
|
ids = doujinshi_id.findall(resp)
|
||||||
requests_ = threadpool.makeRequests(doujinshi_parser, ids, _callback)
|
requests_ = threadpool.makeRequests(doujinshi_parser, ids, _callback)
|
||||||
[thread_pool.putRequest(req) for req in requests_]
|
[thread_pool.putRequest(req) for req in requests_]
|
||||||
|
@ -2,4 +2,4 @@ requests>=2.5.0
|
|||||||
BeautifulSoup4>=4.0.0
|
BeautifulSoup4>=4.0.0
|
||||||
threadpool>=1.2.7
|
threadpool>=1.2.7
|
||||||
tabulate>=0.7.5
|
tabulate>=0.7.5
|
||||||
future>=0.15.2
|
future>=0.15.2threadpool==1.3.2
|
||||||
|
Loading…
x
Reference in New Issue
Block a user