mirror of
https://github.com/RicterZ/nhentai.git
synced 2025-04-20 11:01:17 +02:00
fix bug of return value
This commit is contained in:
parent
3d481dbf13
commit
dd7b2d493e
@ -46,20 +46,20 @@ def cmd_parser():
|
|||||||
if args.is_download and not args.id and not args.ids and not args.keyword:
|
if args.is_download and not args.id and not args.ids and not args.keyword:
|
||||||
logger.critical('Doujinshi id/ids is required for downloading')
|
logger.critical('Doujinshi id/ids is required for downloading')
|
||||||
parser.print_help()
|
parser.print_help()
|
||||||
exit(1)
|
exit(0)
|
||||||
|
|
||||||
if args.id:
|
if args.id:
|
||||||
args.ids = (args.id, ) if not args.ids else args.ids
|
args.ids = (args.id, ) if not args.ids else args.ids
|
||||||
|
|
||||||
if not args.keyword and not args.ids:
|
if not args.keyword and not args.ids:
|
||||||
parser.print_help()
|
parser.print_help()
|
||||||
exit(1)
|
exit(0)
|
||||||
|
|
||||||
if args.threads <= 0:
|
if args.threads <= 0:
|
||||||
args.threads = 1
|
args.threads = 1
|
||||||
elif args.threads > 10:
|
elif args.threads > 10:
|
||||||
logger.critical('Maximum number of used threads is 10')
|
logger.critical('Maximum number of used threads is 10')
|
||||||
exit(1)
|
exit(0)
|
||||||
|
|
||||||
if args.proxy:
|
if args.proxy:
|
||||||
import urlparse
|
import urlparse
|
||||||
|
@ -28,7 +28,7 @@ def main():
|
|||||||
doujinshi_info = doujinshi_parser(id)
|
doujinshi_info = doujinshi_parser(id)
|
||||||
doujinshi_list.append(Doujinshi(**doujinshi_info))
|
doujinshi_list.append(Doujinshi(**doujinshi_info))
|
||||||
else:
|
else:
|
||||||
exit(1)
|
exit(0)
|
||||||
|
|
||||||
if options.is_download:
|
if options.is_download:
|
||||||
downloader = Downloader(path=options.saved_path,
|
downloader = Downloader(path=options.saved_path,
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
import sys
|
|
||||||
import re
|
import re
|
||||||
import requests
|
import requests
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
@ -30,7 +29,7 @@ def doujinshi_parser(id_):
|
|||||||
response = request('get', url).content
|
response = request('get', url).content
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.critical(str(e))
|
logger.critical(str(e))
|
||||||
sys.exit()
|
exit(1)
|
||||||
|
|
||||||
html = BeautifulSoup(response)
|
html = BeautifulSoup(response)
|
||||||
doujinshi_info = html.find('div', attrs={'id': 'info'})
|
doujinshi_info = html.find('div', attrs={'id': 'info'})
|
||||||
@ -45,7 +44,8 @@ def doujinshi_parser(id_):
|
|||||||
img_id = re.search('/galleries/([\d]+)/cover\.(jpg|png)$', doujinshi_cover.a.img['src'])
|
img_id = re.search('/galleries/([\d]+)/cover\.(jpg|png)$', doujinshi_cover.a.img['src'])
|
||||||
if not img_id:
|
if not img_id:
|
||||||
logger.critical('Tried yo get image id failed')
|
logger.critical('Tried yo get image id failed')
|
||||||
sys.exit()
|
exit(1)
|
||||||
|
|
||||||
doujinshi['img_id'] = img_id.group(1)
|
doujinshi['img_id'] = img_id.group(1)
|
||||||
doujinshi['ext'] = img_id.group(2)
|
doujinshi['ext'] = img_id.group(2)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user