yesterday's technology tomorrow
Wednesday, May 07, 2003iTunes Internal XML and URLs
Apple's iTunes 4 comes with the built in Apple Music Store application/browser. Basically, the store uses a REST interface with quite complex XML, by that I mean it contains data and detailed rendering information, which is transformed by iTunes to display as it does.
A few people have debugged/hacked the url for the search page so I decided to take it a little further to see what else could be gathered from the underlying data which might be useful for some projects.
Using Safari, telnet, iTunes and the excellent TCP Flow Recorder, I've managed to determine the following...
All requests can be made using either http:// or in OS X itms://. itms is iTune Music Store which basically forces iTunes to handle the request rather than the browser.
The base server for the requests is phobos.apple.com which will generally be handled via the akamai network.
The parameters are:
songTerm - song title
artistTerm - artist name
albumTerm - album name
composerTerm - composer name
term - all fields 1
so a search for New Order's regret track would be
where xxx is the artistid. This can be gathered from the search or possibly via the browse function (see below).
where xxx is the album id. Note that the field is playlistId not albumId.
To get the list of genres use
The result currently has the following genres (associated ids included)
id="3" Books & Spoken
id="18" Hip Hop/Rap
id="13" New Age
Once you have a genre you can then browse it using
where the genreId xx matches a genre above.
Now the issue here is that the data is returned with the following http response header
Content-Type: text/xml; charset=UTF-8
Server: Apache/1.3.27 (Darwin)
Last-Modified: Wed, 07 May 2003 02:28:14 GMT
Content-Encoding: gzip, x-aes-cbc
From this I gather that the content has been compressed using gzip and the encypted using an AES (Rijndael) algorithm so the response is not yet readable by me. The crypto key looks to be included so if anyone is able to break this down into steps for decrypting and viewing it would be great.. The response should again be XML.
You can also browse an artist to see what albums they have, but again, the response is encrypted and compressed. The request to browse an artist is
where xxx is the artistId for the artist you wish to browse.
As for other info such as images and clips they are all contained in the album detail page and in the search response page, the m4p file can be downloaded and played allowing you to save away the clips if you wish.
Finally, if someone was a XSLT guru you should be able to make a working web version of itunes with obviously cut down user interface for others to use.
Random Pile of Ben
ben at neuronwave dot com