Created
February 20, 2009 20:32
-
-
Save infovore/67677 to your computer and use it in GitHub Desktop.
tells you what a username is listening to right now on last.fm. Probably not of use to you.
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
#!/usr/bin/env ruby -KU | |
require 'rubygems' | |
require 'open-uri' | |
require 'hpricot' | |
if ARGV[0] | |
user = ARGV[0] | |
url = "http://www.last.fm/user/#{user}" | |
doc = Hpricot(open(url)) | |
track = doc.search("table#recentTracks tbody tr:first td.subjectCell").inner_text.gsub("full track", "").strip | |
puts "#{user} is listening to #{track}" | |
else | |
puts "Wotlisten tells you what a last.fm short username is listening to (or most recently listened to)" | |
puts "Usage: wotlisten.rb username" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment