Image Signatures Group » Discussões

Fetching recently played track albums from last.fm

 
  • Fetching recently played track albums from last.fm

    Hi,

    I just realized that the following is possible and am now using it when my Musicbrainz/Amazon query fails. Maybe it is helpful for anybody:

    $url is the track url that you can get from the recenttracks xml file:


    $html = file_get_contents($url);

    //find album in source
    preg_match('/.*div class="cover".*?title.*?- (.*?)".*?src="(.*?)"/isu', $html, $matches);

    // It is a jpg (no_cover-image is gif)
    if(stristr($matches[2], "jpg"))
    {
    $album=$matches[1];
    $albumURL=$matches[2];
    }



    Maybe this helps anyone until they finally put more infos in the XML.

    Tobias

Usuários anônimos não podem postar mensagens. É preciso fazer login ou criar uma conta para postar nos fóruns.