可以使用Spotify Web API按名稱搜索Spotify目錄中的相冊。如何使用Spotify Web API搜索具有通用標題的相冊?
但是,如果專輯名稱是常用單詞或短語,搜索響應可能包含數千個結果。我看不到通過藝術家名稱縮小搜索範圍的方法。
下面是一個例子:搜索專輯Country由藝術家巨熊貓游擊隊配音隊。
的API請求是:
http://ws.spotify.com/search/1/album?q=country
的響應是:
<?xml version="1.0" encoding="UTF-8"?>
<albums xmlns="http://www.spotify.com/ns/music/1" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/">
<opensearch:Query role="request" startPage="1" searchTerms="country" />
<opensearch:totalResults>11861</opensearch:totalResults>
<opensearch:startIndex>0</opensearch:startIndex>
<opensearch:itemsPerPage>100</opensearch:itemsPerPage>
<album href="spotify:album:1Wcnyz2zYWLIPZ1K63RXdW">
<name>How Country Feels</name>
<artist href="spotify:artist:56x8mYvS3cyDGAi8N2FxbB">
<name>Randy Houser</name>
</artist>
<id type="upc">886443789852</id>
<popularity>0.73964</popularity>
<availability>
<territories>CA US</territories>
</availability>
</album>
...more albums...
</albums>
有11861分的結果,並且將結果尋呼,每頁100個相冊。可以請求獲取下一頁,但是如果我正在查找的專輯在最後一頁上,我將不得不向API發出118個單獨的請求,然後才能找到它。
有沒有更好的方法?
完美,謝謝。將高級搜索語法添加到文檔中將是一件好事。 – nick 2013-03-16 09:15:31