Sha256: fc5bf10b451fd7c2512197cb3268d550f3c2b16e30733389d47916b72006a95d
Contents?: true
Size: 549 Bytes
Versions: 1
Compression:
Stored size: 549 Bytes
Contents
class WikiOnThisDay::Scraper::Homepage < WikiOnThisDay::Scraper attr_accessor :snippets def initialize super('https://en.wikipedia.org/wiki/Main_Page') @snippets = Array.new self.html_doc.search('div#mp-otd div#mp-otd-img + ul li').each do |event| @snippets << WikiOnThisDay::Snippet.new(year: event.css('a').first.text, text: event.children.text.split(/ – /)[1], link_url: 'https://en.wikipedia.org' + event.css('b a')[0]["href"]) end end def summarize self.snippets.each { |snippet| snippet.print } end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
wiki_on_this_day-0.2.2 | lib/wiki_on_this_day/homepage.rb |