module Irasutoya::Modules::HasShowPageParser::PrivateMethods

Public Class Methods

description_from(document:) click to toggle source
# File lib/irasutoya/modules/has_show_page_parser.rb, line 28
def description_from(document:)
  document.css('.entry').css('.separator')[1].text.strip
end
image_url_from(document:) click to toggle source
# File lib/irasutoya/modules/has_show_page_parser.rb, line 32
def image_url_from(document:)
  image = document.css('.entry').search('img').attribute('src').value
  image.chars.first == '/' ? "https:#{image}" : image
end
image_urls_from(document:) click to toggle source
# File lib/irasutoya/modules/has_show_page_parser.rb, line 37
def image_urls_from(document:)
  sources = document.css('.entry').search('img').collect do |img|
    img[:src]
  end
  sources.collect { |url| url.start_with?('/') ? "https:#{url}" : url }
end
title_from(document:) click to toggle source
# File lib/irasutoya/modules/has_show_page_parser.rb, line 24
def title_from(document:)
  document.css('.post').css('.title').search('h2').text.strip
end