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

shentai

v2.0.7

Published

Simple and User-Friendly Library for nHentai!

Downloads

116

Readme

Simple and User-Friendly API for nHentai.

Recommended for REST API, Bots, Sites

Table of content:

Installation

$ npm install shentai

Usage

// in async function
const nHentai = require('shentai')
const sHentai = new nHentai

// Get a Random Doujin
await sHentai.getRandom().then(doujin => console.log(doujin))

// Get a indicated Doujin
await sHentai.getDoujin(1).then(doujin => console.log(doujin))

// Searching
await sHentai.search('dev').then(search => console.log(search.results))

// Next Page
const search = await sHentai.search('dev')
const nextPage = await search.next()
console.log(nextPage.results)

Methods

getPopular()

Returns the not full object of a doujins.

Usage example:

// in async function
const doujins = await sHentai.getPopular()
console.log(doujins)
Returns: Promise<search model class>

getNew()

Returns the not full object of a doujins.

Usage example:

// in async function
const doujins = await sHentai.getNew()
console.log(doujins)
Returns: Promise<search model class>

getDoujin()

| Param | Type | Description | | --- | --- | --- | | [id] | string/number | ID of Doujin |

Usage example:

// in async function
const doujin = await sHentai.getDoujin(0)
console.log(doujin)
Returns: Promise<Doujin model object>

getRandom()

Usage example:

// in async function
const doujin = await sHentai.getRandom()
console.log(doujin)
Returns: Promise<Doujin model object>

byAuthor()

Returns the not full object of a doujins.

| Param | Type | Description | | --- | --- | --- | | text | string | Text for entering search input on a site |

Usage example:

// in async function
const doujins = await sHentai.getPopular()
console.log(doujins)
Returns: Promise<search model class>

search()

Returns the not full object of a doujins.

| Param | Type | Description | | --- | --- | --- | | text | string | Text for entering search input on a site |

Usage example:

// in async function
const search = await sHentai.search('dev')
const doujin = await sHentai.getDoujin(search.results[0].id)
console.log(doujin)
Returns: Promise<search model class>

Data models

Doujin

Doujin data models is a object.
{
  id: String, // ID of Doujin
  author: String, // Author name of Doujin
  titles: {
    english: String, // English adaptation of the title
    original: String, //Original name of the title
  },
  pages: Array<String>, // Links of Images of Doujin
  tags: Array<String>, // Tags of Doujin
  cover: String // Link of Cover of Doujin
}

SearchResult Class

{
    results: Object[], // Search results on a site
    allDoujinsCount: Number, // Amount of all Doujins, which you can find
    lastPage: Number, // Number of All Pages from Search
    currentPage: Number, // Number of Current Page of Search
    next: Promise<SearchResult>, // Returns this class with new results of search next page
    prev: Promise<SearchResult>, // Returns this class with new results of search previous page
    first: Promise<SearchResult>, // Returns this class with new results of search first page
    last: Promise<SearchResult>, // Returns this class with new results of search last page
    getPage: Promise<SearchResult>, // Returns this class with new results of search indicated page
}

Search Result

Search data models is a array of objects.
[
  {
    id: String, // ID of Doujin
    titles: Object, // english property every time(for user-friendly with fullObject's condition), title of the doujin
    cover: String //url of the cover image
  },
]

Catching Errors without .catch()

In a Node.JS 15.x, reject use a strict mode. So, when Promise returns a reject, your app crashes. So, my library is user-friendly, and i don't want crash your app, if some wrong. So, how you can catch a errors?

For Example:

// in async function
let doujin = await sHentai.getDoujin(0)
if (doujin.status) return console.error(doujin.message);

And, your app don't be crashes :)

Support

Discord Server


License

UNLICENSED

Copyright © Mikun Hatsune