Skip to content

Instantly share code, notes, and snippets.

@oafridi
Created February 17, 2016 08:09
Show Gist options
  • Save oafridi/8d24e3e0cdc78875449b to your computer and use it in GitHub Desktop.
Save oafridi/8d24e3e0cdc78875449b to your computer and use it in GitHub Desktop.
require 'open-uri'
require 'launchy'
resp = open('http://www.bbc.co.uk/radio1/chart/singles/print').read
data = resp.scan(/<td>(.*)<\/td>/).flatten
rows = data.each_slice(6).map {|row| row}
songs = []
rows.each do |row|
songs << "#{row[4]} #{row[5]}" if row[1] == 'new'
end
songs.each do |song|
puts song
puts "https://www.google.com/search?q=#{URI::escape(song)}.mp3"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment