Sha256: 04bff1be2ae6d1ae7ba3f34864069bb8720538b9a98144f2126105c9d6af0044

Contents?: true

Size: 971 Bytes

Versions: 1

Compression:

Stored size: 971 Bytes

Contents

class OrlandoEvents::Scraper

  def self.scrape_events
    events = []
    events << self.scrape_dates
    events
  end

  def self.scrape_dates(date_page)
    months = []
    doc = Nokogiri::HTML(open(date_page))
    doc.css("div#left_nav li").each do |month|
      link = month.css("a").map {|link| link['href']}
      month_info = {:name => month.css("a").text.gsub("               ", ""), :month_url => "http://www.downtownorlando.com/future#{link[0]}"}
      months << month_info
    end
    months
  end

  def self.scrape_event_info(month_page)
    doc = Nokogiri::HTML(open(month_page))
    events = []
    doc.css(".view-content .row-fluid").each do |event|
      date = event.css("strong").text.gsub("\n    ","") #gets date
      event_detail = {:date => date.gsub("            ",""), :event_title => event.css(".event_title a").text, :event_location => event.css(".location").text}
      events << event_detail

    end
    # binding.pry
    events
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
orlando_events-0.1.5 lib/orlando_events/scraper.rb