--- /dev/null
-nhentai\r
-=======\r
-\r
-.. code-block::\r
-\r
- _ _ _ _\r
- _ __ | | | | ___ _ __ | |_ __ _(_)\r
- | '_ \| |_| |/ _ \ '_ \| __/ _` | |\r
- | | | | _ | __/ | | | || (_| | |\r
- |_| |_|_| |_|\___|_| |_|\__\__,_|_|\r
-\r
-\r
-あなたも変態。 いいね?\r
-\r
-|travis|\r
-|pypi|\r
-|license|\r
-\r
-\r
-nHentai is a CLI tool for downloading doujinshi from <http://nhentai.net>\r
-\r
-============\r
-Installation\r
-============\r
-.. code-block::\r
-\r
- git clone https://github.com/RicterZ/nhentai\r
- cd nhentai\r
- python setup.py install\r
- \r
-=====================\r
-Installation (Gentoo)\r
-=====================\r
-.. code-block::\r
-\r
- layman -fa glicOne\r
- sudo emerge net-misc/nhentai\r
-\r
-=====\r
-Usage\r
-=====\r
-**IMPORTANT**: To bypass the nhentai frequency limit, you should use `--cookie` option to store your cookie.\r
-\r
-*The default download folder will be the path where you run the command (CLI path).*\r
-\r
-\r
-Set your nhentai cookie against captcha:\r
-\r
-.. code-block:: bash\r
-\r
- nhentai --cookie 'YOUR COOKIE FROM nhentai.net'\r
-\r
-Download specified doujinshi:\r
-\r
-.. code-block:: bash\r
-\r
- nhentai --id=123855,123866\r
-\r
-Download doujinshi with ids specified in a file (doujinshi ids split by line):\r
-\r
-.. code-block:: bash\r
-\r
- nhentai --file=doujinshi.txt\r
-\r
-Search a keyword and download the first page:\r
-\r
-.. code-block:: bash\r
-\r
- nhentai --search="tomori" --page=1 --download\r
-\r
-Download by tag name:\r
-\r
-.. code-block:: bash\r
-\r
- nhentai --tag lolicon --download --page=2\r
-\r
-Download your favorites with delay:\r
-\r
-.. code-block:: bash\r
-\r
- nhentai --favorites --download --delay 1\r
-\r
-Format output doujinshi folder name:\r
-\r
-.. code-block:: bash\r
-\r
- nhentai --id 261100 --format '[%i]%s'\r
-\r
-Supported doujinshi folder formatter:\r
-\r
-- %i: Doujinshi id\r
-- %t: Doujinshi name\r
-- %s: Doujinshi subtitle (translated name)\r
-- %a: Doujinshi authors' name\r
-\r
-\r
-Other options:\r
-\r
-.. code-block::\r
-\r
- Options:\r
- # Operation options\r
- -h, --help show this help message and exit\r
- -D, --download download doujinshi (for search results)\r
- -S, --show just show the doujinshi information\r
-\r
- # Doujinshi options\r
- --id=ID doujinshi ids set, e.g. 1,2,3\r
- -s KEYWORD, --search=KEYWORD\r
- search doujinshi by keyword\r
- --tag=TAG download doujinshi by tag\r
- -F, --favorites list or download your favorites.\r
-\r
- # Multi-page options\r
- --page=PAGE page number of search results\r
- --max-page=MAX_PAGE The max page when recursive download tagged doujinshi\r
-\r
- # Download options\r
- -o OUTPUT_DIR, --output=OUTPUT_DIR\r
- output dir\r
- -t THREADS, --threads=THREADS\r
- thread count for downloading doujinshi\r
- -T TIMEOUT, --timeout=TIMEOUT\r
- timeout for downloading doujinshi\r
- -d DELAY, --delay=DELAY\r
- slow down between downloading every doujinshi\r
- -p PROXY, --proxy=PROXY\r
- uses a proxy, for example: http://127.0.0.1:1080\r
- -f FILE, --file=FILE read gallery IDs from file.\r
- --format=NAME_FORMAT format the saved folder name\r
-\r
- # Generating options\r
- --html generate a html viewer at current directory\r
- --no-html don't generate HTML after downloading\r
- -C, --cbz generate Comic Book CBZ File\r
- --rm-origin-dir remove downloaded doujinshi dir when generated CBZ\r
- file.\r
-\r
- # nHentai options\r
- --cookie=COOKIE set cookie of nhentai to bypass Google recaptcha\r
-\r
-\r
-==============\r
-nHentai Mirror\r
-==============\r
-If you want to use a mirror, you should set up a reverse proxy of `nhentai.net` and `i.nhentai.net`.\r
-For example:\r
-\r
-.. code-block:: \r
-\r
- i.h.loli.club -> i.nhentai.net\r
- h.loli.club -> nhentai.net\r
-\r
-Set `NHENTAI` env var to your nhentai mirror.\r
-\r
-.. code-block:: bash\r
-\r
- NHENTAI=http://h.loli.club nhentai --id 123456\r
-\r
-\r
-.. image:: ./images/search.png?raw=true\r
- :alt: nhentai\r
- :align: center\r
-.. image:: ./images/download.png?raw=true\r
- :alt: nhentai\r
- :align: center\r
-.. image:: ./images/viewer.png?raw=true\r
- :alt: nhentai\r
- :align: center\r
-\r
-============\r
-あなたも変態\r
-============\r
-.. image:: ./images/image.jpg?raw=true\r
- :alt: nhentai\r
- :align: center\r
-\r
-\r
-\r
-.. |travis| image:: https://travis-ci.org/RicterZ/nhentai.svg?branch=master\r
- :target: https://travis-ci.org/RicterZ/nhentai\r
-\r
-.. |pypi| image:: https://img.shields.io/pypi/dm/nhentai.svg\r
- :target: https://pypi.org/project/nhentai/\r
-\r
-.. |license| image:: https://img.shields.io/github/license/ricterz/nhentai.svg\r
- :target: https://github.com/RicterZ/nhentai/blob/master/LICENSE\r
++nhentai
++=======
++
++.. code-block::
++
++ _ _ _ _
++ _ __ | | | | ___ _ __ | |_ __ _(_)
++ | '_ \| |_| |/ _ \ '_ \| __/ _` | |
++ | | | | _ | __/ | | | || (_| | |
++ |_| |_|_| |_|\___|_| |_|\__\__,_|_|
++
++
++あなたも変態。 いいね?
++
++|travis|
++|pypi|
++|license|
++
++
++nHentai is a CLI tool for downloading doujinshi from <http://nhentai.net>
++
++============
++Installation
++============
++.. code-block::
++
++ git clone https://github.com/RicterZ/nhentai
++ cd nhentai
++ python setup.py install
++
++=====================
++Installation (Gentoo)
++=====================
++.. code-block::
++
++ layman -fa glicOne
++ sudo emerge net-misc/nhentai
++
++=====
++Usage
++=====
++**IMPORTANT**: To bypass the nhentai frequency limit, you should use `--cookie` option to store your cookie.
++
++*The default download folder will be the path where you run the command (CLI path).*
++
++
++Set your nhentai cookie against captcha:
++
++.. code-block:: bash
++
++ nhentai --cookie 'YOUR COOKIE FROM nhentai.net'
++
++Download specified doujinshi:
++
++.. code-block:: bash
++
++ nhentai --id=123855,123866
++
++Download doujinshi with ids specified in a file (doujinshi ids split by line):
++
++.. code-block:: bash
++
++ nhentai --file=doujinshi.txt
++
++Search a keyword and download the first page:
++
++.. code-block:: bash
++
++ nhentai --search="tomori" --page=1 --download
++
++Download by tag name:
++
++.. code-block:: bash
++
++ nhentai --tag lolicon --download --page=2
++
++Download your favorites with delay:
++
++.. code-block:: bash
++
++ nhentai --favorites --download --delay 1
++
++Format output doujinshi folder name:
++
++.. code-block:: bash
++
++ nhentai --id 261100 --format '[%i]%s'
++
++Supported doujinshi folder formatter:
++
++- %i: Doujinshi id
++- %t: Doujinshi name
++- %s: Doujinshi subtitle (translated name)
++- %a: Doujinshi authors' name
++
++
++Other options:
++
++.. code-block::
++
++ Options:
++ # Operation options
++ -h, --help show this help message and exit
++ -D, --download download doujinshi (for search results)
++ -S, --show just show the doujinshi information
++
++ # Doujinshi options
++ --id=ID doujinshi ids set, e.g. 1,2,3
++ -s KEYWORD, --search=KEYWORD
++ search doujinshi by keyword
++ --tag=TAG download doujinshi by tag
++ -F, --favorites list or download your favorites.
++
++ # Multi-page options
++ --page=PAGE page number of search results
++ --max-page=MAX_PAGE The max page when recursive download tagged doujinshi
++
++ # Download options
++ -o OUTPUT_DIR, --output=OUTPUT_DIR
++ output dir
++ -t THREADS, --threads=THREADS
++ thread count for downloading doujinshi
++ -T TIMEOUT, --timeout=TIMEOUT
++ timeout for downloading doujinshi
++ -d DELAY, --delay=DELAY
++ slow down between downloading every doujinshi
++ -p PROXY, --proxy=PROXY
++ uses a proxy, for example: http://127.0.0.1:1080
++ -f FILE, --file=FILE read gallery IDs from file.
++ --format=NAME_FORMAT format the saved folder name
++
++ # Generating options
++ --html generate a html viewer at current directory
++ --no-html don't generate HTML after downloading
++ -C, --cbz generate Comic Book CBZ File
++ --rm-origin-dir remove downloaded doujinshi dir when generated CBZ
++ file.
++
++ # nHentai options
++ --cookie=COOKIE set cookie of nhentai to bypass Google recaptcha
++
++
++==============
++nHentai Mirror
++==============
++If you want to use a mirror, you should set up a reverse proxy of `nhentai.net` and `i.nhentai.net`.
++For example:
++
++.. code-block::
++
++ i.h.loli.club -> i.nhentai.net
++ h.loli.club -> nhentai.net
++
++Set `NHENTAI` env var to your nhentai mirror.
++
++.. code-block:: bash
++
++ NHENTAI=http://h.loli.club nhentai --id 123456
++
++
++.. image:: ./images/search.png?raw=true
++ :alt: nhentai
++ :align: center
++.. image:: ./images/download.png?raw=true
++ :alt: nhentai
++ :align: center
++.. image:: ./images/viewer.png?raw=true
++ :alt: nhentai
++ :align: center
++
++============
++あなたも変態
++============
++.. image:: ./images/image.jpg?raw=true
++ :alt: nhentai
++ :align: center
++
++
++
++.. |travis| image:: https://travis-ci.org/RicterZ/nhentai.svg?branch=master
++ :target: https://travis-ci.org/RicterZ/nhentai
++
++.. |pypi| image:: https://img.shields.io/pypi/dm/nhentai.svg
++ :target: https://pypi.org/project/nhentai/
++
++.. |license| image:: https://img.shields.io/github/license/ricterz/nhentai.svg
++ :target: https://github.com/RicterZ/nhentai/blob/master/LICENSE
pass
import nhentai.constant as constant
-from nhentai.utils import urlparse, generate_html
+ from nhentai import __version__
+from nhentai.utils import urlparse, generate_html, generate_main_html
from nhentai.logger import logger
try:
help='output dir')
parser.add_option('--threads', '-t', type='int', dest='threads', action='store', default=5,
help='thread count for downloading doujinshi')
- parser.add_option('--timeout', type='int', dest='timeout', action='store', default=30,
+ parser.add_option('--timeout', '-T', type='int', dest='timeout', action='store', default=30,
help='timeout for downloading doujinshi')
- parser.add_option('--proxy', type='string', dest='proxy', action='store', default='',
- help='uses a proxy, for example: --proxy "http://127.0.0.1:1080" or its alias "default"')
+ parser.add_option('--delay', '-d', type='int', dest='delay', action='store', default=0,
+ help='slow down between downloading every doujinshi')
+ parser.add_option('--proxy', '-p', type='string', dest='proxy', action='store', default='',
+ help='uses a proxy, for example: http://127.0.0.1:1080')
+ parser.add_option('--file', '-f', type='string', dest='file', action='store', help='read gallery IDs from file.')
+ parser.add_option('--format', type='string', dest='name_format', action='store',
+ help='format the saved folder name', default='[%i][%a][%t]')
+
+ # generate options
parser.add_option('--html', dest='html_viewer', action='store_true',
help='generate a html viewer at current directory')
-
- parser.add_option('--login', '-l', type='str', dest='login', action='store',
- help='username:password pair of nhentai account')
-
- parser.add_option('--nohtml', dest='is_nohtml', action='store_true',
- help='Don\'t generate HTML')
-
- parser.add_option('--cbz', dest='is_cbz', action='store_true',
- help='Generate Comic Book CBZ File')
+ parser.add_option('--no-html', dest='is_nohtml', action='store_true',
+ help='don\'t generate HTML after downloading')
+ parser.add_option('--gen-main', dest='main_viewer', action='store_true',
+ help='generate a main viewer contain all the doujin in the folder')
+ parser.add_option('--cbz', '-C', dest='is_cbz', action='store_true',
+ help='generate Comic Book CBZ File')
parser.add_option('--rm-origin-dir', dest='rm_origin_dir', action='store_true', default=False,
- help='Remove downloaded doujinshi dir when generated CBZ file.')
- parser.add_option('--file', '-f', type='string', dest='file', action='store', help='Read gallery IDs from file.')
+ help='remove downloaded doujinshi dir when generated CBZ file.')
+
+ # nhentai options
+ parser.add_option('--cookie', type='str', dest='cookie', action='store',
+ help='set cookie of nhentai to bypass Google recaptcha')
try:
sys.argv = list(map(lambda x: unicode(x.decode(sys.stdin.encoding)), sys.argv))
generate_html()
exit(0)
+ if args.main_viewer:
+ generate_main_html()
+ exit(0)
+
+ if os.path.exists(os.path.join(constant.NHENTAI_HOME, 'cookie')):
+ with open(os.path.join(constant.NHENTAI_HOME, 'cookie'), 'r') as f:
+ constant.COOKIE = f.read()
+
+ if args.cookie:
+ try:
+ if not os.path.exists(constant.NHENTAI_HOME):
+ os.mkdir(constant.NHENTAI_HOME)
+
+ with open(os.path.join(constant.NHENTAI_HOME, 'cookie'), 'w') as f:
+ f.write(args.cookie)
+ except Exception as e:
+ logger.error('Cannot create NHENTAI_HOME: {}'.format(str(e)))
+ exit(1)
+
+ logger.info('Cookie saved.')
+ exit(0)
+
+ '''
if args.login:
try:
_, _ = args.login.split(':', 1)