On the Last.fm website, your recently listened track include the 34x34 (or whatever size) image at the left of each song. However, in the RSS feed that they give you, no image URLs are provided for the songs. I was wondering if there was a good way of figuring out the ID for the image that needs to be used for that artist and displaying it based on the data that we're given. I know it is possible to load the artist page from their website and then grab the image values from JavaScript, but that seems overly complicated and would probably take quite some time to do.
What we're given:
<item>
<title>Owl City – Rainbow Veins</title>
<link>http://www.last.fm/music/Owl+City/_/Rainbow+Veins</link>
<pubDate>Thu, 20 May 2010 18:15:29 +0000</pubDate>
<guid>http://www.last.fm/user/animuson#1274379329</guid>
<description>http://www.last.fm/music/Owl+City</description>
</item>
and the 34x34 image for this song would be here (ID# 37056785).
Does anything like this exist? I've considered sto开发者_运维技巧ring the ID number in a cache of some sort once it has been checked once, but what if the image changes?
After a bit of searching I found it (thanks Thomas McDonald as well). I found a user.getRecentTracks method that includes image URLs in the information and also uses XML, which is much more helpful to me.
What you get with this method:
<track>
<artist mbid="">Owl City</artist>
<name>Rainbow Veins</name>
<streamable>1</streamable>
<mbid></mbid>
<album mbid="f3e4acfb-6e99-4370-9f72-48dbd99d5206">Maybe I'm Dreaming</album>
<url>http://www.last.fm/music/Owl+City/_/Rainbow+Veins</url>
<image size="small">http://userserve-ak.last.fm/serve/34s/22743543.jpg</image>
<image size="medium">http://userserve-ak.last.fm/serve/64s/22743543.jpg</image>
<image size="large">http://userserve-ak.last.fm/serve/126/22743543.jpg</image>
<image size="extralarge">http://userserve-ak.last.fm/serve/300x300/22743543.jpg</image>
<date uts="1274379329">20 May 2010, 18:15</date>
</track>
As you can see, a lot more information than the basic recent tracks RSS feed and you don't have to run multiple loads to get additional information, just the single XML load to get the feed.
精彩评论