yesterday's technology tomorrow

Wednesday, May 07, 2003

iTunes 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 which will generally be handled via the akamai network.

The requests

Search Requests ...

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

itms:// ...
wa/advancedSearchResults?songTerm=regret&artistTerm=new order

View Artist ...

where xxx is the artistid. This can be gathered from the search or possibly via the browse function (see below).

View Album ...

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="20" Alternative
id="2" Blues
id="3" Books & Spoken
id="5" Classical
id="6" Country
id="17" Dance
id="7" Electronic
id="10" Folk
id="18" Hip Hop/Rap
id="22" Inspirational
id="11" Jazz
id="12" Latin
id="13" New Age
id="14" Pop
id="15" R&B/Soul
id="21" Rock
id="16" Soundtrack
id="23" Vocal
id="19" World

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
x-apple-crypto-iv: 40d2096e571bd518af88b1bd7ec1f1d8
x-apple-protocol-key: 2
x-apple-asset-version: 182
x-apple-max-age: 3600
x-apple-application-instance: 8
Vary: Accept-Encoding

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.

0 comments | 3:09 PM
Playground Finder Flink Labs - Data Visualisation

neuronwave is the personal site of Ben Hosken. I am the founder of Flink Labs, a data visualisation studio based in Melbourne. Previously I founded AgentArts, where I developed a recommendations system that we ultimately sold to MSFT.I have two patents, one in Recommendation Systems and one for a datamining algorithm I invented. I have a strong interest in physical computing, emergence, self organising systems, immersive games, bluetooth ad hoc networks and other fun things.
A while ago I built and ran Blog Change Bot - an AOL IM Bot which notified you when blogs you like are updated. I also built IcyPole, a bluetooth based P2P mobile phone app in 2004. With Suzette, I've built Playground Finder - a community contributed site for parents to find playgrounds nearby and while traveling for their kids to play in. Its a "playground" for my social, location, community and mobile interests.
I live in Melbourne with my wife Suzette, son Oskar Tex and my little girl Jasmine

Random Pile of Ben
Bodypump, Flink Labs, autumn weather, balance.

Downloads etc
The Best Bagel Recipe ever
iTunes XML structure
Photo of some of my best Panetones

Neuron EcoSystem
Flink Labs
oskartex.comOskar Tex
JasmineJasmine Aurora
Playground Finder


ben at neuronwave dot com