Top Level Namespace

Defined Under Namespace

Classes: Doujinshi, Search

Constant Summary collapse

SORT =
{
  today: 'popular-today',
  week: 'popular-week',
  all_time: 'popular'
}.freeze
IMAGE_EXTENSION =
{
  'j' => 'jpg',
  'p' => 'png',
  'g' => 'gif'
}.freeze
SINGULAR_TAG =
{
  'tags' => 'tag',
  'parodies' => 'parody',
  'characters' => 'character',
  'artists' => 'artist',
  'groups' => 'group',
  'languages' => 'language',
  'categories' => 'category'
}.freeze

Instance Method Summary collapse

Instance Method Details

#parse_tiles(res) ⇒ Object



28
29
30
31
32
33
34
35
36
# File 'lib/nhentai-api.rb', line 28

def parse_tiles(res)
  res.map do |line|
    id    = line.match(%r{/g/(\d+)/})[1]
    name  = line.match(/<div class="caption">(.+)/)[1].strip
    url   = "/g/#{id}"

    OpenStruct.new(id: id, name: name, url: url)
  end
end