class TopSongs::SongScraper

Public Instance Methods

make_songs() click to toggle source
# File lib/top_songs/song_scraper.rb, line 11
def make_songs
  scrape_songs.each do |song|
    if TopSongs::Song.all_songs.length <= TopSongs::CLI.song_number - 1
      TopSongs::Song.create_songs(song)
    end
  end
end
open_page() click to toggle source
# File lib/top_songs/song_scraper.rb, line 3
def open_page
  Nokogiri::HTML(open("https://www.billboard.com/charts/hot-100")) #open page
end
scrape_songs() click to toggle source
# File lib/top_songs/song_scraper.rb, line 7
def scrape_songs 
  self.open_page.css("div.chart-row__main-display")
end