class DMMCrawler::Attributes::AdultGameAttributes

Public Instance Methods

to_a() click to toggle source
# File lib/dmm-crawler/attributes/adult_game_attributes.rb, line 6
def to_a
  [
    title,
    title_link,
    main_image_url,
    sample_image_urls,
    submedia,
    brand,
    affiliateable?,
    tags
  ]
end

Private Instance Methods

brand() click to toggle source
# File lib/dmm-crawler/attributes/adult_game_attributes.rb, line 41
def brand
  @page.search('.head-detail table tr td').take(8).last.text.strip
end
content_id() click to toggle source
# File lib/dmm-crawler/attributes/adult_game_attributes.rb, line 49
def content_id
  @page.uri.to_s.match(/views_\d*/)
end
main_image_url() click to toggle source
# File lib/dmm-crawler/attributes/adult_game_attributes.rb, line 29
def main_image_url
  @page.search('.area-package-image').search('.package-image-box a').first.attributes['href'].value
end
sample_image_urls() click to toggle source
# File lib/dmm-crawler/attributes/adult_game_attributes.rb, line 33
def sample_image_urls
  @page.search('#item-rotationbnr li span img').take(3).map { |img| img&.attributes&.send(:[], 'src')&.value }.compact
end
submedia() click to toggle source
# File lib/dmm-crawler/attributes/adult_game_attributes.rb, line 37
def submedia
  'adult_game'
end
tags() click to toggle source
# File lib/dmm-crawler/attributes/adult_game_attributes.rb, line 45
def tags
  @page.search('.area-bskt  tbody  tr')[4].search('td a').map { |elm| elm.text.strip }
end
title() click to toggle source
# File lib/dmm-crawler/attributes/adult_game_attributes.rb, line 21
def title
  @page.search('.page-detail h1').first.children.last.text.strip.gsub(/【.*】/, '')
end