Pergunta

i need to grab Song infos form a grooveshark URL with PHP:

http://grooveshark.com/s/Soul+Meets+Body/4s4DZd?src=5

There is a way with out API or i need Grooveshark API?

Thanks

Foi útil?

Solução

It looks like that URL redirects to http://grooveshark.com/#!/s/Soul+Meets+Body/4s4DZd?src=5 after you visit it, but the source code before that does have some information encoded in HTML5 Microdata (I'm sure you'll find some easier to read resources with some digging).

From the source:

<div itemscope itemtype="http://www.schema.org/MusicRecording">
    <img src="http://images.grooveshark.com/static/amazonart/s1085803.png" alt="Plans by Death Cab for Cutie" title="Plans by Death Cab for Cutie" itemprop="image" />

    <div>
        <span itemprop="name">Soul Meets Body</span>
        by
        <span itemprop="byArtist" itemscope itemtype="http://www.schema.org/MusicGroup">
            <a href="http://grooveshark.com/artist/Death+Cab+For+Cutie/401368"><span itemprop="name">Death Cab for Cutie</span></a>
            <meta content="http://grooveshark.com/artist/Death+Cab+For+Cutie/401368" itemprop="url" />
        </span>
        on
        <span itemprop="inAlbum" itemscope itemtype="http://www.schema.org/MusicAlbum">
            <a href="http://grooveshark.com/album/Plans/1085803"><span itemprop="name">Plans</span></a>
            <meta content="http://grooveshark.com/album/Plans/1085803" itemprop="url" />
        </span>
    </div>

</div>

You'd be able to use something like PHP's DomDocument or some other HTML parser to get that info, but I'd imagine it would be easier with their API.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top