Skip to main content

"Implements a wrapper class around nhentai's RESTful API."

Project description

“De gustibus non est disputandum.”

Python Hentai API Wrapper

This python package implements a wrapper class around nhentai's RESTful API. Please be aware that this is not an official API, technical questions about nhentai.net should be redirected to support@nhentai.com. Further note that the content of this module is generally considered NSFW. Finally, I would like to comment at this point that you should under no circumstances use this module to make an unreasonable amount of requests in a short period of time.

Installation

Get the most recent stable release from PyPI:

pip install hentai
Dev Notes for Contributors

Alternatively, if you're looking to make a contribution fork this repository and run

python -m venv venv/
venv/Scripts/Activate.ps1
python -m pip install --upgrade pip
pip install -r requirements/dev.txt

Make sure to checkout rec-hentai so that your work is up-to-date with the next release candidate.

Documentation

You can find the documentation online, or use the wiki to learn more about this module.

Basic Usage

Hentai makes it very easy to browse through nhentai.net. It implements a flat namespace for easy access of all their endpoints:

from hentai import Hentai, Format

doujin = Hentai(177013)

# True
Hentai.exists(doujin.id)

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

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

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

# 2016-10-18 14:28:49
print(doujin.upload_date)

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

# get the source
doujin.download(progressbar=True)

Apart from that, hentai.Utils also provides a handful of miscellaneous helper methods:

from hentai import Utils, Sort, Option
from pathlib import Path

print(Utils.get_random_id())

# recommend me something good!
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))

# 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.UploadDate]
Utils.export(popular_loli, filename=Path('popular_loli.json'), options=custom)

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

Get In Touch

You can reach me at dev.hentai-chan@outlook.com for private questions and inquires that don't belong to the issue tab.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hentai-3.1.0.tar.gz (24.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hentai-3.1.0-py3-none-any.whl (23.1 kB view details)

Uploaded Python 3

File details

Details for the file hentai-3.1.0.tar.gz.

File metadata

  • Download URL: hentai-3.1.0.tar.gz
  • Upload date:
  • Size: 24.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.7.9

File hashes

Hashes for hentai-3.1.0.tar.gz
Algorithm Hash digest
SHA256 7a29c23f0bba5cd94d1fea5a6ab5c867376f5b12a1b393808c5af35b1e59ea89
MD5 ba5e7a1d5e43f82615331fe123fa89b1
BLAKE2b-256 b14a51a74f1638d7bdad002dcc14b2a6a46be029ea0551a10aa732d4a8370292

See more details on using hashes here.

File details

Details for the file hentai-3.1.0-py3-none-any.whl.

File metadata

  • Download URL: hentai-3.1.0-py3-none-any.whl
  • Upload date:
  • Size: 23.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.7.9

File hashes

Hashes for hentai-3.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 33e0714d0a7591e55a7f8a0af76ceb21f0538d34b0d16fa3a6d37e4057e1371c
MD5 c2141d2663d11b53bdb3bc7607ac9d4d
BLAKE2b-256 645c9679cf6fa42820649e76c6c4cf659e8690f8c0efeef325e4aee751e5df07

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page