/Library-of-H

Script created using Python to download individual galleries or all artist/group galleries from nhentai. Along with a (WIP) image explorer that uses the database file created by the downloader to view galleries. Basically create a (tiny) offline nhentai.net.

Primary LanguagePython

Library of H

A group of python scripts to download, store metadata of, and filter/view nhentai galleries on your PC. It can download either individual galleries or whole of artist/group galleries from nhentai.

Requirements

  • Windows: Works on Windows 10, not tested with other versions.
  • Linux: Works on Debian Bullseye, should work with other distros as well.
  • Python:
python          3.8.x  
colorama        0.4.4  
requests        2.25.1  
beautifulsoup4  4.10.0  
Pillow          8.3.2  
PyQt5           5.15.4  
lxml            4.6.3  

nhentaiDownloader

Script created using Python to download individual galleries or all artist/group galleries from nhentai. At the end of the download, the script creates a metadata.csv file in the gallery's directory to store the gallery's metadata.

menu

  • Download by Galleries: Will prompt to input gallery ids separated by spaces.
  • Download by Artists: Will prompt to input artist names separated by commas.
  • Download by Groups: Will prompt to input group names separated by commas.

nhentaiConfig.ini

The Config.ini file can be found in Library-of-H/nhentaiDownloader/Config.ini

  • [Network]
    • useragent: input user agent. (Already has one by default.)
    • retry: How many times should the script retry when met with a temporary http error.
    • retrywait: How long the script should wait after each retry.
  • [Filters]
    • anthology: True if you want COMICs to be filtered out, False if you want to download them too.
    • comic: True if you want anthologies to be filtered out, False if you want to download them too.
  • [GeneralSettings]
    • gallerydownloadlocation: location for script to download individual galleries into.
    • artistdownloadlocation: location for script to download artist galleries into.
    • groupdownloadlocation: location for script to download group galleries into.
    • databaselocation: location for script to create nhentaiDatabase.db in.
  • [Filenames]
    • gallerydownloadnameformat: format for individual gallery download location.
    • artistdownloadnameformat: format for artist gallery download location.
    • groupdownloadnameformat: format for group gallery download location.
  • [DownloadSettings]
    • overwrite: True if you want to overwrite if/when the script encounters already downloaded files, else False.

[Filenames] formats

Using %(gallery_id)s in every gallery directory name is recommended as gallery ids (gallery id) will always be unique, unlike the other parameters (namely the title).

For gallerydownloadnameformat

  - %(gallery_before)s:
      nhentai term for the grey text that comes before the gallery title.
  - %(gallery_title)s:
      The main gallery title.
  - %(original_title)s:
      Untranslated gallery title.
  - %(translated_title)s:
      Translated gallery title.
  - %(gallery_after)s:
      nhentai term for the grey text that comes after the gallery title.
  - %(gallery_id)s:
      nhentai assigned id for the gallery.

For artistdownloadnameformat

 - %(artist_name)s:
    Name of the artist.
 - %(gallery_before)s:
    nhentai term for the grey text that comes before the gallery title.
 - %(gallery_title)s:
    The main gallery title.
  - %(original_title)s:
      Untranslated gallery title.
  - %(translated_title)s:
      Translated gallery title.
 - %(gallery_after)s:
    nhentai term for the grey text that comes after the gallery title.
 - %(gallery_id)s:
    nhentai assigned id for the gallery.

For groupdownloadnameformat

  - %(group_name)s:
      Name of the group.
  - %(gallery_before)s:
      nhentai term for the grey text that comes before the gallery title.
  - %(gallery_title)s:
      The main gallery title.
  - %(original_title)s:
      Untranslated gallery title.
  - %(translated_title)s:
      Translated gallery title.
  - %(gallery_after)s:
      nhentai term for the grey text that comes after the gallery title.
  - %(gallery_id)s:
      nhentai assigned id for the gallery.

usage

Run the python file.

$ python3 nhentaiDownloader.py
Choose a download method:  
1. Download by Galleries
2. Download by Artists
3. Download by Groups
Enter x to exit.
>>

nhentaiExplorer

An image explorer that uses the database file created by the downloader to view galleries. Basically create an (tiny) offline nhentai.net. (WIP)

Import

Import the nhentaiDatabase.db file created by the nhentaiDownloader script.

Search

  • artists: filter database by artist name.
  • characters: filter database by character name.
  • ids: filter database by id (gallery id).
  • groups: filter database by group name.
  • parodies: filter database by parody name.
  • tags: filter database by tag.
  • titles: filter database by title.
  • collections: filter database by collection type. (Not implemented yet.)
  • custom...: filter database by custom filter. (Not implemented yet.)

usage

Run the python file.

nhentaiLibraryToDatabase

A script to create a database file with already existing nhentai library.
Library must contain metadata.csv files for this to work. (for library with galleries without metadata.csv files, the metadata.csv files can be created by re-downloading the galleries)

usage

python3 nhentaiLibraryToDatabase.py "location/to/library"