Documentation

This site documents version 3.2.5 and was last updated on February 26th, 2021. For more information regarding previous versions of this project, please refer to the changelog which contains additional information about recent updates and changes made to this library. If this is your first time using this library, check out the quickstart guide, or browse through the Hentai section to discover more features. Alternatively, go to the API Endpoints section if you want to learn more about the API endpoints in general.

warning Warning
If you are under the age of 18 or the applicable age of majority, please do not use any of the websites or services discussed on this page.

Table of Content

Quickstart Guide

This is a small self-contained example on how to use the Hentai class:

        
            from hentai import Hentai, Format

            # make a request to nhentai.net
            doujin = Hentai(177013)

            # True
            Hentai.exists(doujin.id)

            # METAMORPHOSIS
            print(doujin.title(Format.Pretty))

            # [Tag(id=3981, type='artist', name='shindol', url='https://nhentai.net/artist/shindol/', count=279)]
            print(doujin.artist)

            # ['dark skin', 'group', ... ]
            print([tag.name for tag in doujin.tag])

            # 2016-10-18 12:28:49+00:00
            print(doujin.upload_date)

            # ['https://i.nhentai.net/galleries/987560/1.jpg', ... ]
            print(doujin.image_urls)

            # store all image urls to disk
            doujin.download(progressbar=True)
        
    

The Utils class also provides a handful of useful methods:

        
            from hentai import Utils, Sort, Option, Tag
            from pathlib import Path
            
            # methods for retrieving random ids and hentai objects
            print(Utils.get_random_id())
            print(Utils.get_random_hentai())
            
            # advanced search with queries
            for doujin in Utils.search_by_query('tag:loli', sort=Sort.PopularWeek):
                print(doujin.title(Format.Pretty))

            # print all character names from all doujins
            for character in Tag.list(Option.Character):
                print(character.name)                
            
            # store custom meta data as JSON file to disk
            popular_loli = Utils.search_by_query('tag:loli', sort=Sort.PopularWeek)
            custom = [Option.ID, Option.Title, Option.Epos]
            Utils.export(popular_loli, filename=Path('popular_loli.json'), options=custom)
        
    

See also https://nhentai.net/info/ for more information on search queries.

Command Line Interface

Starting with version 3.2.4, this module also provides a rudimentary CLI for downloading doujins within the terminal:

        
            hentai -h # get help
        
    
        
            hentai -id 177013 # download this doujin to the CWD
        
    
        
            hentai -version # check the module version