mirror of
				https://github.com/RicterZ/nhentai.git
				synced 2025-11-04 02:50:55 +01:00 
			
		
		
		
	resoved issue #249
This commit is contained in:
		@@ -71,7 +71,7 @@ def cmd_parser():
 | 
				
			|||||||
                      help='all search results')
 | 
					                      help='all search results')
 | 
				
			||||||
    parser.add_option('--page', '--page-range', type='string', dest='page', action='store', default='',
 | 
					    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')
 | 
					                      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])',
 | 
					                      help='sorting of doujinshi (recent / popular / popular-[today|week])',
 | 
				
			||||||
                      choices=['recent', 'popular', 'popular-today', 'popular-week', 'date'])
 | 
					                      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)
 | 
					        page = range(1, init_response['num_pages']+1)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    total = '/{0}'.format(page[-1]) if is_page_all else ''
 | 
					    total = '/{0}'.format(page[-1]) if is_page_all else ''
 | 
				
			||||||
 | 
					    not_exists_persist = False
 | 
				
			||||||
    for p in page:
 | 
					    for p in page:
 | 
				
			||||||
        i = 0
 | 
					        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:
 | 
					        if response is None or 'result' not in response:
 | 
				
			||||||
            logger.warning('No result in response in page {}'.format(p))
 | 
					            logger.warning('No result in response in page {}'.format(p))
 | 
				
			||||||
            break
 | 
					            if not_exists_persist is True:
 | 
				
			||||||
 | 
					                break
 | 
				
			||||||
 | 
					            continue
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        for row in response['result']:
 | 
					        for row in response['result']:
 | 
				
			||||||
            title = row['title']['english']
 | 
					            title = row['title']['english']
 | 
				
			||||||
            title = title[:85] + '..' if len(title) > 85 else title
 | 
					            title = title[:85] + '..' if len(title) > 85 else title
 | 
				
			||||||
            result.append({'id': row['id'], 'title': title})
 | 
					            result.append({'id': row['id'], 'title': title})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        not_exists_persist = False
 | 
				
			||||||
        if not result:
 | 
					        if not result:
 | 
				
			||||||
            logger.warning('No results for keywords {}'.format(keyword))
 | 
					            logger.warning('No results for keywords {}'.format(keyword))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user