Giter VIP home page Giter VIP logo

nhentai's Introduction

nhentai

あなたも変態。 いいね?

travis pypi version license

nhentai is a CLI tool for downloading doujinshi from nhentai.net

GUI version: https://github.com/edgar1016/nhentai-GUI

Manual Installation

From Github:

git clone https://github.com/RicterZ/nhentai
cd nhentai
python setup.py install

Build Docker container:

git clone https://github.com/RicterZ/nhentai
cd nhentai
docker build -t nhentai:latest .
docker run --rm -it -v ~/Downloads/doujinshi:/output -v ~/.nhentai/:/root/.nhentai nhentai --id 123855

Installation

From PyPI with pip:

pip install nhentai

For a self-contained installation, use pipx:

pipx install nhentai

Pull from Dockerhub:

docker pull ricterz/nhentai
docker run --rm -it -v ~/Downloads/doujinshi:/output -v ~/.nhentai/:/root/.nhentai ricterz/nhentai --id 123855

On Gentoo Linux:

layman -fa glicOne
sudo emerge net-misc/nhentai

On NixOS:

nix-env -iA nixos.nhentai

Usage

⚠️IMPORTANT⚠️: To bypass the nhentai frequency limit, you should use --cookie and --useragent options to store your cookie and your user-agent.

nhentai --useragent "USER AGENT of YOUR BROWSER"
nhentai --cookie "YOUR COOKIE FROM nhentai.net"

NOTE:

  • The format of the cookie is "csrftoken=TOKEN; sessionid=ID; cf_clearance=CLOUDFLARE"
  • cf_clearance cookie and useragent must be set if you encounter "blocked by cloudflare captcha" error. Make sure you use the same IP and useragent as when you got it
To get csrftoken and sessionid, first login to your nhentai account in web browser, then:
(Chrome) ⋮ — More tools — Developer tools — Application — Storage — Cookies — https://nhentai.net
(Firefox) ☰ — Web Developer — Web Developer Tools — Storage — Cookies — https://nhentai.net

nhentai

The default download folder will be the path where you run the command (%cd% or $PWD).

Download specified doujinshi:

nhentai --id 123855 123866 123877

Download doujinshi with ids specified in a file (doujinshi ids split by line):

nhentai --file=doujinshi.txt

Set search default language

nhentai --language=english

Search a keyword and download the first page:

nhentai --search="tomori" --page=1 --download
# you also can download by tags and multiple keywords
nhentai --search="tag:lolicon, artist:henreader, tag:full color"
nhentai --search="lolicon, henreader, full color"

Download your favorites with delay:

nhentai --favorites --download --delay 1

Format output doujinshi folder name:

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
  • %g: Doujinshi groups name
  • %p: Doujinshi pretty name
  • %ag: Doujinshi authors name or groups name

Other options:

Usage:
  nhentai --search [keyword] --download
  NHENTAI=https://nhentai-mirror-url/ nhentai --id [ID ...]
  nhentai --file [filename]

Environment Variable:
  NHENTAI                 nhentai mirror url

