Class: FreeArtExhibits::Scraper

Inherits:
Object
  • Object
show all
Defined in:
lib/free_art_exhibits/scraper.rb

Overview

require_relative ‘exhibit.rb’

Instance Method Summary collapse

Instance Method Details

#get_pageObject



7
8
9
# File 'lib/free_art_exhibits/scraper.rb', line 7

def get_page
  Nokogiri::HTML(open("http://www.timeout.com/newyork/art/the-best-free-art-exhibitions-in-nyc"))
end

#make_exhibitsObject



15
16
17
18
19
20
21
22
23
# File 'lib/free_art_exhibits/scraper.rb', line 15

def make_exhibits
    scrape_index_page.each do |exhibit|
        FreeArtExhibits::Exhibit.new(
          "http://www.timeout.com" + exhibit.css("a.read-more").attr("href").value + "#tab_panel_2",
          exhibit.css("h3 a").text,
          exhibit.css("p.feature_item__annotation--truncated").text
          )
    end
end

#scrape_index_pageObject



11
12
13
# File 'lib/free_art_exhibits/scraper.rb', line 11

def scrape_index_page
  page = get_page.css("article.feature-item")
end