0xDECAFBAD

It's all spinning wheels and self-doubt until the first pot of coffee.

iTunes Music Store RSS Feeds

Yeah, I know I gave the iTMS a 'bah' last week in response to discovering DRM under the hood. But I've softened in my opinion since then. And bought a few more songs that I haven't heard in years. And burned an Audio CD. And wasn't too inconvenienced.



My girlfriend and I almost bought iPods last night, and though we resisted the temptation this time, I expect that we'll end up with them before long. And when that happens, I imagine we'll try sharing tracks, and that doesn't seem to be too inconvenient either. And then, there's the fact that the iTMS seems to have a pretty nifty set of underpinnings that look like fun to play with.



So now, like anything I'm interested in on the interweb, I want to swallow it up with my aggregator.



Thus, I attempt a new project: ItunesMusicStoreToRss



Progress so far, but I've hit a stumbling block. Anyone want to help?



Update: A little bit of cut & paste from the wiki page:



If you spy on iTunes while browsing to a "Just Added" section of a genre, you'll find that a URL like the following is accessed:



(it's a long URL)



The response to that URL is some very interesting XML that looks like a GUI language. Buried in the GUI recipe, however, is what I want flowing into my aggregator. So, I dust off my XSL skills and have a go at mangling this content into RSS. I seem to have been successful. A test run appears to validate, and is accepted in my aggregator.



The problem, though, lies in the aforementioned URL. Everything seems pretty clear and straightforward, and I can change genre's by supplying discovered ID's to the id parameter. However, the "fcid=145690" parameter is an unknown to me. It seems to change, though I haven't yet investigated its derivation or how often it changes. I was working on things yesterday, and the value was one thing, this morning it was another. If the number is not valid, unexpected results happen, sometimes resulting in HTML output describing an application exception. So, until the fcid mystery is solved, I've yet to automate this transformation.



Any ideas out there on the lazyweb? Visit the wiki page (ItunesMusicStoreToRss) and feel free to poke fun at my XSL skills.

shortname=itunes_rss

Archived Comments

  • What seems to be the problem?
  • Oh, it's rambled about on the wiki page. I just updated the blog entry with more info though. Seems there's a parameter (fcid) to the URL for just added albums that I can't decipher.
  • Sorry--I'm not hip to the whole Wiki thing yet. I'll take a look over there...
  • I imagine fcId is tied to an internal value that's changed by a content management system. Even if it changes a few times in a noticeable pattern, I don't imagine that it would be reliable forever. The only foolproof way I can think of retrieving the contents of a (or all of them) Just Added 'playlist' is by doing the following; 1. Retrieving the XML from viewPlaylistsPage without any parameters and storing the attribute of the ViewGenre element that matches your preferred genre(s). I don't imagine these would remain static for all time either, judging from the numbers; 2. For each genre id that was stored from step 1, load the XML from vewGenre?id=. Find the GotoURL element that contains the text Just Added and grab it's url attribute. Add on &batchNumber=0; 3. If you're fine with just one page being transformed, use the resulting XML for the transformation to RSS. Otherwise, store the album information that you want to keep from the page and look for the value 'X-Y of Z'. If Y and Z don't match, increment batchNumber and process the resulting XML. Repeat for other genres. It'd probably be best to cache the resulting RSS feed and let it live for at least 24 hours. With at least three to four round trips to determine the albums in a playlist without knowledge of the fcId values, I don't imagine it would be very responsive.
  • Nathan: Hrm... Yeah, that's the approach I was afraid that I'd have to end up taking, but it's probably the most reliable. Hmph.