Written by Colin on 7/02/2010

I randomly had the idea the other day to make another little LastFM app using the very excellent API services. I thought it'd be cool to be able to see the first time any user listened to a particular artist. So I made this little site on my student page that does just that.



Basically, you just enter any LastFM username and a particular artist and then hit submit. The site loads the user.getArtistTracks API method which returns every single track a user has listened to performed by a particular artist. The XML file is segmented into pages of 50 track plays but fortunately reports the total number of pages in the first child element. This number is stored and used to access the last page of the data, which theoretically contains the very first track listened to by the user from that particular artist. From there it just grabs the first (chronologically) entry and pulls the timestamp and produces the page seen below. I could also have it report the track name but decided that wasn't really the focus of the webpage.



Check it out here. If you don't have a LastFM account, I'd highly recommend signing up for one because it's quite cool being able to track all the music you listen to and get recommendations on new music based on your listening habits.

5 Comments:

Nathan said...

Very cool. I don't use LastFM much, but I have some friends who do.

eldaron1 said...

THANK YOU. I was trying to figure out when I first heard a band. I went to my last.fm, but that was a hopeless effort. I googled this idea and your search came up. Good work. :D

Angus Prune said...

This is a great idea, unfortunately it seems to have dissapeared now. Any chance of getting it running somewhere else or posting the code?

Colin said...

Yup. I've updated the links in the article to my new website.

http://csullender.com/lastfm/first.php

Anonymous said...

Nice! Really nice!
Thanks for that!

Related Posts with Thumbnails