Module: OpenDMM::Maker::Baltan::Parser

Defined in:
lib/opendmm/makers/baltan.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/baltan.rb', line 19

def self.parse(content)
  page_uri = content.request.last_uri
  html = Nokogiri::HTML(Utils.force_utf8(content))
  return {
    actresses:       html.xpath('//*[@id="content1"]/section/div[2]/table/tr[7]/td/a').map(&:text),
    code:            html.xpath('//*[@id="content1"]/section/div[2]/table/tr[1]/td').text,
    cover_image:     html.at_css('#content1 > section > div.img > img')['src'],
    description:     html.css('#content1 > section > p').text,
    label:           html.xpath('//*[@id="content1"]/section/div[2]/table/tr[4]/td').text,
    movie_length:    html.xpath('//*[@id="content1"]/section/div[2]/table/tr[2]/td').text,
    page:            page_uri.to_s,
    release_date:    html.xpath('//*[@id="content1"]/section/div[2]/table/tr[3]/td').text,
    series:          html.xpath('//*[@id="content1"]/section/div[2]/table/tr[5]/td').text,
    theme:           html.xpath('//*[@id="content1"]/section/div[2]/table/tr[6]/td').text,
    thumbnail_image: html.at_css('#content1 > section > div.img > img')['src'],
    title:           html.css('#content1 > section > h2').text,
  }
end