DRM-Free iPlayer download link with iplayer-dl

I’m a big fan of BBC iPlayer. However, I’m not such a big fan of DRM-encumbered downloads, and the flash player doesn’t work on my netbook. For this reason, I use iplayer-dl, a clever little ruby app that pretends it’s an iPhone, and lets you download DRM-free versions on the videos.
The downside of this iplayer-dl is that it requires you to manually copy and paste the URL or ID of the video into the command line. I thought it would be handy if there was a link on the iPlayer page to download an episode through iplayer-dl.

After about an hour of messing, I was successful. The steps I followed are below. Please note that this is a VERY hacky solution, and probably isn’t the best way to do it, nor do I recommend anyone else does it this way. One stage of it potentially leaves your system vulnerable to attack.

  1. Install iplayer-dl
    This bit’s pretty straightforward, the instructions are on the iplayer-dl site linked above.
  2. PHP Script
    I run a local web server on my netbook for web development purposes. I created a script called iplayer.php in my public_html folder with code similar to the following:

    
    

    This code essentially generates a shell script which will open a gnome-terminal window (it could equally use Konsole, xterm etc), and runs the iplayer-dl with the specified parameters. It gets the show’s ID or URL from the query string.
    Note the Content-Type header. I haven’t actually included the Content-Type I used here, since I’ve told Firefox to open it in Bash automatically (remember the vulnerability I mentioned?). Suffice to say, I chose something fairly innocuous that I’m unlikely to ever come across on the web, so I won’t get weird things suddenly trying to execute in bash.

  3. Displaying a link to the PHP Script
    This piece of magic was done with the Greasemonkey Firefox extension, which is well worth a play with, especially if you’re good with Javascript. Long story short, it lets you define scripts to run automatically after certain pages have loaded, allowing to you edit how they look.
    I wrote a script to run on BBC iPlayer’s episode pages (the pages where the actually video player is displayed). It looks like this:

    var dlFlash = document.getElementById('download-air');
    dlFlash.innerHTML = '<a href="http://localhost/~mark/iplayer.php?id='+window.location+'" target="_blank">Download with iplayer-dl</a>';
    

    Obviously this exact script only works for me. If you did it yourself, you’d have to change the href to the location of your iplayer.php. Essentially all this script does it replace the normal download link on the page (Which tries download the video in BBC’s Adobe AIR-based client) with a link to my PHP script (effectively, to the shell script generated by the PHP). By a happy accident, it even keeps the icon and background of the download button, so it’s nice and aesthetically pleasing.

  4. Click the Link
    Clicking the link pops up the usual “What shall I do with this file?” dialogue. Now, I want as little faff as possible, so I set it to run with bash, and to do it every time without asking. This associates the MIME type I chose earlier with Bash, so in future all scripts produced from these links will open the download instantly. For this reason I didn’t use application/x-sh as the MIME type, as I didn’t want to accidentally click a link to a real shell script on another page and have it execute automatically! If you were happy to select bash and click “OK” each time you wanted to download from iPlayer, you could use this MIME type.

And that’s it! I’ve now got a handy DRM-free one-click download link on every iPlayer page.

Testing IE6, IE7 and IE8 on one machine

Just a quick post because I’ve found an amazingly useful application.
As a web developer, I’m constantly plagued by Internet Explorer and it’s non-standard behavior. Granted, IE 8 goes a long way to solve this, but all-too-often the places where I work (still!) use IE 6. This means that I build an app, test it on the “proper” browsers and IE 8 (in an Windows Virtual Machine), then take it to the client and they show me a whole load of rendering errors in IE 6. Windows won’t let you install 2 versions of IE, or downgrade from the one you’ve got, so I’m a bit stuck unless I want to run a seperate VM for each version.

The solution: IETester. This is a brilliant Freeware windows app that lets you open a series of tabs for the various versions of IE (5.5, 6, 7 and 8) to test the rendering and javascript engines side-by-side. It Just Works, and until IE 8 adoption is widespread (read: when people are forced to stop using XP), is a must for all web designers and developers!