npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

nhentai-node-api

v1.1.2

Published

nHentai wrapper for NodeJs

Downloads

122

Readme

An unofficial API for nHentai.

Table of content:

Installation

$ npm install nhentai-node-api

Usage

const nhentai = require('nhentai-node-api')

Methods

search()

| Parameter | Type | Default | Description | | --- | --- | --- | --- | | query | string | | Terms of the search | | sort | string | popular | Sort order of the search. Can be either: popular, popular-week, popular-today or date | | page | number | 1 | Selects the page of the results |

Usage example:

nhentai.search('metamorphosis', 'popular-week', 1)
  .then(results => {
    //do things with the results
  })
  .catch(err => console.log(err))
Returns: Search model object

getDoujin()

Returns the full object of a precise doujin.

| Parameter | Type | Default | Description | | --- | --- | --- | --- | | identifier | string/number | | Can be either a doujin id or the entire url | | simplified | boolean | false | Define if the returned object should be simplified a bit (count and link for elements in the details field are removed) |

Usage example:

nhentai.getDoujin(177013)
  .then(data => {
    //do things with the data
  })
  .catch(err => console.log(err))
Returns: Doujin model object

getPopular()

Returns the 5 doujins in the Popular Now field on the homepage of nhentai.

Usage example:

nhentai.getPopular()
  .then(results => {
    //do things with the results
  })
  .catch(err => console.log(err))
Returns: Search model object

getLatest()

Returns the latest added doujins on the website.

| Parameter | Type | Default | Description | | --- | --- | --- | --- | | page | number | 1 | Selects the page |

Usage example:

nhentai.getLatest() //will return the results of the first page as the 'page' parameter isn't specified
  .then(results => {
    //do things with the results
  })
  .catch(err => console.log(err))
Returns: Search model object

exists()

Simply checks if a doujin url or id exists.

| Parameter | Type | Default | Description | | --- | --- | --- | --- | | identifier | string/number | | Can be either a doujin id or the entire url |

Usage example:

nhentai.exists(177013)
  .then(result => {
    if (result) console.log('This doujin exists!')
    else console.log('This doujin doesn\'t exists!')
  })
  .catch(err => console.log(err))
Returns: a boolean

Data models

Search

Search data models are arrays of objects.
[
  {
    id: Number,
    title: String, //original title of the doujin
    language: String, //language of the doujin, can be either: english, japanese or chinese
    thumbnail: String, //url of the cover image
  },
  //etc
]

Doujin

Doujin data models are objects.
{
  id: Number,
  title: {
    default: String, //complete original title
    pretty: String, //pretty version of the title
    native: String //title in its native language (japanese most of the time)
  },
  language: String, //language of the doujin, can be either: english, japanese or chinese
  cover: String, //image url of the cover
  details: { /*this section is a bit special. Each property correspond to a field underneath the title of the doujin on the website page. If the 'simplified' parameter of getDoujin() is set to true, it will just put strings in the array. But if it's set to false (by default tho), it'll populate the arrays with objects like this:
    {
      name: String, //the value itself
      count: Number, //the number of other doujins that also have this property
      link: String, //the link to the specific page of this property on the website
    }
    */
    parodies: [],
    characters: [],
    tags: [],
    artists: [],
    groups: [],
    categories: [],
  },
  pages: [String], //images urls of the pages
  thumbnails: [String], //images urls of the thumbnails
  favorites: Number, //number of favorites on this doujin
  uploaded: Date, //upload date
  link: String //link to the doujin
}

License

MIT License

Copyright (c) barthofu