Skip to content

cyl1nd3r/NHDownloader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NH Downloader (nFetch)

This CLI program allows you to download gallery images in nhentai.net from a specified URL or a list of URLs. You can either provide a list of URLs from a file or directly from a nhentai https://nhentai.net/g/<gid> URL. The script will download the gallery images and save them in a specified directory.

Disclaimer

Please be aware that downloading or distributing content from unofficial or unauthorized sources, such as nhentai sites, may be illegal in your country. We do not encourage or endorse the use of this script for illegal activities. This script is for educational purposes only. Always ensure that you have the proper rights and permissions before downloading any content.

Requirements

  • Python 3.6+
  • Required Libraries:
    • beautifulsoup4 (bs4): To parse HTML and extract specific data or links.
    • cloudscraper: To bypass Cloudflare anti-bot pages and make HTTP requests.
    • colorama: To provide colored terminal output for better readability.
    • tqdm: To display smart progress bars for loops and tasks.
    • urllib3: For URL parsing and handling.

You can install the required third-party libraries using pip:

pip install beautifulsoup4 cloudscraper colorama tqdm

Usage

Command-line Arguments

  1. --file <path>: Path to a file containing a list of URLs (each line contains one URL or gallery ID) for downloading manga.
  2. --url <url>: A single gallery URL such as https://nhentai.net/g/<gid>, or simply provide the magic number <gid> to download the gallery images.
  3. --savedir <path>: Directory for saving downloaded images. Images will be stored in a subdirectory named after the gallery ID. Default is downloads.

Advanced Options

  1. --worker <number>: Number of workers for parallel downloading. It is suggested to set this value up to the number of your CPU cores. Default is 1.
  2. --retry <number>: Number of retry attempts for failed requests. Default is 20.
  3. --json: Save a JSON file containing gallery information. This is useful if you want to build your own "library." By default, JSON files are not saved.

Example Commands

  1. Download manga from a file containing URLs:
python main.py --file urls.txt --worker 2
  1. Download manga from a single URL:
python main.py --url https://nhentai.net/g/777777 --worker 2

Example Output

Once the process is complete, the script provides a summary of task performance and a list of any failed items for easier restarting.

  • Total: Total number of tasks or images processed.
  • Success: Number of successfully completed tasks.
  • Failed: Number of tasks that encountered errors.
  • Error list (if not empty): Below the statistics, the script displays the specific galleries (e.g., [777777]) that failed to download, allowing you to retry them manually if needed.
Total:    1
Success:  0
Failed:   1
[777777]

If an error occurs while downloading images for a gallery, to ensure gallery integrity, the current download task and all subsequent tasks will be stopped.

[Error] Page 1 download failed after 4 retry attempts.
[Info] Interrupt detected. Terminating workers...
[Info] All workers have been terminated. Exiting...

You can manually rerun the command. The script will ignore any gallery whose downloaded image count matches the original gallery on nhentai.net.

License

This script is free to use and modify under the MIT License.

About

Simple nhentai downloader ツ

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages