Class: FortuneTeller::HoroscopeScraping
- Inherits:
-
Object
- Object
- FortuneTeller::HoroscopeScraping
- Defined in:
- lib/fortune_teller/horoscope_scraping.rb
Class Method Summary collapse
Class Method Details
.scrape_nypost_horoscope ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 |
# File 'lib/fortune_teller/horoscope_scraping.rb', line 3 def self.scrape_nypost_horoscope doc=Nokogiri::HTML(open("http://nypost.com/horoscopes/")) doc.search("div#primary div.site-content>div.row article.box").each do |h| hs=FortuneTeller::Horoscope.new hs.name= h.search("header.entry-header>h3 a").text.strip hs.date = h.search("div.entry-meta p").text.strip hs.content=h.search("div.entry-content p").text.strip end end |