Right now it looks like a mystery. Please help me in solving it.
I use iTunes public API to fetch an album: "Metallica" by Metallica (see it in browser: US region, MV region). I construct the following URLs to fetch it via API:
- US region https://itunes.apple.com/lookup?id=579372950&country=US&entity=album - works
- MV region https://itunes.apple.com/lookup?id=579372950&country=MV&entity=album - doesn't work
Here's the actual behaviour I observe:
If I query
GET https://itunes.apple.com/lookup?id=579372950&country=MV&entity=album
in a Spring app (usingRestTemplate
+ JacksonHttpMessageConverter
) I get an empty response:{ "resultCount":0, "results": [] }
If I navigate to https://itunes.apple.com/lookup?id=579372950&country=MV&entity=album in a browser I get a file download prompt. The file contains an empty response:
{ "resultCount":0, "results": [] }
If I query API using HttpPie
http get https://itunes.apple.com/lookup?id=579372950&country=MV&entity=album
I get a non-empty response !!!{ "resultCount": 1, "results": [ { "amgArtistId": 4906, "artistId": 3996865, "artistName": "Metallica", "artistViewUrl": "https://music.apple.com/us/artist/metallica/3996865?uo=4", "artworkUrl100": "https://is1-ssl.mzstatic.com/image/thumb/Music/v4/0b/9c/d2/0b9cd2e7-6e76-8912-0357-14780cc2616a/source/100x100bb.jpg", "artworkUrl60": "https://is1-ssl.mzstatic.com/image/thumb/Music/v4/0b/9c/d2/0b9cd2e7-6e76-8912-0357-14780cc2616a/source/60x60bb.jpg", "collectionCensoredName": "Metallica", "collectionExplicitness": "notExplicit", "collectionId": 579372950, "collectionName": "Metallica", "collectionPrice": 9.99, "collectionType": "Album", "collectionViewUrl": "https://music.apple.com/us/album/metallica/579372950?uo=4", "copyright": "℗ 1991 Blackened Recordings", "country": "USA", "currency": "USD", "primaryGenreName": "Metal", "releaseDate": "1991-08-12T07:00:00Z", "trackCount": 13, "wrapperType": "collection" } ] }
I tried it multiple times and the results seem to be consistent. I compared the requests and they seem to be identical.
Why does iTunes respond differently to different clients? I can't understand. What important detail am I missing?
Similar questions:
- Spring RestTemplate getForObject URL not working for Apple iTunes - there's another problem (double encoding of the whitespace character).
This problem happens to the following regions (it's a complete list):
- LI https://itunes.apple.com/lookup?id=579372950&country=LI&entity=album
- MV https://itunes.apple.com/lookup?id=579372950&country=MV&entity=album
- MM https://itunes.apple.com/lookup?id=579372950&country=MM&entity=album
- ET https://itunes.apple.com/lookup?id=579372950&country=ET&entity=album
- RS https://itunes.apple.com/lookup?id=579372950&country=RS&entity=album