PHP を使用して、groveshark の URL から曲の情報を取得する必要があります。
http://grooveshark.com/s/Soul+Meets+Body/4s4DZd?src=5
API を使用しない方法はありますか、それとも Grooveshark API が必要ですか?
ありがとう
PHP を使用して、groveshark の URL から曲の情報を取得する必要があります。
http://grooveshark.com/s/Soul+Meets+Body/4s4DZd?src=5
API を使用しない方法はありますか、それとも Grooveshark API が必要ですか?
ありがとう
アクセスした後、その URL は にリダイレクトされるように見えますhttp://grooveshark.com/#!/s/Soul+Meets+Body/4s4DZd?src=5
が、その前のソース コードには、HTML5 Microdataでエンコードされた情報が含まれています (掘り下げれば、読みやすいリソースがいくつか見つかるはずです)。
ソースから:
<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>
PHP のDomDocumentやその他の HTML パーサーなどを使用してその情報を取得できますが、API を使用するとより簡単になると思います。