Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

gnat (29)

gnat
  (email not shown publicly)

Journal of gnat (29)

Thursday May 08, 2003
04:56 PM

iTunes

[ #12082 ]
I spent a fun day yesterday with this gentleman, pulling the iTunes sharing protocol to pieces. Todd did all the hard work and I wrote some Perl code to implement it.

It turns out that iTunes sharing is just HTTP, as pudge observed. The problem is that you can't just make a single GET to download a file. You need to get a session ID, figure out which database you're accessing, and learn the unique ID of the song you want to download. And the responses from all these requests are DMAP files, a hideous binary pseudo-XML-with-types that's a turd to parse (I know because I've written three turds of parsers so far). The only thing I don't have sussed is authentication, but I believe that's easy to add.

I've got Quicktime and mpeg4 demoing the command-line shell for connecting, searching, and downloading files from someone else's iTunes. I'm not releasing the source, though, until I talk with Tim O'Reilly and Apple and figure out whether I'll be getting my arse sued off ...

--Nat

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • nicely done (Score:3, Interesting)

    by garron (1199) <dbrian@cpan.org> on 2003.05.08 23:31 (#19944) Homepage Journal

    I will never question your priorities Nat. A hacker to the end.

    Looking forward to a cookbook chapter on iTunes. ;)

  • Bravo! (Score:3, Insightful)

    by wickline (135) on 2003.05.09 6:26 (#19953) Journal
    You da man!

    Good luck with the legal schtuff :)

    -matt
  • Server (Score:3, Interesting)

    by pudge (1) on 2003.05.09 7:09 (#19958) Homepage Journal
    Don't forget the server code, so we can play via iTunes MP3s sitting on a server without iTunes on it. :-)

    I've wanted to work on this, I wish I had time to help out, but we are moving in about a month and I am doing my darndest to get Mac::Glue out. It is almost ready, too! Wooo!

    Have you seen iTunesdl [chalmers.se]? It's a Cocoa app that shows you a library and lets you download MP3s. No docs or source.

    Anyway, thanks for moving forward on this, we need it. If you decide you can't release it, maybe you can launder the source to someone else who can. :-)
    • Re:Server (Score:5, Informative)

      by gnat (29) on 2003.05.09 11:35 (#19968) Journal
      Todd's got his eye on the server side of things. My thought is that it should be possible to have an Apache::MP3 type module that pretends to be an iTunes server. I already checked and you can pass a port argument when you connect (my.hostname.com:3690 makes iTunes connect to port 3690).

      iTunesdl is cute. But with my code, you could mirror a remote iTunes database, write a gnutella-to-iTunes gateway (Rael suggested making gnutella look like an iTunes server), aggregate multiple iTunes servers through a proxy, etc.

      Also, Todd's now looking to find other dmap files on the system. For instance, the iTunes database and the databases on your iPod all seem to be some variant of dmap format. I'd love to be able to copy specific songs and albums back off my iPod without having to id3info every damn mp3 file. And of course, making your iPod available as an iTunes server is a very real possibility ...

      --Nat

      • Re:Server (Score:2, Insightful)

        I just want to get the playlist data so that I can manipulate it and show my library through a web browser. Present different views of my iTunes library. SO I am looking forward to your release of the perl code because I want to do this in PHP. Thanks for the efforts.
      • Re:Server (Score:2, Insightful)

        I'm working on a standalone daap server (daapd). An Apache module is a nice idea, though, and I just happened to think about proxies this morning, too :)

        I hope that I have something to release at the end of the weekend. Let me know how the legal issues turn out. Apropos O'Reilly: Rob Flickenger has done some work on the Rendezvous side [oreillynet.com] of things.

        I'm the guy with the daap wiki [deleet.de].