DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Last.fm Favorite Artists For Social Network

12.11.2006
| 4257 views |
  • submit to reddit
        // Returns a list of your top 50 favorite artists from last.fm, suitable for pasting into a Facebook, Myspace, or similar profile

#!/usr/bin/env ruby
require 'net/http'
require 'csv'
user = 'nertzy'
csv = Net::HTTP.get 'ws.audioscrobbler.com', "/1.0/user/#{user}/topartists.txt"
puts CSV::Reader.parse(csv).collect{ |row| row[2] }.join(", ")
    

Comments

Snippets Manager replied on Fri, 2007/06/22 - 6:52am

Hi, I am new to ruby and am wondering how to get this code working on a MySpace profile successfully? Thanks.