Giter VIP home page Giter VIP logo

nana-api's Introduction

Nana API

nHentai unofficial API

Install

npm install nana-api

Example

const NanaAPI = require("nana-api");
const nana = new NanaAPI();

// Get gallery from book ID or book link
nana.g("14045").then((g) => {
  console.log(g);
});
nana.g("https://nhentai.net/g/4501").then((g) => {
  console.log(g);
});

Results

  • Book Object
{
  id: 4501,
  media_id: '14634',
  title: {
    english: '[Petite*Cerisier (Sakura*Sakura)] Suzumiya Haruhi no meirei (The Melancholy of Haruhi Suzumiya)',
    japanese: '[Petite*Cerisier (さくら*さくら)] 涼宮ハルヒの命令 (涼宮ハルヒの憂鬱)',
    pretty: 'Suzumiya Haruhi no meirei'
  },
  images: {
    pages: [
	  { t: 'j', w: 1050, h: 1500 },
	  { t: 'j', w: 1050, h: 1500 },
	  { t: 'j', w: 1050, h: 1500 },
	  { t: 'j', w: 1050, h: 1500 },
	  { t: 'j', w: 1050, h: 1500 },
	  ...
	],
    cover: { t: 'j', w: 350, h: 500 },
    thumbnail: { t: 'j', w: 250, h: 357 }
  },
  scanlator: '',
  upload_date: 1403972325,
  tags: [
    {
      id: 190,
      type: 'tag',
      name: 'maid',
      url: '/tag/maid/',
      count: 10631
    },
    {
      id: 2937,
      type: 'tag',
      name: 'big breasts',
      url: '/tag/big-breasts/',
      count: 104551
    },
    {
      id: 8010,
      type: 'tag',
      name: 'group',
      url: '/tag/group/',
      count: 72839
    },
	...
  ],
  num_pages: 10,
  num_favorites: 7
}
  • List Object
{
  num_pages: 852,
  results: [
    {
      id: '239990',
      title: "[Fue] Inma no Mikata! | Succubi's Supporter! [English] [biribiri, Hennojin] [Decensored]",
      language: 'english',
      thumbnail: [
		  s: 'https://t.nhentai.net/galleries/1258772/thumb.jpg',
		  w: '250',
		  h: '307'
	  ]
    },
    {
      id: '142825',
      title: '[Higuma-ya (Nora Higuma)] Toaru Mura no Fudeoroshi Jijou | A Certain Village Custom [English] [PSYN + Facedesk] [Digital]',
      language: 'english',
      thumbnail: [
		  s: 'https://t.nhentai.net/galleries/849121/thumb.jpg
		  w: '250',
		  h: '354'
	  ]
    },
    {
      id: '123554',
      title: '[Mizuryu Kei] Teisou Kannen ZERO [English] {doujin-moe.us}',
      language: 'english',
      thumbnail: [
		  s: 'https://t.nhentai.net/galleries/770772/thumb.jpg
		  w: '250',
		  h: '105'
	  ]
	},
	...
  ]
}

API List

The ID of a doujin can be found can be found at after the /g/ in the search bar or a URL.

https://nhentai.net/g/248121 in this case 248121 is the ID.

nanaAPI.g(ID | Link)

  • ID | Link can both string or number

Get book API from book ID of book Link
return a Book Object

nanaAPI.random()
Get random book API
return a Book Object

nanaAPI.related(ID | Link)

  • ID | Link can both string or number

Get realated book API from book ID or book link
return a List Object

nanaAPI.homepage([page])

  • page is optional and must be a number

Get book list from nHentai homepage
return a List Object

nanaAPI.popular()
Get book list from popular section
return a List Object

nanaAPI.search(keyword [, page, popular ])

  • page must be a number
  • popular can be a boolean or string, if set true will get the popular list available string parameter is: today, all, and week

Get search list from keyword provided return a List Object

nanaAPI.tag(keyword [, page, popular ])
Same as nanaAPI.search()

nanaAPI.artist(keyword [, page, popular ])
Same as nanaAPI.search()

nanaAPI.character(keyword [, page, popular ])
Same as nanaAPI.search()

nanaAPI.parody(keyword [, page, popular ])
Same as nanaAPI.search()

nanaAPI.group(keyword [, page, popular ])
Same as nanaAPI.search()

nana-api's People

Contributors

dependabot[bot] avatar moonlgh avatar nikkozu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

nana-api's Issues

Axios Error due to DDoS protection

Running any nana-api function returns a 503. This is likely due to the DDoS protection that nhentai has now.

Output

Error: Request failed with status code 503
    at createError (.../node_modules/nana-api/node_modules/axios/lib/core/createError.js:16:15)
    at settle (.../mockups/node_modules/nana-api/node_modules/axios/lib/core/settle.js:17:12)
    at IncomingMessage.handleStreamEnd (.../Code/mockups/node_modules/nana-api/node_modules/axios/lib/adapters/http.js:269:11)
    at IncomingMessage.emit (node:events:406:35)
    at endReadableNT (node:internal/streams/readable:1343:12)

TypeError: Cannot read property 'status' of undefined

Got these error while trying to use Nana API
Code I used:
nana.g('177013').then((g) => console.log(g));

I use async await at first:

try{
     let data = await nana.g('177013');
     console.log(data);
} catch (err){
     console.log(err)
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.