module FFXIVScraper::Lodestone::News::Content

Public Instance Methods

get_detail(detail_path) click to toggle source
# File lib/ffxiv_scraper/lodestone/news.rb, line 40
def get_detail(detail_path)
  doc = open_html(get_base_url + detail_path)
  
  detail = doc.xpath('//article')
  relationships = []
  detail.xpath('.//li[@class="news__list"]').each do |relation|
    relationship = NewsContent.new(@lang, relation.xpath('.//time').text[/strftime\((\d+),/,1].to_i,
                                    relation.xpath('.//p/span').text + relation.xpath('.//p/text()[2]').text.strip, 
                                    relation.xpath('./a/@href').text, 
                                    relation.xpath('.//p/span').text)
    relationships << relationship
  end
  return DetailContent.new(@lang, detail.xpath('./div[@class="news__detail__wrapper"]').text, 
                            detail.xpath('.//li[@class="news__nav__next"]/a/@href').text, 
                            detail.xpath('.//li[@class="news__nav__prev"]/a/@href').text,
                            relationships)
end