Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get the release date of an album last.fm api

Tags:

last.fm

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:

  • portion of the sample response in the website:

    <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>

  • my Response

    <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!

like image 538
Marco Ferrè Avatar asked Oct 16 '25 16:10

Marco Ferrè


1 Answers

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.

like image 115
mihai Avatar answered Oct 19 '25 14:10

mihai



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!