class Language

Public Class Methods

listing(keyword, sort = 1, page = 1) click to toggle source

List all doujinshi of the page of a given language

@since 0.2.0 @see Tag#listing

# File lib/nhentai-api.rb, line 527
def self.listing(keyword, sort = 1, page = 1)
  keyword.tr!(' ', '-')
  sort = sort == 1 ? '' : 'popular'
  client = Net::HTTP.get_response(URI("https://nhentai.net/language/#{keyword}/#{sort}?page=#{page}"))
  res = client.body.split(%r{<div class="gallery".+?>(.+)</div>}).select { |line| line.include?('<a href="/g/') }

  parse_tags(res)
end