Image Signatures Group » Обсуждения

Fetching recently played track albums from last.fm

 
    • therobbot пишет...
    • Пользователь
    • Сен 1 2006, 10:50

    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

Анонимные пользователи не могут оставлять сообщения. Для того, чтобы писать в форумах, пожалуйста, войди на сайт или создай аккаунт.