Class: Group

Inherits:
Tag
  • Object
show all
Defined in:
lib/nhentai-api.rb

Class Method Summary collapse

Methods inherited from Tag

parse_tags

Class Method Details

.listing(keyword, sort = 1, page = 1) ⇒ Object

List all doujinshi of the page of a given group

See Also:

Since:

  • 0.2.0



501
502
503
504
505
506
507
508
# File 'lib/nhentai-api.rb', line 501

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

  parse_tags(res)
end