3
4
5
6
7
8
9
10
11
12
13
14
15
|
# File 'lib/broadway_now/scraper.rb', line 3
def self.main_scraper
doc = Nokogiri::HTML(open("http://www.broadway.com/shows/tickets/?page=1"))
shows_array = []
doc.css("div.grid-container .row-wrapper .grid-poster-unit").each do |show|
name = show.css(".h4.show-title a").text
url = "http://www.broadway.com"+show.css(".h4.show-title a").attribute("href").value
theater = show.css(".show-info li[2]").text
running_time = show.css(".show-info li[3] span").text
shows_array << {name: name, url: url, theater: theater, running_time: running_time}
end
shows_array
end
|