Skip to content

Instantly share code, notes, and snippets.

@robrasmussen
Created November 30, 2012 18:35
Show Gist options
  • Save robrasmussen/4177619 to your computer and use it in GitHub Desktop.
Save robrasmussen/4177619 to your computer and use it in GitHub Desktop.
Show # of plays by artist on 101x
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