Class: Html2rss::AutoSource::Channel

Inherits:
Object
  • Object
show all
Defined in:
lib/html2rss/auto_source/channel.rb

Overview

Extracts channel information from

  1. the HTML document’s <head>.

  2. the HTTP response

Instance Method Summary collapse

Constructor Details

#initialize(parsed_body, url:, response:, articles: []) ⇒ Channel

Returns a new instance of Channel.

Parameters:

  • parsed_body (Nokogiri::HTML::Document)

    The parsed HTML document.

  • response (Faraday::Response)

    The URL of the HTML document.



14
15
16
17
18
19
# File 'lib/html2rss/auto_source/channel.rb', line 14

def initialize(parsed_body, url:, response:, articles: [])
  @parsed_body = parsed_body
  @url = url
  @response = response
  @articles = articles
end

Instance Method Details

#descriptionObject



24
# File 'lib/html2rss/auto_source/channel.rb', line 24

def description = extract_description

#generatorObject



29
30
31
# File 'lib/html2rss/auto_source/channel.rb', line 29

def generator
  "html2rss V. #{::Html2rss::VERSION} (using auto_source scrapers: #{scraper_counts})"
end

#imageObject



25
# File 'lib/html2rss/auto_source/channel.rb', line 25

def image = extract_image

#languageObject



23
# File 'lib/html2rss/auto_source/channel.rb', line 23

def language = extract_language

#last_build_dateObject



27
# File 'lib/html2rss/auto_source/channel.rb', line 27

def last_build_date = response.headers['last-modified']

#titleObject



22
# File 'lib/html2rss/auto_source/channel.rb', line 22

def title = extract_title

#ttlObject



26
# File 'lib/html2rss/auto_source/channel.rb', line 26

def ttl = extract_ttl

#urlObject



21
# File 'lib/html2rss/auto_source/channel.rb', line 21

def url = extract_url