Options:
  # Operation options, control the program behaviors
  -h, --help            show this help message and exit
  -D, --download        download doujinshi (for search results)
  -S, --show            just show the doujinshi information

  # Doujinshi options, specify id, keyword, etc.
  --id                  doujinshi ids set, e.g. 167680 167681 167682
  -s KEYWORD, --search=KEYWORD
                        search doujinshi by keyword
  -F, --favorites       list or download your favorites

  # Page options, control the page to fetch / download
  --page-all            all search results
  --page=PAGE, --page-range=PAGE
                        page number of search results. e.g. 1,2-5,14
  --sorting=SORTING     sorting of doujinshi (recent / popular /
                        popular-[today|week])

  # Download options, the output directory, threads, timeout, delay, etc.
  -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
  --proxy=PROXY         store a proxy, for example: -p "http://127.0.0.1:1080"
  -f FILE, --file=FILE  read gallery IDs from file.
  --format=NAME_FORMAT  format the saved folder name
  --dry-run             Dry run, skip file download

  # Generate options, for generate html viewer, cbz file, pdf file, etc
  --html                generate a html viewer at current directory
  --no-html             don't generate HTML after downloading
  --gen-main            generate a main viewer contain all the doujin in the
                        folder
  -C, --cbz             generate Comic Book CBZ File
  -P, --pdf             generate PDF file
  --rm-origin-dir       remove downloaded doujinshi dir when generated CBZ or
                        PDF file
  --move-to-folder      remove files in doujinshi dir then move new file to folder
                        when generated CBZ or PDF file
  --meta                generate a metadata file in doujinshi format
  --regenerate-cbz      regenerate the cbz file if exists

  # nhentai options, set cookie, user-agent, language, remove caches, histories, etc
  --cookie=COOKIE       set cookie of nhentai to bypass Cloudflare captcha
  --useragent=USERAGENT, --user-agent=USERAGENT
                        set useragent to bypass Cloudflare captcha
  --language=LANGUAGE   set default language to parse doujinshis
  --clean-language      set DEFAULT as language to parse doujinshis
  --save-download-history
                        save downloaded doujinshis, whose will be skipped if
                        you re-download them
  --clean-download-history
                        clean download history
  --template=VIEWER_TEMPLATE
                        set viewer template
  --legacy              use legacy searching method

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:

i.h.loli.club -> i.nhentai.net
h.loli.club -> nhentai.net

Set NHENTAI env var to your nhentai mirror.

NHENTAI=https://h.loli.club nhentai --id 123456

nhentai

nhentai

nhentai

nhentai's People

Contributors

alocks avatar anhnhan avatar atsushi-hirako avatar bachoseven avatar dependabot[bot] avatar edgar1016 avatar fuzi23 avatar jwfiredragon avatar karamori77 avatar krrr avatar lleene avatar mentaterasmus avatar myc1ou1d avatar myzwillmake avatar navrudh avatar nontre12 avatar odtian avatar onlymyflower avatar pizzacus avatar rdgoprslv avatar reynog avatar ricterz avatar romaniukvadim avatar somerandomdude870 avatar spyridion avatar symant233 avatar violetdarkness avatar waiifu avatar zn3x avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nhentai's Issues

Invalid literal for int()

Version: 0.2.17

Command:
nhentai --login "username:password" --download

Output:

Traceback (most recent call last):

  File "/usr/local/bin/nhentai", line 11, in <module>
    sys.exit(main())

  File "/usr/local/lib/python2.7/dist-packages/nhentai/command.py", line 27, in main
    for doujinshi_info in login_parser(username=username, password=password):

  File "/usr/local/lib/python2.7/dist-packages/nhentai/parser.py", line 53, in login_parser
    count = int(count.text.strip('(').strip(')'))

ValueError: invalid literal for int() with base 10: '3,701'

tutorial

hello can you please record video in how to use your script to download because i can't get it work

下载本子出错

id是130481
这本本子的图片有些是jpg格式, 有些是png格式, 脚本抓取的时候当作都是jpg格式的抓取了

Filename too long error

Sometimes the titles have long names, which prevents the program from creating the folder:

[CRITICAL] [Errno 36] File name too long: ....

Would it be possible to auto-cut it off to a certain number of characters when creating the folder, and then store the actual filename in a text file so that we don't lose the actual title?

Not downloading more than 25 galleries

Using search or tag options does not search and queue more than 25 galleries (bound by page results).
Using
nhentai --tag lolicon --download
throws an error
[CRITICAL] No JSON object could be decoded

New feature request

consider making a python script that would allow me to download hentai pics from all the top image boards? I would like to use tags to lookup and download images. And want to also use tags to eliminate images from being downloaded. I also don't know if this could be done as a feature. I would be to eliminate duplicate images from being downloaded by having it cross reference already downloaded images.

No JSON object could be decoded

When I attempt to download from my favorites, some of the doujinshi give the error referenced in the title.

Version:
0.2.18

Command:
nhentai --login username:password --download

Output:

[22:14:53] [INFO] Fetching information of doujinshi id 250158
[22:14:53] [CRITICAL] No JSON object could be decoded
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/threadpool.py", line 158, in run
    result = request.callable(*request.args, **request.kwds)
  File "/usr/local/lib/python2.7/dist-packages/nhentai-0.2.18-py2.7.egg/nhentai/parser.py", line 108, in doujinshi_parser
    exit(1)
  File "/usr/lib/python2.7/site.py", line 366, in __call__
    raise SystemExit(code)
