Reputation: 192
I need to get the release date of a song.
In last.fm API, like described on the documentation, is enough to make an HTTP request to the server and it will reply with an XML (or JSON) that contain the field "" (like is shown in the Sample Response on the website).
The problem is that if I call with the same request in the documentation the reply is identical except the field that I need.
Is possible to get this information in another way?
Example:
<album>
<name>Believe</name>
<artist>Cher</artist>
<id>2026126</id>
<mbid>61bf0388-b8a9-48f4-81d1-7eb02706dfb0</mbid>
<url>http://www.last.fm/music/Cher/Believe</url>
<releasedate>6 Apr 1999, 00:00</releasedate> //i need this
<image size="small">...</image>
<image size="medium">...</image>
<image size="large">...</image>
<listeners>47602</listeners>
<playcount>212991</playcount>
<toptags>
<tag>
<name>pop</name>
<url>http://www.last.fm/tag/pop</url>
</tag>
...
</toptags>
<tracks>
<track rank="1">
<name>Believe</name>
<duration>239</duration>
<mbid/>
<url>http://www.last.fm/music/Cher/_/Believe</url>
<streamable fulltrack="0">1</streamable>
<artist>
<name>Cher</name>
<mbid>bfcc6d75-a6a5-4bc6-8282-47aec8531818</mbid>
<url>http://www.last.fm/music/Cher</url>
</artist>
</track>
...
</tracks>
</album>
<album>
<name>Believe</name>
<artist>Cher</artist>
<mbid>63b3a8ca-26f2-4e2b-b867-647a6ec2bebd</mbid>
<url>https://www.last.fm/music/Cher/Believe</url>
<image size="small">
https://lastfm.freetls.fastly.net/i/u/34s/3b54885952161aaea4ce2965b2db1638.png
</image>
<image size="medium">
https://lastfm.freetls.fastly.net/i/u/64s/3b54885952161aaea4ce2965b2db1638.png
</image>
<image size="large">
https://lastfm.freetls.fastly.net/i/u/174s/3b54885952161aaea4ce2965b2db1638.png
</image>
<image size="extralarge">
https://lastfm.freetls.fastly.net/i/u/300x300/3b54885952161aaea4ce2965b2db1638.png
</image>
<image size="mega">
https://lastfm.freetls.fastly.net/i/u/300x300/3b54885952161aaea4ce2965b2db1638.png
</image>
<image size="">
https://lastfm.freetls.fastly.net/i/u/300x300/3b54885952161aaea4ce2965b2db1638.png
</image>
<listeners>405536</listeners>
<playcount>2644726</playcount>
<tracks>
...
<tags>...</tags>
<wiki>...</wiki>
</album>
</lfm>
The request is http://ws.audioscrobbler.com/2.0/?method=album.getinfo&api_key=MY_API_KEY&artist=Cher&album=Believe
The page where that informations are is: https://www.last.fm/api/show/album.getInfo
Thanks a lot!
Upvotes: 4
Views: 1671
Reputation: 1460
I'm having the same issue - the release date doesn't come back. I've opted to use the MusicBrainz API to get the album details. However the issue with that is the calls will come back as 500s if too many requests are made in quick succession - the only workaround that I can find is to put a second delay on each call, which becomes annoying with a lot of albums.
Anyway, here's a sample request : http://musicbrainz.org/ws/2/release/844eb096-2b84-4c8f-9922-7f287126b39e?fmt=json
If you find a workaround for the timing issue let me know
Upvotes: 0
Reputation: 4742
Definitely an inconsistency in the Last.fm API documentation vs the actual response.
The only other place where such an info might be available is the artist.getTopAlbums, but the release date is not available there either.
So, to answer your question, no, it is not possible to get the release date of the album via the API. Your best bet, if you really want this piece of information, is to extract it from the html page itself via web-scraping, and to not rely on the API for this scenario.
Upvotes: 3