class Mozart::Scraper

Public Instance Methods

get_page() click to toggle source
# File lib/mozart/scraper.rb, line 7
def get_page
  Nokogiri::HTML(open('https://en.wikipedia.org/wiki/List_of_symphonies_by_Wolfgang_Amadeus_Mozart'))
end
get_symphony_page(url) click to toggle source
# File lib/mozart/scraper.rb, line 32
def get_symphony_page(url)
  Nokogiri::HTML(open(url))
end
print_symphonies_index() click to toggle source
print_symphonies_urls() click to toggle source
print_the_title() click to toggle source
scrape_symphonies_index() click to toggle source
# File lib/mozart/scraper.rb, line 16
def scrape_symphonies_index
  self.get_page.css(".sorttext")[0..60].each { |el| Mozart::Symphony.new("#{el.text}, #{el.css("a").attr("title").text}", "https://en.wikipedia.org" + el.css("a").attr("href").text) }
end
scrape_symphony_description(url) click to toggle source
# File lib/mozart/scraper.rb, line 40
def scrape_symphony_description(url)
  self.get_symphony_page(url).css("p").text
end
scrape_symphony_name_with_number(url) click to toggle source
# File lib/mozart/scraper.rb, line 36
def scrape_symphony_name_with_number(url)
  self.get_symphony_page(url).css(".mw-parser-output p b").text
end