Class: RTV::Fetcher
- Inherits:
-
Object
- Object
- RTV::Fetcher
- Defined in:
- lib/rtv.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
- #extract_shows(doc) ⇒ Object
- #fetch ⇒ Object
-
#initialize ⇒ Fetcher
constructor
A new instance of Fetcher.
Constructor Details
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
91 92 93 |
# File 'lib/rtv.rb', line 91 def config @config end |
#options ⇒ Object
Returns the value of attribute options.
91 92 93 |
# File 'lib/rtv.rb', line 91 def @options end |
Instance Method Details
#extract_shows(doc) ⇒ Object
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
# File 'lib/rtv.rb', line 108 def extract_shows doc if @options[:format] == 'search' daten = (doc/"div[@id='titel-uebersicht']") daten.each do |datum| zeiten = datum.parent.parent.parent.next_sibling unless zeiten.nil? zeiten = zeiten.search("span.tv-sendung-uhrzeit") else puts "Keine Suchergebnisse!" if $DEBUG raise NotFoundException, "Keine Suchergebnisse!" end zeiten.each do |zeit| show = Show.new show. = @config show.time = zeit.innerText show.desc, show.showview = time_to_desc_and_showview(zeit) show.name = time_to_name(zeit) show.channel = time_to_channel(zeit) show.date = datum.innerText[/^\D*(.+) Suchergebnis/, 1] add_show show end end else zeiten = (doc/"span.tv-sendung-uhrzeit") zeiten.each do |zeit| show = Show.new show. = @config show.time = zeit.innerText show.desc, show.showview = time_to_desc_and_showview(zeit) show.name = time_to_name(zeit) show.channel = time_to_channel(zeit) add_show show end end end |
#fetch ⇒ Object
98 99 100 101 102 103 104 105 106 |
# File 'lib/rtv.rb', line 98 def fetch while search_results?(doc = get_hdoc) extract_shows doc @options[:offset] += 1 print "." if $DEBUG end puts if $DEBUG return @shows end |