itunes search api docには、 maroonというアーティストを検索する例があり、URL は次のようになります。
https://itunes.apple.com/search?term=maroon&entity=allArtist&attribute=allArtistTerm
これは、次のように始まる 50 を超える結果を返します。
{
"resultCount": 50,
"results": [
{
"wrapperType": "artist",
"artistType": "Artist",
"artistName": "Maroon 5",
"artistLinkUrl": "https://itunes.apple.com/us/artist/maroon-5/id1798556?uo=4",
"artistId": 1798556,
"amgArtistId": 529962,
"primaryGenreName": "Pop",
"primaryGenreId": 14,
"radioStationUrl": "https://itunes.apple.com/station/idra.1798556"
},
{
"wrapperType": "artist",
"artistType": "Software Artist",
"artistName": "MaroonEntertainment",
"artistLinkUrl": "https://itunes.apple.com/us/artist/maroonentertainment/id537029262?uo=4",
"artistId": 537029262,
"radioStationUrl": "https://itunes.apple.com/station/idra.537029262"
},
いいですね。ただし、ここに私の問題があります。アーティストと曲名とアルバム名の両方の検索を組み合わせて、できるだけ具体的な検索クエリを作成したいと思います..
たとえば、こんな曲を手に入れました。
- 曲名:アクロス・ザ・グレート・ディバイド
- アルバム:グレート・ディバイド
- アーティスト:セミソニック
アーティスト名のみを検索できます。
https://itunes.apple.com/search?term=Semisonic&entity=allArtist&attribute=allArtistTerm
曲の用語のみを検索できます。
https://itunes.apple.com/search?term=Across the Great Divide&entity=song&attribute=songTerm
アルバム名のみを検索できます。
https://itunes.apple.com/search?term=Great Divide&entity=album&attribute=albumTerm
しかし、これらの人は誰も私が望む結果を与えてくれません (私が探している結果をおそらく 50 の他の人の中から見つけることができます..しかし、クライアント側のフィルタリングのようなものを避けるために、検索クエリを十分に具体的にしたいだけです)。
これらの検索を組み合わせるにはどうすればよいですか? 単純に 2 つの検索を追加すると (この例では、曲とアーティストの両方を検索しています):
https://itunes.apple.com/search?term=Across the Great Divide&entity=song&attribute=songTerm&term=Semisonic&entity=allArtist&attribute=allArtistTerm
その場合、Apple は最初の検索タイプ (曲など) を単純に無視し、アーティストのみの結果を返します)。
アイデア?