SystemExit: 1
[22:14:53] [INFO] Fetching information of doujinshi id 250161
[22:14:53] [CRITICAL] No JSON object could be decoded
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/threadpool.py", line 158, in run
    result = request.callable(*request.args, **request.kwds)
  File "/usr/local/lib/python2.7/dist-packages/nhentai-0.2.18-py2.7.egg/nhentai/parser.py", line 108, in doujinshi_parser
    exit(1)
  File "/usr/lib/python2.7/site.py", line 366, in __call__
    raise SystemExit(code)
SystemExit: 1
[22:14:53] [CRITICAL] No JSON object could be decoded
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/threadpool.py", line 158, in run
    result = request.callable(*request.args, **request.kwds)
  File "/usr/local/lib/python2.7/dist-packages/nhentai-0.2.18-py2.7.egg/nhentai/parser.py", line 108, in doujinshi_parser
    exit(1)
  File "/usr/lib/python2.7/site.py", line 366, in __call__
    raise SystemExit(code)
SystemExit: 1

ADD slowdown option?

when download lot of manga, i frequently banned. so i hope slowdown option added.
Thanks,

issues after update 0.3.0

image
Sometime i can't even search or download 1 doujin or problem like in the picture, when there's no progress even i recheck my connection and there's no problem with my connection to the website.

"NoneType" object is not iterable when trying to use --max-page

Hello,
First of all thanks for the downloader and the support you're offering.
My goal is to download all the hentais of nhentai.net categories I'm interested in.
For example I used :

nhentai --tag bukkake --login "myusername:mypassword" --output B:\ --download

However it only works for the first page so as you explained in another issue I added :

nhentai --tag bukkake --login "myusername:mypassword" --output B:\ --download --max-page 164

Now it doesn't download anything and gives me the error :

[14:40:43] [INFO] Using mirror: https://nhentai.net
[14:40:43] [INFO] Logging in to nhentai using credential pair '*****:************'
[14:40:43] [WARNING] No favorites found
[14:40:43] [DEBUG] Fetching page 1 for doujinshi with tag 'bukkake'
[14:40:44] [DEBUG] Fetching page 2 for doujinshi with tag 'bukkake'
[14:40:44] [DEBUG] Fetching page 3 for doujinshi with tag 'bukkake'
[14:40:44] [DEBUG] Fetching page 4 for doujinshi with tag 'bukkake'
[14:40:44] [DEBUG] Fetching page 5 for doujinshi with tag 'bukkake'
[14:40:44] [DEBUG] Fetching page 6 for doujinshi with tag 'bukkake'
[14:40:45] [ERROR] Cannot find doujinshi id of tag 'bukkake'
Traceback (most recent call last):
  File "C:\Users\*****\AppData\Local\Programs\Python\Python37-32\Scripts\nhentai-script.py", line 11, in <module>
    load_entry_point('nhentai==0.3.1', 'console_scripts', 'nhentai')()
  File "C:\Users\******\AppData\Local\Programs\Python\Python37-32\lib\site-packages\nhentai-0.3.1-py3.7.egg\nhentai\command.py", line 41, in main
    doujinshi_ids = map(lambda d: d['id'], doujinshis)
TypeError: 'NoneType' object is not iterable

Apparently I am not banned on the website and I even tried with a VPN, gives me the same error which makes me say it is not ban related. Do you know how to fix this ? Thanks !

Suggest: set default proxy

image
What I'm expecting:
nhentai --login "user:pass" --download --proxy
to use default http://127.0.0.1:1080 proxy.

I'm add these codes, uninstall nhentai (by pip uninstall nhentai)and reinstall nhentai from edited source codes, but it won't work...
nhentai: error: --proxy option requires 1 argument

I don't know somewhere else check the --proxy arguments so I hope you can solve this.

Windows 下 msys2 和 Anaconda 使用 0.2.15 会跳过下载

