mirror of
https://github.com/RicterZ/nhentai.git
synced 2025-04-20 11:01:17 +02:00
do not download 404
This commit is contained in:
parent
12f7b2225b
commit
5592b30be4
@ -30,9 +30,12 @@ def banner():
|
||||
|
||||
|
||||
def cmd_parser():
|
||||
parser = OptionParser()
|
||||
parser.add_option('--download', dest='is_download', action='store_true', help='download doujinshi or not')
|
||||
parser.add_option('--show-info', dest='is_show', action='store_true', help='just show the doujinshi information.')
|
||||
parser = OptionParser('\nnhentai --search [keyword] --download'
|
||||
'\nNHENTAI=http://h.loli.club nhentai --id [ID ...]'
|
||||
'\n\nEnvironment Variable:\n'
|
||||
'NHENTAI nhentai mirror url')
|
||||
parser.add_option('--download', dest='is_download', action='store_true', help='download doujinshi (for search result)')
|
||||
parser.add_option('--show-info', dest='is_show', action='store_true', help='just show the doujinshi information')
|
||||
parser.add_option('--id', type='string', dest='id', action='store', help='doujinshi ids set, e.g. 1,2,3')
|
||||
parser.add_option('--search', type='string', dest='keyword', action='store', help='search doujinshi by keyword')
|
||||
parser.add_option('--page', type='int', dest='page', action='store', default=1,
|
||||
|
@ -31,6 +31,8 @@ class Downloader(Singleton):
|
||||
try:
|
||||
with open(os.path.join(folder, base_filename.zfill(3) + extension), "wb") as f:
|
||||
response = request('get', url, stream=True, timeout=self.timeout)
|
||||
if response.status_code != 200:
|
||||
logger.warning('Warning: url: {} return status code 404'.format(url))
|
||||
length = response.headers.get('content-length')
|
||||
if length is None:
|
||||
f.write(response.content)
|
||||
|
Loading…
x
Reference in New Issue
Block a user