from nhentai.downloader import Downloader
from nhentai.logger import logger
from nhentai.constant import BASE_URL
-from nhentai.utils import generate_html, generate_cbz, generate_main_html
+from nhentai.utils import generate_html, generate_cbz, generate_main_html, check_cookie
def main():
if PROXY != {}:
logger.info('Using proxy: {0}'.format(PROXY))
+ # check your cookie
+ check_cookie()
+
doujinshi_ids = []
doujinshi_list = []
from __future__ import unicode_literals, print_function
import sys
+import re
import os
import string
import zipfile
return getattr(session, method)(url, proxies=constant.PROXY, verify=False, **kwargs)
+def check_cookie():
+ response = request('get', constant.BASE_URL).text
+ username = re.findall('"/users/\d+/(.*?)"', response)
+ if not username:
+ logger.error('Cannot get your username, please check your cookie or use `nhentai --cookie` to set your cookie')
+ else:
+ logger.info('Login successfully! Your username: {}'.format(username[0]))
+
+
class _Singleton(type):
""" A metaclass that creates a Singleton base class when called. """
_instances = {}