OS: Windows 10 Pro x86_64
Shell: bash 4.4.19/conda bash
Terminal: mintty/cmd
Python Version:3.6.6
nhentai ver 0.2.15

输出:

> nhentai - --id=******
>[20:13:31] [INFO] nHentai ver 0.2.15: あなたも変態。 いいね?
       _   _            _        _
 _ __ | | | | ___ _ __ | |_ __ _(_)
| '_ \| |_| |/ _ \ '_ \| __/ _` | |
| | | |  _  |  __/ | | | || (_| | |
|_| |_|_| |_|\___|_| |_|\__\__,_|_|

[20:13:31] [INFO] Using mirror: https://nhentai.net
[20:13:31] [INFO] 🍻 All done.

换到0.2.14就可以下载了(但是创建的文件夹名称只有英文)

Unable to launch installation

I'm completely new to using the command line and was having a really hard time running this due to my inexperience. I keep getting the error "FileNotFoundError: [Errno 2] No such file or directory: 'requirements.txt'. I'm running on a Windows 10 computer and am generally unclear how to work the installation.

Here is my process so far:

.. code-block::
(Is this a command for linux only or am I just confusing myself?)

git clone https://github.com/RicterZ/nhentai
(Downloaded this and have tried here as well https://pypi.org/project/nhentai/#description)

cd nhentai
(I tried writing hentai, cd nhentai etc in the command prompt with no luck)

python setup.py install
(Either get a brief popup that closes immediately or "FileNotFoundError: [Errno 2] No such file or directory: 'requirements.txt')

I appreciate anyone who decided to read this far. I know I'm coming across rather dimwitted, but if anyone could help me understand I would really appreciate it!

request等与网络有关的封包是否应该放到downloader.py里?

from nhentai.parser import request一行
parser与downloader存在互相引包的关系,这样不利于单元测试
另外request也主要属于爬虫下载的内容,更多地被downloader依赖
从代码结构来看,是否把这些东西交给downloader更好呢?
(萌新来跟大佬讨论

Can't install

ERROR!
Traceback (most recent call last): File "setup.py", line 24, in <module> long_description=long_description(), File "setup.py", line 13, in long_description return str(f.read()) File "C:\Users\TheGamer\AppData\Local\Programs\Python\Python36-32\lib\encodings\cp1258.py", line 23, in decode return codecs.charmap_decode(input,self.errors,decoding_table)[0] UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 225: character maps to <undefined>

Folder name changed after nhentai update

The doujinshi folder name has been changed after nhentai's update.
It's good to have a more readable doujinshi name BUT new nhentai will ignore old doujinshis.

For example, I use 0.3.4 (not the github/master) release, and use login (old one) and download my favorites. But now I merge the latest one, the folder name has been changed, and it starts downloading the doujinshi which is already exist with another folder name.

Can you give me the name's change style so I can rename my doujinshi folder to the newest version that master one can figure out?

Downloading favourites

Is there a way to download favourites now that the --login doesn't work anymore

--delay 1 --favorites --download
gives [ERROR] Can't get your number of favorited doujins. Did the login failed?
even with the cookie set

UnicodeEncodeError

Version: 0.2.17

Command:
nhentai --search "goyac english" --download --cbz

Output before error:

[19:05:44] [INFO] Starting to download doujinshi: (COMIC1☆7) [Purimomo (Goyac)] Himegoto Flowers 5 | Secret Flowers 5 (YuruYuri) [English] [Yuri-ism]        
                                                 
[19:05:44] [WARNING] Path '92066-(COMIC17)_Purimomo_(Goyac)_Himegoto_Flowers_5__Secret_Flowers_5_(YuruYuri)_English_Yuri-ism' does not exist, creating.                                                       

[19:05:44] [INFO] Starting to download https://i.nhentai.net/galleries/594742/1.jpg ...

[19:05:44] [INFO] Starting to download https://i.nhentai.net/galleries/594742/2.jpg ...

[19:05:44] [INFO] Starting to download https://i.nhentai.net/galleries/594742/3.jpg ...

[19:05:44] [INFO] Starting to download https://i.nhentai.net/galleries/594742/4.jpg ...

[19:05:44] [INFO] Starting to download https://i.nhentai.net/galleries/594742/5.jpg ...

[19:05:46] [INFO] https://i.nhentai.net/galleries/594742/1.jpg downloaded successfully

[19:05:46] [INFO] Starting to download https://i.nhentai.net/galleries/594742/6.jpg ...

[19:05:46] [INFO] https://i.nhentai.net/galleries/594742/3.jpg downloaded successfully

[19:05:46] [INFO] Starting to download https://i.nhentai.net/galleries/594742/7.jpg ...

[19:05:46] [INFO] https://i.nhentai.net/galleries/594742/5.jpg downloaded successfully

[19:05:46] [INFO] Starting to download https://i.nhentai.net/galleries/594742/8.jpg ...

[19:05:46] [INFO] https://i.nhentai.net/galleries/594742/4.jpg downloaded successfully

[19:05:46] [INFO] Starting to download https://i.nhentai.net/galleries/594742/9.jpg ...

[19:05:47] [INFO] https://i.nhentai.net/galleries/594742/2.jpg downloaded successfully

[19:05:47] [INFO] Starting to download https://i.nhentai.net/galleries/594742/10.jpg ...

[19:05:48] [INFO] https://i.nhentai.net/galleries/594742/6.jpg downloaded successfully

[19:05:48] [INFO] Starting to download https://i.nhentai.net/galleries/594742/11.jpg ...

[19:05:48] [INFO] https://i.nhentai.net/galleries/594742/8.jpg downloaded successfully

[19:05:48] [INFO] Starting to download https://i.nhentai.net/galleries/594742/12.jpg ...

[19:05:48] [INFO] https://i.nhentai.net/galleries/594742/9.jpg downloaded successfully

[19:05:48] [INFO] Starting to download https://i.nhentai.net/galleries/594742/13.jpg ...

[19:05:48] [INFO] https://i.nhentai.net/galleries/594742/7.jpg downloaded successfully

[19:05:48] [INFO] Starting to download https://i.nhentai.net/galleries/594742/14.jpg ...

[19:05:48] [INFO] https://i.nhentai.net/galleries/594742/10.jpg downloaded successfully

[19:05:48] [INFO] Starting to download https://i.nhentai.net/galleries/594742/15.jpg ...

[19:05:50] [INFO] https://i.nhentai.net/galleries/594742/12.jpg downloaded successfully

[19:05:50] [INFO] Starting to download https://i.nhentai.net/galleries/594742/16.jpg ...

[19:05:50] [INFO] https://i.nhentai.net/galleries/594742/14.jpg downloaded successfully

[19:05:50] [INFO] Starting to download https://i.nhentai.net/galleries/594742/17.jpg ...

[19:05:50] [INFO] https://i.nhentai.net/galleries/594742/11.jpg downloaded successfully

[19:05:50] [INFO] Starting to download https://i.nhentai.net/galleries/594742/18.jpg ...

[19:05:50] [INFO] https://i.nhentai.net/galleries/594742/15.jpg downloaded successfully

[19:05:50] [INFO] Starting to download https://i.nhentai.net/galleries/594742/19.jpg ...

[19:05:50] [INFO] https://i.nhentai.net/galleries/594742/13.jpg downloaded successfully

[19:05:50] [INFO] Starting to download https://i.nhentai.net/galleries/594742/20.jpg ...

[19:05:51] [INFO] https://i.nhentai.net/galleries/594742/16.jpg downloaded successfully

[19:05:51] [INFO] Starting to download https://i.nhentai.net/galleries/594742/21.jpg ...

[19:05:52] [INFO] https://i.nhentai.net/galleries/594742/17.jpg downloaded successfully

[19:05:52] [INFO] Starting to download https://i.nhentai.net/galleries/594742/22.jpg ...

[19:05:52] [INFO] https://i.nhentai.net/galleries/594742/19.jpg downloaded successfully

[19:05:52] [INFO] Starting to download https://i.nhentai.net/galleries/594742/23.jpg ...

[19:05:52] [INFO] https://i.nhentai.net/galleries/594742/18.jpg downloaded successfully

[19:05:52] [INFO] Starting to download https://i.nhentai.net/galleries/594742/24.jpg ...

[19:05:52] [INFO] https://i.nhentai.net/galleries/594742/20.jpg downloaded successfully

[19:05:52] [INFO] Starting to download https://i.nhentai.net/galleries/594742/25.jpg ...

[19:05:53] [INFO] https://i.nhentai.net/galleries/594742/25.jpg downloaded successfully

[19:05:53] [INFO] Starting to download https://i.nhentai.net/galleries/594742/26.jpg ...

[19:05:53] [INFO] https://i.nhentai.net/galleries/594742/24.jpg downloaded successfully

[19:05:53] [INFO] Starting to download https://i.nhentai.net/galleries/594742/27.jpg ...

[19:05:53] [INFO] https://i.nhentai.net/galleries/594742/22.jpg downloaded successfully

[19:05:53] [INFO] https://i.nhentai.net/galleries/594742/21.jpg downloaded successfully

[19:05:53] [INFO] https://i.nhentai.net/galleries/594742/26.jpg downloaded successfully

[19:05:54] [INFO] https://i.nhentai.net/galleries/594742/23.jpg downloaded successfully

[19:05:55] [INFO] https://i.nhentai.net/galleries/594742/27.jpg downloaded successfully

Traceback (most recent call last):
  File "/usr/local/bin/nhentai", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/dist-packages/nhentai/command.py", line 62, in main
    generate_cbz(options.output_dir, doujinshi)
  File "/usr/local/lib/python2.7/dist-packages/nhentai/utils.py", line 89, in generate_cbz
    str(doujinshi_obj.name[:200]))))    
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2606' in position 7: ordinal not in range(128)
```
`

Filename too long

nhentai --id=254818
gives
[CRITICAL] [Errno 36] File name too long: '[254818][hirame, abi kamesennin][(C84) [Service Heaven, Turtle.Fish.Paint (Karei, Abi Kamesennin)] Dounen Hakai ~Ookami to Nanahiki no Kohitsuji~ | Childhood Destruction #5 ~The Wolf and the Seven Young Goats~ (The Wolf and the Seven Young Kids) [English] [Belldandy100] [Decensored]]'

[CRITICAL] No JSON object could be decoded

Command:
NHENTAI=http://h.loli.club nhentai --id 158995

Output before error:
[16:01:46] [INFO] nHentai ver 0.2.16: あなたも変態。 いいね?
[16:01:46] [INFO] Using mirror: http://h.loli.club
[16:01:46] [INFO] Fetching information of doujinshi id 158995
[16:01:53] [CRITICAL] No JSON object could be decoded

Win7下Python2.7报错

�[32m[23:07:19] [INFO] nHentai: 銇傘仾銇熴倐澶夋厠銆?銇勩亜銇?
_ _ _ _
_ __ | | | | ___ _ __ | |_ __ ()
| '_ | || |/ _ \ ' | / ` | |
| | | | _ | __/ | | | || (
| | |
|| ||| ||_
|| ||__,||
�[0m
�[36m[23:07:19] [INFO] Fetching doujinshi information of id 134328�[0m
C:\Python27\lib\site-packages\beautifulsoup4-4.5.1-py2.7.egg\bs4__init__.py:181
: UserWarning: No parser was explicitly specified, so I'm using the best availab
le HTML parser for this system ("html.parser"). This usually isn't a problem, bu
t if you run this code on another system, or in a different virtual environment,
it may use a different parser and behave differently.

The code that caused this warning is on line 9 of the file C:\Python27\Scripts\n
hentai-script.py. To get rid of this warning, change code that looks like this:

BeautifulSoup([your markup])

to this:

BeautifulSoup([your markup], "html.parser")

Traceback (most recent call last):
File "C:\Python27\Scripts\nhentai-script.py", line 9, in
load_entry_point('nhentai==0.1.5', 'console_scripts', 'nhentai')()
File "C:\Python27\lib\site-packages\nhentai-0.1.5-py2.7.egg\nhentai\command.py
", line 28, in main
doujinshi_info = doujinshi_parser(id)
File "C:\Python27\lib\site-packages\nhentai-0.1.5-py2.7.egg\nhentai\parser.py"
, line 37, in doujinshi_parser
title = doujinshi_info.find('h1').text
AttributeError: 'NoneType' object has no attribute 'find'

How does this work?

Can someone dumb this down for me? I drag setup.py into the git and....? Nothing happens

AttributeError on retrieving doujin favorites list

When trying to download in bulk from my favorites list, I will get a series of the exact same error in a row:

Traceback (most recent call last):
  File "c:\program files\python37\lib\site-packages\threadpool.py", line 158, in run
    result = request.callable(*request.args, **request.kwds)
  File "c:\program files\python37\lib\site-packages\nhentai-0.3.0-py3.7.egg\nhentai\parser.py", line 132, in doujinshi_parser
    title = doujinshi_info.find('h1').text
AttributeError: 'NoneType' object has no attribute 'find'

When trying to download the same doujins individually or through a text list, it does not reproduce the error. My assumption is that --download is trying to grab the doujins too fast and is not retrieving the proper data somehow. Doing it by a file list parses the doujins much slower and correctly.

Commands tested to try and reproduce:

nhentai --threads=1 --login=username:password --download #bug here
nhentai --threads=1 --login=username:password --file=doujinshi.txt #no bug

doujinshi.txt and my favorites list have the exact same contents to test, the 30 most recently submitted doujins.

A thing to consider is simply the possibility of detecting a failure in retrieval and retrying. Another is adding a --wait flag to simply wait between parsing doujins.

Mirror

Hello,
Thank's for fixing the API issues. Anyway i want to ask how can i create my own mirror for my country what i need to do that.
Thank's in advance.

can't download anymore

hello, so today i was downloading some folders from nhentai, everything was ok, i got around 40-50 folders, but now when i try to download i get this error:

[02:29:04] [INFO] Using mirror: https://nhentai.net
[02:29:04] [INFO] Fetching doujinshi information of id 91679
Traceback (most recent call last):
File "C:\Users\kagek\AppData\Local\Programs\Python\Python37\Scripts\nhentai-script.py", line 11, in
load_entry_point('nhentai==0.3.0', 'console_scripts', 'nhentai')()
File "C:\Users\kagek\AppData\Local\Programs\Python\Python37\lib\site-packages\nhentai-0.3.0-py3.7.egg\nhentai\command.py", line 47, in main
doujinshi_info = doujinshi_parser(id_)
File "C:\Users\kagek\AppData\Local\Programs\Python\Python37\lib\site-packages\nhentai-0.3.0-py3.7.egg\nhentai\parser.py", line 110, in doujinshi_parser
title = doujinshi_info.find('h1').text
AttributeError: 'NoneType' object has no attribute 'find'

is this because i downloaded to much or for to long(my internet is bad i can only get 250k/s), or it is something else?

nhentai website is blocking rapid api calls

image
This activates on your ip address. I think it can be circumvented by clicking on the approve button, but I do not know if they have any further protection against scraping.

ascii encoding issues

When downloading, I get the following error:
Traceback (most recent call last): File "/usr/local/bin/nhentai", line 11, in <module> load_entry_point('nhentai==0.2.8', 'console_scripts', 'nhentai')() File "/usr/local/lib/python2.7/dist-packages/nhentai-0.2.8-py2.7.egg/nhentai/command.py", line 67, in main data = html.format(TITLE=doujinshi.name, IMAGES=image_html) UnicodeEncodeError: 'ascii' codec can't encode characters in position 100-102: ordinal not in range(128)
I did a quick google search and found that StackOverflow says:

Basically, stop using str to convert from unicode to encoded text / bytes. Instead, properly use .encode() to encode the string or work entirely in unicode

And I believe the code should be updated to work in unicode or use the .encode() method.

Folder name with certain characters crash

On Widows (not sure of other OS) Folder name can not contain
\ / : * ? " <> |

downloading one with one or more of these causes a critical error.

Suggest remove these characters or changing them into a space on folder creation.

Steps to reproduce:

This contains a |

nhentai --id=253593

This contains a /

nhentai --id=274301

Change output name and add info download

I would want to use a different filename format
Something like
[Author] [Group] [PARODY (IF IT IS A PARODY)] [HENTAI_NAME] [LANGUAGE] [DATE WHEN IT WAS PUBLISHED] [ID]
corrent format is
192678-Sanagi_Torajirou_Erect_Erect_Ch._4_(COMIC_Megastore_Alpha_2017-03)_Chinese__Digital
it looks just awful
and please add the option to download informat regarding the hentai, a .txt file with all the info (such as tags) would be awesome)

Getting code 404

When downloading certain ones it only downloads a few pages then it gives "return status code 404" It only seems to be specific ones and most others download just fine.

我又来提BUG了☺️

Traceback (most recent call last):
File "/usr/local/bin/nhentai", line 11, in
load_entry_point('nhentai==0.2.11', 'console_scripts', 'nhentai')()
File "/usr/local/lib/python2.7/site-packages/nhentai-0.2.11-py2.7.egg/nhentai/command.py", line 49, in main
doujinshi.download()
File "/usr/local/lib/python2.7/site-packages/nhentai-0.2.11-py2.7.egg/nhentai/doujinshi.py", line 56, in download
logger.info('Start download doujinshi: %s' % self.name)
File "/usr/local/Cellar/python@2/2.7.15/Frameworks/Python.framework/Versions/2.7/lib/python2.7/encodings/utf_8.py", line 16, in decode
return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xb8 in position 0: invalid start byte

可能是标题过长导致的。
--search="chinese bigbreasts" --download --thread=15 --page=1

can't find '__main__' module in 'nhentai' ?

It's my first time using python in windows

I manage to install it using cmd > py setup.py install

but now I'm stuck on download part because it's asking for main module

ex.
nhentai-master>py nhentai --id=123855,123866
..AppData\Local\Programs\Python\Python37-32\python.exe: can't find 'main' module in 'nhentai'

I tried to look on nhentai directory but only init / cmdline/ command/ etc.. is in there, I can't find the main

Does this only works on linux OS?

Edit: I also installed the .egg file on dist folder
Processing dependencies for nhentai==0.2.15
Finished processing dependencies for nhentai==0.2.15

TODO

  • 下载失败重试
  • Ctrl+C 终止下载

Favourite无法下载

提示信息如下:
Traceback (most recent call last):
File "c:\users\lenovo\appdata\local\programs\python\python36\lib\runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "c:\users\lenovo\appdata\local\programs\python\python36\lib\runpy.py", line 85, in run_code
exec(code, run_globals)
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python36\Scripts\nhentai.exe_main
.py", line 9, in
File "c:\users\lenovo\appdata\local\programs\python\python36\lib\site-packages\nhentai\command.py", line 27, in main
for doujinshi_info in login_parser(username=username, password=password):
File "c:\users\lenovo\appdata\local\programs\python\python36\lib\site-packages\nhentai\parser.py", line 31, in login_parser
csrf_token_elem = html.find('input', attrs={'name': 'csrfmiddlewaretoken'})
TypeError: find() takes no keyword arguments

新增cbr检测

如果生成cbr的话貌似会删除所有图片文件,这样的话如果在不同关键词或者不同时刻同一个关键词会重复下载已经下载过的图片并重新生成cbr文件。 能否新增cbr检测,如果cbr文件已经存在的话就略过该本子。

Timeout doesn't seem to work properly

nhentai --id=177025 --timeout=1000000 --thread=1

I have tried a lot of timeout values, no matter what the download is extremely fast. I would like to leave it running for a long time and download something like one image every 10 seconds. I can't find a way to do this with the provided options.

防重复下载

能否增加一个检测机制,如果图片已经存在则不再下载

API

Some create his own API if want to try it, Here the Link.

emm....我又来了...貌似是没法解码

Traceback (most recent call last):
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python36\Scripts\nhentai-script.py", line 11, in
load_entry_point('nhentai==0.2.14', 'console_scripts', 'nhentai')()
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python36\lib\site-packages\nhentai-0.2.14-py3.6.egg\nhentai\command.py", line 51, in main
generate_html(options.output_dir, doujinshi)
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python36\lib\site-packages\nhentai-0.2.14-py3.6.egg\nhentai\utils.py", line 69, in generate_html
f.write(data)
UnicodeEncodeError: 'gbk' codec can't encode character '\xb2' in position 132: illegal multibyte sequence

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.