mirror of
https://github.com/RicterZ/nhentai.git
synced 2025-04-20 02:41:19 +02:00
resoved issue #249
This commit is contained in:
parent
eff4f3bf9b
commit
1860b5f0cf
@ -71,7 +71,7 @@ def cmd_parser():
|
||||
help='all search results')
|
||||
parser.add_option('--page', '--page-range', type='string', dest='page', action='store', default='',
|
||||
help='page number of search results. e.g. 1,2-5,14')
|
||||
parser.add_option('--sorting', dest='sorting', action='store', default='popular',
|
||||
parser.add_option('--sorting', dest='sorting', action='store', default='recent',
|
||||
help='sorting of doujinshi (recent / popular / popular-[today|week])',
|
||||
choices=['recent', 'popular', 'popular-today', 'popular-week', 'date'])
|
||||
|
||||
|
@ -210,6 +210,7 @@ def search_parser(keyword, sorting, page, is_page_all=False):
|
||||
page = range(1, init_response['num_pages']+1)
|
||||
|
||||
total = '/{0}'.format(page[-1]) if is_page_all else ''
|
||||
not_exists_persist = False
|
||||
for p in page:
|
||||
i = 0
|
||||
|
||||
@ -226,13 +227,16 @@ def search_parser(keyword, sorting, page, is_page_all=False):
|
||||
|
||||
if response is None or 'result' not in response:
|
||||
logger.warning('No result in response in page {}'.format(p))
|
||||
if not_exists_persist is True:
|
||||
break
|
||||
continue
|
||||
|
||||
for row in response['result']:
|
||||
title = row['title']['english']
|
||||
title = title[:85] + '..' if len(title) > 85 else title
|
||||
result.append({'id': row['id'], 'title': title})
|
||||
|
||||
not_exists_persist = False
|
||||
if not result:
|
||||
logger.warning('No results for keywords {}'.format(keyword))
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user