This commit is contained in:
RicterZ 2019-05-04 12:12:57 +08:00
parent b64b718c88
commit b173a6c28f
3 changed files with 8 additions and 3 deletions

View File

@ -26,10 +26,14 @@ def main():
logger.info('Logging in to nhentai using credential pair \'%s:%s\'' % (username, '*' * len(password)))
login(username, password)
if options.is_download:
if options.is_download or options.is_show:
for doujinshi_info in login_parser():
doujinshi_list.append(Doujinshi(**doujinshi_info))
if options.is_show and not options.is_download:
print_doujinshi([{'id': i.id, 'title': i.name} for i in doujinshi_list])
exit(0)
if options.tag:
doujinshis = tag_parser(options.tag, max_page=options.max_page)
print_doujinshi(doujinshis)
@ -38,6 +42,7 @@ def main():
if options.keyword:
doujinshis = search_parser(options.keyword, options.page)
print(doujinshis)
print_doujinshi(doujinshis)
if options.is_download:
doujinshi_ids = map(lambda d: d['id'], doujinshis)

View File

@ -48,7 +48,7 @@ class Doujinshi(object):
["Characters", self.info.character],
["Authors", self.info.artist],
["Language", self.info.language],
["Tags", ', '.join(self.info.tag.keys())],
["Tags", self.info.tags],
["URL", self.url],
["Pages", self.pages],
]

View File

@ -95,7 +95,7 @@ def login_parser():
ret.append(result)
# TODO: reduce threads number ...
thread_pool = threadpool.ThreadPool(3)
thread_pool = threadpool.ThreadPool(1)
for page in range(1, pages + 1):
try: