mirror of
				https://github.com/RicterZ/nhentai.git
				synced 2025-11-04 02:50:55 +01:00 
			
		
		
		
	fix #336
This commit is contained in:
		@@ -5,6 +5,7 @@ import tempfile
 | 
				
			|||||||
from urllib.parse import urlparse
 | 
					from urllib.parse import urlparse
 | 
				
			||||||
from platform import system
 | 
					from platform import system
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def get_nhentai_home() -> str:
 | 
					def get_nhentai_home() -> str:
 | 
				
			||||||
    home = os.getenv('HOME', tempfile.gettempdir())
 | 
					    home = os.getenv('HOME', tempfile.gettempdir())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -20,6 +21,7 @@ def get_nhentai_home() -> str:
 | 
				
			|||||||
    # Use old default path in other systems
 | 
					    # Use old default path in other systems
 | 
				
			||||||
    return os.path.join(home, '.nhentai')
 | 
					    return os.path.join(home, '.nhentai')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
DEBUG = os.getenv('DEBUG', False)
 | 
					DEBUG = os.getenv('DEBUG', False)
 | 
				
			||||||
BASE_URL = os.getenv('NHENTAI', 'https://nhentai.net')
 | 
					BASE_URL = os.getenv('NHENTAI', 'https://nhentai.net')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -52,7 +54,8 @@ CONFIG = {
 | 
				
			|||||||
    'cookie': '',
 | 
					    'cookie': '',
 | 
				
			||||||
    'language': '',
 | 
					    'language': '',
 | 
				
			||||||
    'template': '',
 | 
					    'template': '',
 | 
				
			||||||
    'useragent': 'nhentai command line client (https://github.com/RicterZ/nhentai)'
 | 
					    'useragent': 'nhentai command line client (https://github.com/RicterZ/nhentai)',
 | 
				
			||||||
 | 
					    'max_filename': 85
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
LANGUAGE_ISO = {
 | 
					LANGUAGE_ISO = {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -327,7 +327,9 @@ def search_parser(keyword, sorting, page, is_page_all=False):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        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[:constant.CONFIG['max_filename']] + '..' if \
 | 
				
			||||||
 | 
					                len(title) > constant.CONFIG['max_filename'] else title
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            result.append({'id': row['id'], 'title': title})
 | 
					            result.append({'id': row['id'], 'title': title})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        not_exists_persist = False
 | 
					        not_exists_persist = False
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user