Module: OpenDMM::Maker::AnnaAndHanako::Parser

Defined in:
lib/opendmm/makers/anna_and_hanako.rb

Class Method Summary collapse

Class Method Details

.parse(content) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/opendmm/makers/anna_and_hanako.rb', line 19

def self.parse(content)
  page_uri = content.request.last_uri
  html = Nokogiri::HTML(Utils.force_utf8(content))
  specs = Utils.hash_by_split(html.xpath('//*[@id="pake-bottom-box_r"]/dl/p').map(&:text))
  return {
    actresses:       specs['出演者'].split('/'),
    code:            specs['品番'],
    cover_image:     html.at_xpath('//*[@id="pake-bottom-box"]/dl/a')['href'],
    description:     html.xpath('//*[@id="txt-bottom-box"]').text,
    directors:       specs['監督'].split('/'),
    movie_length:    specs['収録時間'],
    page:            page_uri.to_s,
    release_date:    specs['発売日'],
    sample_images:   html.xpath('//*[@id="mein-sanpuru-sam"]/a').map { |a| a['href'] },
    thumbnail_image: html.at_xpath('//*[@id="pake-bottom-box"]/dl/a/img')['src'],
    title:           html.xpath('//*[@id="mein-left-new-release-box"]/div/div/h5').text,
  }
end