Created
November 30, 2012 18:35
-
-
Save robrasmussen/4177619 to your computer and use it in GitHub Desktop.
Show # of plays by artist on 101x
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'nokogiri' | |
require 'open-uri' | |
puts Nokogiri::HTML(open("http://www.101x.com/broadcasthistory.aspx")).xpath("//td[@class='broadcast txtMini']/span").inject(Hash.new(0)) {|memo,song_node| memo[song_node.text.strip.split(" - ").last] += 1; memo }.to_a.sort_by {|x| x.last }.reverse.collect {|x| x.reverse.join(" - ") } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment