class DMMCrawler::Attributes::DojinAttributes

Public Instance Methods

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

Private Instance Methods

author() click to toggle source
# File lib/dmm-crawler/attributes/dojin_attributes.rb, line 49
def author
  @page.search('div.circleName__item').text.strip
end
brand() click to toggle source
# File lib/dmm-crawler/attributes/dojin_attributes.rb, line 53
def brand
  @page.search('.head-detail table tr td').take(8).last
end
image_url() click to toggle source
# File lib/dmm-crawler/attributes/dojin_attributes.rb, line 29
def image_url
  attrs = @page.search('.productPreview__item img').first.attributes

  if attrs['data-src']
    attrs['data-src'].value
  else
    attrs['src'].value
  end
end
submedia() click to toggle source
# File lib/dmm-crawler/attributes/dojin_attributes.rb, line 39
def submedia
  @page
    .search('.productAttribute-listItem .c_icon_productGenre')
    .first
    .attributes['class']
    .value
    .gsub('c_icon_productGenre ', '')
    .delete('-')
end
tags() click to toggle source
# File lib/dmm-crawler/attributes/dojin_attributes.rb, line 57
def tags
  @page.search('.genreTagList .genreTagList__item a').map { |e| e.text.strip }
end
title() click to toggle source
# File lib/dmm-crawler/attributes/dojin_attributes.rb, line 20
def title
  @page.search('.productTitle__txt span').remove
  @page.search('.productTitle__txt').text.strip
end