« Microsoft Code Names Successor to Vista | Main | Something happened here »

How iTunes selects the storefront

Following the itmshack: Grab Album Description Text from the iTunes Music Store article on the O’Reilly Mac DevCenter Blog, and on a Friend’s suggestion, and out of personal interest, I tried to figure out how iTunes specifies the storefront (or country) when talking to the iTunes Music Store. Running tcpflow while visiting the Swiss French store gave it away quite quickly: GET /WebObjects/MZStore.woa/wa/viewAlbum?id=154148337&s=143459 HTTP/1.1
X-Apple-Tz: 7200
X-Apple-Store-Front: 143459-2
Referer: http://ax.phobos.apple.com.edgesuite.net/WebObjects/MZStore.woa/wa/storeFront
User-Agent: iTunes/6.0.4 (Macintosh; U; PPC Mac OS X 10.4.6)
Accept-Language: en-us, en;q=0.50
X-Apple-Validation: 661D3B2F-DB90D338EA5BA65F951043499F6627ED
Accept-Encoding: gzip, x-aes-cbc
Connection: close
Host: ax.phobos.apple.com.edgesuite.net

The storefront is selected with the X-Apple-Store-Front HTTP request header. The number can be extracted by Control-clicking an item in iTunes and choosing ‘Copy iTunes Music Store URL’. As we can see, the s query parameter in the URL gives the storefront number:


The additional -2 in the HTTP header selects the language. If it’s omitted, the default language is used (German for the Swiss French store). Here are the values I could identify before I ran out of patience:

1: English
2: English (slightly different texts)
3: French
4: German
5: French (slightly different texts)

You can easily tell curl to add the X-Apple-Store-Front header:

curl --header 'X-Apple-Store-Front: 143459-2' -s 'http://ax.phobos.apple.com.edgesuite.net/WebObjects/MZStore.woa/wa/viewAlbum?id=154148337' | gunzip

Modification of the itmshack script is left as an exercise for the reader (or for the script’s author ;-)).


TrackBack URL for this entry: http://ithink.ch/blog/tb.cgi/154.

Make sure JavaScript is enabled before using this URL. If you would like to ping my blog but can't, please do send me an e-mail at os3476 at this domain.


It seems this doesn’t work anymore, with that X-Apple-Store-Front header value. Is there any updated documentation on this?

Btw it seems that X-Apple-Tz header is UTC offset *60 *60 ? Which in your case seems like it’s +2.

Post a comment

Make sure JavaScript is enabled before posting a comment. If you would like to post a comment but can't, please do send me an e-mail at os3476 at this domain.

Do not meddle in the affairs of Coding Ninjas, for they are subtle and quick to anger.