Git Product home page Git Product logo

nhentai-api's Introduction

Gem Version MIT license Maintainability

nhentai-api

nhentai-api is a basic and easy to use API for nhentai.net

Installation

Gem install

gem install nhentai-api

Gemfile

gem 'nhentai-api', '~> 1.0'

API

doujinshi = Doujinshi.new(id: 220794)
puts doujinshi.title
puts doujinshi.pages
puts doujinshi.related

puts Doujinshi.random

puts Tag.new(keyword: 'ahegao').listing
puts Character.new(keyword: '2b', sort: :all_time, page: 5).listing

options = {
  keywords: { included: ["girl"] },
  pages: [">= 10", "<= 200"]
}
puts Search.new(options: options).listing

Documentation

The wiki contains the list of all methods with examples

Contributors

  • Mraiih Gael Roussel - creator, maintainer

nhentai-api's People

Contributors

mraiih avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

nhentai-api's Issues

Doujinshi constructor is broken

It fails with any ID i've tried

irb(main):003:0> Doujinshi.new 177013
Traceback (most recent call last):
        6: from /usr/bin/irb:23:in `<main>'
        5: from /usr/bin/irb:23:in `load'
        4: from /usr/lib64/ruby/gems/2.7.0/gems/irb-1.2.3/exe/irb:11:in `<top (required)>'
        3: from (irb):3
        2: from (irb):3:in `new'
        1: from /usr/lib64/ruby/gems/2.7.0/gems/nhentai-api-0.2.1/lib/nhentai-api.rb:23:in `initialize'
NoMethodError (undefined method `[]' for nil:NilClass)

i think it can be fixed by changing the regexp in line 23 from
@count_pages = @client.body.match(/([0-9]+) pages/)[1].to_i
to
@count_pages = @client.body.match(/([0-9]+)\+pages/)[1].to_i

Tag.count does not work with number > 999

Actual result:

Tag.count('ahegao')
# => 37

Expected:

Tag.count('ahegao')
# => 37000

This bug should be in other classes too (Parody, Character, Category, Artist, Group, ...)

can't get certain doujinshis

With specific IDs, the api raises an exception.

irb(main):004:0> Doujinshi.new 290133
Traceback (most recent call last):
        6: from /usr/bin/irb:23:in `<main>'
        5: from /usr/bin/irb:23:in `load'
        4: from /usr/lib64/ruby/gems/2.6.0/gems/irb-1.0.0/exe/irb:11:in `<top (required)>'
        3: from (irb):4
        2: from (irb):4:in `new'
        1: from /usr/lib64/ruby/gems/2.6.0/gems/nhentai-api-0.2.0/lib/nhentai-api.rb:22:in `initialize'
NoMethodError (undefined method `[]' for nil:NilClass)

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.