BBC iPlayer fix hacked again!

This morning, BBC News proudly announced the BBC’s victory over those of us who had figured out how to download their iPhone iPlayer streams:

The BBC has issued a fix to stop people downloading programmes from the iPlayer website that were intended for streaming on an iPhone or iPod only.

I am happy to announce that I’ve defeated them once again!

I’ve updated my script; here’s a link to download it. It only relies on Ruby now:


The progress indicator could stand to be improved, but I wanted to get something out there as soon as possible.

There are too many comments here now, so I’ve closed the discussion. Please head over to the Beebhack wiki to add your findings and tips!


  1. Mike Trim

    Wrote at 2008-03-13 21:42 UTC using Firefox on Linux:

    Nice one!

    For the progress indication, if you use print instead of puts (to avoid the newline) and prefix the second string with “r” (carriage return) it will overwrite the previous value.

    i.e. change puts ‘0%’ to print ‘0%’
    and change puts ”#{percentage}%” to print “r#{percentage}%”
  2. Paul Battley

    Wrote at 2008-03-13 21:51 UTC using Firefox on Linux:

    That’s a good idea! I’ve implemented it and updated the script here. It now reports progress in 0.1% increments to give better feedback.

    I usually use ruby-progressbar for this kind of thing, but wanted to avoid adding an unnecessary dependency.
  3. Matt

    Wrote at 2008-03-13 22:03 UTC using Firefox on Mac OS X:

    Didn’t take you long then?! Nice work again!
  4. Zezayer

    Wrote at 2008-03-13 22:09 UTC using Firefox on Linux:

    Nice Script, good to be downloading again so quickly. Thanks so much.
  5. Irregular Shed

    Wrote at 2008-03-13 23:12 UTC using Firefox on Linux:

    I knew I wasn’t going to get the time to get investigating – I got as far as looking at the Safari quirks before real life took over. I actually got a heads-up about something from someone within the BBC about techniques being used – it’s great being a focal point of the hack because you find all these people who are using it =)

    I’ll have a look through your code later, but in the meantime – good work!
  6. Irregular Shed

    Wrote at 2008-03-13 23:22 UTC using Firefox on Linux:

    Yes! Brilliant, I was on the right lines with what I’d got… Who da man? You da man! (ahem.)
  7. Paul Battley

    Wrote at 2008-03-13 23:24 UTC using Firefox on Linux:

    I didn’t have any inside information—the only contact I do have is on holiday at the moment. I used a dump from a proxied iPod Touch session to work it out.

    As you probably realise now, the random number hypothesis was wrong: the important changes appear to be the different user agent used by the media system, and the initial ‘Range: bytes=0-1’ header that the iPhone/iPod sends when it fetches a stream.

    It seems like they just relied on obscure quirks of the iPhone browser and media system; I don’t see how they can continue along this path with any real success.
  8. Luke Redpath

    Wrote at 2008-03-13 23:42 UTC using Safari 523.15 on Mac OS X:

    On the downside, there is a danger that they just end up pulling the iPhone-compatibility if they cannot successfully prevent people from downloading the files (and I agree with you, I can’t see how they can prevent anybody determined enough).

    It would be a bit of a P.R. disaster however.
  9. Ewan

    Wrote at 2008-03-14 00:50 UTC using Firefox on Linux:

    Nice going.

    I’m not sure whether the BBC even can pull the iPhone iPlayer, PR disaster or not; that deal with The Cloud might commit them to providing content as much as it commits The Cloud to providing the connection.

    Out of curiosity; if you’ve got an iPhone, is there anything that stops you downloading rather than streaming the files?
  10. Paul Maunders

    Wrote at 2008-03-14 08:17 UTC using Mozilla 1.9b4 on Mac OS X:

    Nice work Paul!

    Is there any chance you could put your script into a subversion repo? If this game of cat and mouse continues it would be nice to keep up-to-date with a simple “svn update”

    Although that’s just me being lazy :) It’s not too much extra effort to download it each time….
  11. Paul Maunders

    Wrote at 2008-03-14 08:29 UTC using Mozilla 1.9b4 on Mac OS X:

    It doesn’t seem to work for certain urls…

    [root@pablo iplayer]# ./ipdl
    /usr/lib/ruby/1.8/net/http.rb:1112:in `addr_port’: undefined method `+’ for nil:NilClass (NoMethodError)
    from /usr/lib/ruby/1.8/net/http.rb:1072:in `begin_transport’
    from /usr/lib/ruby/1.8/net/http.rb:1047:in `request’
    from /usr/lib/ruby/1.8/net/http.rb:1037:in `request’
    from /usr/lib/ruby/1.8/net/http.rb:543:in `start’
    from /usr/lib/ruby/1.8/net/http.rb:1035:in `request’
    from /usr/lib/ruby/1.8/net/http.rb:948:in `request_get’
    from ./ipdl:47:in `http_get’
    from ./ipdl:80
  12. Paul Battley

    Wrote at 2008-03-14 08:42 UTC using Firefox on Linux:

    Actually, it is in a subversion repository. I’ll post it here once I’ve backed up my repository (just in case the host is persuaded to take it down).

    I know that some programmes aren’t available to the iPlayer. It’s probably easy enough to add a check and give a more helpful error—I just haven’t done so yet.
  13. Stu

    Wrote at 2008-03-14 08:46 UTC using Firefox on Linux:

    I’m glad someone got a workaround for this already. I spent ages the other day working on a nice Firefox bookmarklet only to find that it didn’t work the next day.

    This is a great alternative.

    And as Irregular Shed said, it’s good to have a focal point of people who are interested in this.
  14. John Wards

    Wrote at 2008-03-14 08:54 UTC using iPhone on Mac OS X:


    Nice work on the fix but I am getting the error on all urls i have tried. I know that there are mp4s avaliabel on the urls I’m trying.

    `addr_port’: undefined method `+’ for nil:NilClass (NoMethodError)

    Any clue.

    Also do you want to break down for those who don’t understand Ruby how you’ve fixed it.

    I first thought it was just an other User Agent. But my quick experiments with libCurl and PHP seem to say otherwise and I’m not 100% sure I’m reading your ruby correctly (never looked at ruby before…well maybe a quick go on rails but who hasn’t ;0))
  15. Paul Battley

    Wrote at 2008-03-14 08:56 UTC using Firefox on Linux:

    John, can you give me an example of a URL that should work but doesn’t?
  16. Stu

    Wrote at 2008-03-14 09:13 UTC using Firefox on Linux:

    You could do with a newline at the bottom before the program exits so my $PS1 doesn’t appear on the same line as the “100%”

            print "\r#{percentage}%"
          io << data
          print "\n"

    Or something along those lines. It’d just tidy it up a little bit.

    Your commenting kept stripping out my less than symbols when I previewed the comment. :(

    Any news on the svn respository?
  17. Stu

    Wrote at 2008-03-14 09:14 UTC using Firefox on Linux:

    And my backslashes. :(
  18. Paul Battley

    Wrote at 2008-03-14 09:17 UTC using Firefox on Linux:

    Yeah, sorry about that. Textpattern sucks for posting code! I’ll fix it up.
  19. John Wards

    Wrote at 2008-03-14 09:19 UTC using iPhone on Mac OS X:

    /usr/lib/ruby/1.8/net/http.rb:1109:in `addr_port’: undefined method `+’ for nil:NilClass (NoMethodError)
    from /usr/lib/ruby/1.8/net/http.rb:1069:in `begin_transport’
    from /usr/lib/ruby/1.8/net/http.rb:1044:in `request’
    from /usr/lib/ruby/1.8/net/http.rb:1034:in `request’
    from /usr/lib/ruby/1.8/net/http.rb:543:in `start’
    from /usr/lib/ruby/1.8/net/http.rb:1032:in `request’
    from /usr/lib/ruby/1.8/net/http.rb:945:in `request_get’
    from ./iplayer-dl:47:in `http_get’
    from ./iplayer-dl:80
  20. Stu

    Wrote at 2008-03-14 09:19 UTC using Firefox on Linux:

    I’d put the bloody newline on the wrong line anyway. For shame.
  21. Stu

    Wrote at 2008-03-14 09:21 UTC using Firefox on Linux:

    John: That download runs just fine for me.

    stu@stu-laptop:~$ ./iplayer-dl
  22. Paul Battley

    Wrote at 2008-03-14 09:22 UTC using Firefox on Linux:

    John, that URL works for me. What version of Ruby are you using?
  23. Stu

    Wrote at 2008-03-14 09:25 UTC using Firefox on Linux:

    Ooh, since you can edit comments could you do me a favour and put the “print” line underneath the “end” line in my comment? Otherwise anyone who makes that change will get a newline far more often than they would normally expect. :)

    Thanks Paul. :)
  24. Alex MacCaw

    Wrote at 2008-03-14 09:31 UTC using Firefox on Mac OS X:

    John Wards: That url works for me – are you in the UK?
  25. Paul Battley

    Wrote at 2008-03-14 09:31 UTC using Firefox on Linux:

    I’ve updated the script with your suggestion—in the right place :-)
  26. Paul Maunders

    Wrote at 2008-03-14 09:31 UTC using Mozilla 1.9b4 on Mac OS X:

    Thanks Paul, looking forward to getting via svn!

    Since you have written the most elegant solution to the iplayer mp4 download problem (far easier than some of the other bookmarklet based methods), I would agree that your blog is a perfect “focal point” for this topic!

    I have a feature request:

    Currently if you were to download, for example, Eastenders, the auto-naming function would call the file EasterEnders.mp4 – could you modify it slightly so that it includes the date e.g.


    That way really lazy people can just download straight from the URL without having to worry about re-naming files that might otherwise conflict (multiple episodes in a series).
  27. John Wards

    Wrote at 2008-03-14 09:35 UTC using Firefox on Linux:

    Erm…its working now?! I tried using http-access2 but that didn’t work as a drop in replacement so i just put back in net/http and saved.

    Ran it again just to check and its working.

    How odd!

    But good work. Now its working time to figure out how you did it :D
  28. mr ed

    Wrote at 2008-03-14 09:46 UTC using iPhone on Mac OS X:

    running ubuntu here.
    awesome. works for me. thanks for the script.
  29. Strawp

    Wrote at 2008-03-14 09:58 UTC using Firefox on Windows XP:

    Hi Paul,

    You can get more programme info from the XML programme data files – you can then use this to create a more comprehensive filename to save to.

    See my script for URLs etc:
  30. Irregular Shed

    Wrote at 2008-03-14 10:00 UTC using Firefox on Windows XP:

    Can I suggest that, instead of saving files as .mp4, they are saved as .mov – the Beeb are actually using Quicktime containers with an incorrect file extension. While superior media players like VLC don’t care, lesser players (Quicktime for Windows) baulk at the files and cry in their milk.

    Congrats on the BoingBoing-ing – your bandwidth’s not going to be the same for a few days!

    FWIW, the Beeb insider was careful to merely suggest that looking at the behaviour and quirks of Safari and Quicktime on the iPhone/iPod Touch would be a good way to go.

    What can they do to fix this? I’ve got a good idea, but I’m not going to say in public. It’d save them frittering more money away on consultants, and whilst they do that they can’t spend money on anything more to do with “Two Pints Of Sodding Lager and a Packet of Is This Still On?”
  31. Stu

    Wrote at 2008-03-14 10:04 UTC using Firefox on Linux:

    The following code should put the subtitle of the show after the title in the name. Just put the second line pasted below after the first line and it should be good to go. (You’ll probably have to wait for Paul to sort out all the missing backslashes before you can use it.) Or you can find it at Pastebin for the time being.

    The gsub is to replace any forward slashes that appear in shows like Eastenders with dots. This will retain the date format and stop the script from looking for a directory that doesn’t exist. There’s probably a nicer solution, but this one works for now. :)

    # The only information we really need is the pid
    pid = html[/\bpid[ \t]+:[ \t]+'([a-z0-9]+)'/, 1]
    title ||= html[%r!<title>([^<]+)</title>!, 1].split(/ - /).last
    title << " - " << html[%r!<h2>([^<]+)</h2>!, 1].gsub!(/\//, '.')
  32. TJ

    Wrote at 2008-03-14 10:15 UTC using Firefox on Linux:

    Hm, I seem to get the same errors as John (trying to get the Horizon show here:
  33. TJ

    Wrote at 2008-03-14 10:17 UTC using Firefox on Linux:

    (FWIW, John’s link works.)
  34. John Wards

    Wrote at 2008-03-14 10:18 UTC using iPhone on Mac OS X:

    I’m using the PHP version now. So if it does break at least I can figure out whats causing it…
  35. TJ

    Wrote at 2008-03-14 10:18 UTC using Firefox on Linux:

    (Just weird, seeing as it says “Downloads Unavailable” .. thought they’d prevent all downloads?)

    ‘nuff from me. Happy easter.
  36. Stu

    Wrote at 2008-03-14 10:24 UTC using Firefox on Linux:

    Paul, there’s only one “less than” symbol in the comment you’ve so kindly edited for me. There should be a 2. :)

    Thanks for taking the time to edit it for me though. It’s greatly appreciated.
  37. Paul Battley

    Wrote at 2008-03-14 10:27 UTC using Firefox on Mac OS X:

    How’s that?
  38. Stu

    Wrote at 2008-03-14 10:32 UTC using Firefox on Linux:

    That’s just right, thanks.

    So, how long until this hole is patched? I think before the end of the day.
  39. Paul Battley

    Wrote at 2008-03-14 10:35 UTC using Firefox on Mac OS X:

    I don’t know: it took them a few days to patch it last time, and it only took us half a day to break it.

    I’m sure they’ll try, though. I suspect we’ve ruined someone’s weekend! ;-)
  40. John Wards

    Wrote at 2008-03-14 10:38 UTC using iPhone on Mac OS X:

    Hope they do it by the end of the day.

    Give us something to do with our weekend.

    I’m shocked that its as simple as the Quicktime user agent. Did they think we’re that stupid?
  41. Paul Battley

    Wrote at 2008-03-14 10:39 UTC using Firefox on Mac OS X:

    Updated with suggested subtitle and .mov changes.
  42. Paul Battley

    Wrote at 2008-03-14 10:40 UTC using Firefox on Mac OS X:

    John, it wasn’t just the user agent. The Range header sent by CoreMedia also seems to be necessary.
  43. MrMond

    Wrote at 2008-03-14 10:41 UTC using Internet Explorer 6.0 on Windows XP:

    I downloaded the script and have ruby installed under windows.
    How do I actually use this ?
    Sorry for such a newbie qustion but the file downloads as a txt file if I right click & save as.
    How do I actiually open it in IE or firefox and spoof the broswer ?
  44. John Wards

    Wrote at 2008-03-14 10:45 UTC using iPhone on Mac OS X:

    Yeah just going through the PHP version and spotted that.

    I’m guessing your going to need an iPhone and a packet sniffer to hand if they try and get around this again.
  45. Stu

    Wrote at 2008-03-14 10:49 UTC using Firefox on Windows XP:

    MrMond: I’ve not tried it in Windows but can’t see why it wouldn’t work. You could save it as iplayer-dl.rb and then it’ll possibly work if you double-click on it if your Ruby on Windows is the same as mine.

    Failing that you can open a command line and go to the directory where the iplayer-dl script is saved and run:

    ruby iplayer-dl

    You can get to the command line by going to the start menu, clicking on All Programs, then Accessories near the top. There should be a black icon in there named “Command Prompt” which is what you want. You can change directory using the ‘cd’ command.

    Hope this helps.
  46. Stu

    Wrote at 2008-03-14 10:58 UTC using Firefox on Windows XP:

    Having said all that I realise that if you double-click on the file named iplayer-dl.rb then you’ll get a terminal for a second while the script exits because it has no arguments. :(

    It could be written to prompt for a URL if run without arguments, I suppose.

    Perhaps it’d be worth it for ease of use.
  47. Irregular Shed

    Wrote at 2008-03-14 11:12 UTC using Firefox on Windows XP:

    I’ve installed Ruby on my work PC (Windows XP) – and it’s downloading a programme I knew was there for iPhone (Saturday’s Love Soup). Smart stuff. Kudos again, Paul.

    That Horizon link fails, same as others have mentioned. If I didn’t have mortgage-paying work to be getting on with I’d be picking it apart…
  48. Stu

    Wrote at 2008-03-14 11:15 UTC using Firefox on Windows XP:

    Ok, made the change. It does get rid of the usage message, but it’s still straight-forward and more useful for Windows users.

    As before you can either go to this pastebin page or you can make the changes below, if Paul would be so kind as to format them correctly once again. :)

    unless page_url
    puts “Download DRM-free videos from the BBC iPlayer, courtesy of their iPhone interface.”
    puts “Usage: #{$0} URL”
    puts “Where URL is the iPlayer viewing page.”
    exit 1

    unless page_url
    print “Enter the URL: ”
    page_url = gets

    Then the user will be prompted for the URL. The only down-side I’m spotting for windows users is that you can’t copy and paste into a Ruby window. At least, I can’t seem to. If you type it out it will work though. Just make sure you save the iplayer-dl file as iplayer-dl.rb and have Ruby installed.
  49. Irregular Shed

    Wrote at 2008-03-14 11:20 UTC using Firefox on Windows XP:

    Ooh, just noticed an error with the renaming – it tried to rename the file “Love Soup: Series 2 – Integrated$DATA” on this Windows box, and (remarkably) succeeded in doing so, making a file that can’t be accessed by anything other than “del Love*” (to get rid of it). It also made a zero-byte file called “Love Soup”. Not being a Ruby coder, I’m not sure where the problem lies – I could probably cobble something together to strip out the first colon, but the one appended after the file extension I’m not so sure about.
  50. Stu

    Wrote at 2008-03-14 11:21 UTC using Firefox on Windows XP:

    I’m the double-post king. I just remembered that the paste option is available. If you right click on the bar at the top of the Command Prompt window and go to the Edit menu it’s the third option down.

    I’ll go get my eyes tested.
  51. Paul Battley

    Wrote at 2008-03-14 11:25 UTC using Firefox on Mac OS X:

    Irregular Shed: I’ve fixed that by removing everything that’s not alphanumeric, hyphen, or space.
  52. Stu

    Wrote at 2008-03-14 11:27 UTC using Firefox on Windows XP:

    I was just going to suggest that. Filenames are such a bother sometimes. Things you can have on one system you can’t have on another. Different versions of windows supported different characters in file names. It’s amazing that they couldn’t just come up with a way of allowing any character so long as it’s enclosed in some sort of tag or something.

    Good solution though. People can rename files easily enough.
  53. MrMond

    Wrote at 2008-03-14 11:31 UTC using Internet Explorer 6.0 on Windows XP:

    the script seems to be working in that I get prompted for a url.
    If for example I try

    then it responds with
    c:/ruby/lib/ruby/1.8/net/http.rb:564:in `initialize’: No connection could be mad
    e because the target machine actively refused it. – connect(2) (Errno::ECONNREFU
    from c:/ruby/lib/ruby/1.8/net/http.rb:564:in `open’
    from c:/ruby/lib/ruby/1.8/net/http.rb:564:in `connect’
    from c:/ruby/lib/ruby/1.8/timeout.rb:48:in `timeout’
    from c:/ruby/lib/ruby/1.8/timeout.rb:76:in `timeout’
    from c:/ruby/lib/ruby/1.8/net/http.rb:564:in `connect’
    from c:/ruby/lib/ruby/1.8/net/http.rb:557:in `do_start’
    from c:/ruby/lib/ruby/1.8/net/http.rb:546:in `start’
    from c:/ruby/lib/ruby/1.8/net/http.rb:1044:in `request’
    from c:/ruby/lib/ruby/1.8/net/http.rb:957:in `request_get’
    from G:/iplayer-dl.rb:47:in `http_get’
    from G:/iplayer-dl.rb:79
  54. John Wards

    Wrote at 2008-03-14 11:46 UTC using Firefox on Linux:

    Ashes for ashes doesn’t have an iphone stream.

    How I’ve found the best way to check is using the original firefox user agent switcher “hack” to browse the iplayer site. this way you can see if a program has been encoded to work with the iphone.

    I have to say I am starting to notice that programs that sell many DVDs don’t seem to be encoded for iplayer….

    So thats Ashes to Ashes and touchwood…
  55. Strawp

    Wrote at 2008-03-14 11:48 UTC using Firefox on Windows XP:

    I’ve just found in the curl options that it has a really comprehensive transfer monitor built in which is turned off by default in PHP, so I’ve turned that on and change the extension to ”.mov” as per Irregular Shed’s recommendation.
  56. Strawp

    Wrote at 2008-03-14 11:50 UTC using Firefox on Windows XP:

    Yeah, I noticed that with last week’s Ashes to Ashes ep, which is a shame because Mitchell and Webb and Ashes To Ashes are the only things I’m watching on TV at the moment and they clash!

    I can always just default to torrents anyway…
  57. MrMond

    Wrote at 2008-03-14 11:54 UTC using Internet Explorer 6.0 on Windows XP:

    no to worry, is me.
    Didn’t realise what part of the link to paste in.
    First 3 files I tried get error same as others but now have grabbed a few files so it’s ok.
    Thanks for the help,will just have remember it’s trial & error to find a program thats not blocked.
    Wonder why. Was the first script before it got blocked the same or could everything be retreived ?
  58. Strawp

    Wrote at 2008-03-14 11:56 UTC using Firefox on Windows XP:

    MrMond: It was the same before. As noted in another comment, they’ve quite sensibly not enabled this for programmes which they expect to get good DVD sales.
  59. Irregular Shed

    Wrote at 2008-03-14 11:57 UTC using Firefox on Windows XP:

    They have had Ashes to Ashes on, though, because I re-encoded it for my 5th Gen iPod. Same with Mitchell and Webb – I’ve got an episode on my desktop. They seem to be choosing programmes completely randomly…

    I’ve just had a thought – any bets that from now on the only iPhone streams will be dire daytime TV to put us off? “This episode of Homes Under The Hammer really shows off the strength of the iPhone!”
  60. John Wards

    Wrote at 2008-03-14 12:06 UTC using iPhone on Mac OS X:

    Strawp: Thats a nice feature of curl. Good spot.
  61. Jon Creasey

    Wrote at 2008-03-14 12:08 UTC using iPhone on Mac OS X:

    Seems theyv’e taken all the downloadds down as all I get is downloads not available
  62. MrMond

    Wrote at 2008-03-14 12:11 UTC using Internet Explorer 6.0 on Windows XP:

    I understand,didn’t read properly.
    Anyone else tried jonathon ross. I get the progress to 100% but have a 0 size file without the .mov extension which other files had. ?
  63. Paul

    Wrote at 2008-03-14 12:12 UTC using Safari 525.9 on Mac OS X:

    So how long do you think it will be before your oh-so wonderful efforts force the BBC to take the service down and deprive those of us who enjoyed it and found it useful.
  64. John Wards

    Wrote at 2008-03-14 12:20 UTC using iPhone on Mac OS X:


    The BBC have said that its technically not possible or technically not viable to provide DRM free video in any other format that flash for other platforms.

    What has been shown is that they are talking rubbish.

    Why should they lock the iPlayer down to a minority mobile platform? There is a demand for this if not the BBC wouldn’t be making their “bug fix” a proper story on the tech section of the news site. They would have buried it in their blogs.
  65. iPlayer

    Wrote at 2008-03-14 12:21 UTC using Internet Explorer 6.0 on Windows XP:

    We’re not sure Paul.
  66. PhillC

    Wrote at 2008-03-14 12:23 UTC using Firefox 2.0 on Windows XP:


    I doubt very much whether the BBC will ever “take down” the iPlayer service. They’ve spent too much money on it and it is too high profile. All they are likely to do is keep trying to block non-DRM downloads.

    Regarding available programmes, I was pleasantly surprised this morning to see that the Qatar MotoGP was available as an MP4 file. I was surprised this was even on iPlayer to begin with!

    Ashes to Ashes is also available to purchase via iTunes after the iPlayer 7 day period. Given this information, it’s probably no surprise that it’s not an MP4 for free on iPhone.
  67. Paul Battley

    Wrote at 2008-03-14 12:25 UTC using Firefox on Mac OS X:

    Paul, I understand what you’re saying. Really. I may have been the first to publish a workaround, but it wasn’t hard, and anyone could have worked it out.

    The BBC just haven’t thought this one through. After arguing the case for DRM, and proprietary download technologies, their enthusiasm for the iPhone seems to have got the better of them.

    It never could have done what they wanted it to do.

    I’m really suspicious of their motivation in making it available for the iPhone. The only method that they offer for other platforms requires proprietary software (and while Flash works on x86 Linux, it’s very flaky). Yet when the iPhone doesn’t support this tied-down system, they abandon their previous caution and go right ahead with an unrestricted version.
  68. Stu

    Wrote at 2008-03-14 12:26 UTC using Firefox on Windows XP:

    MrMond: I can get the Jonathan Ross show perfectly well. Are you using the latest version of the script and the latest version of Ruby?

    Paul #3: I highly doubt the BBC will withdraw the service. They’ll just think up a new way to restrict it.

    Even if they do take it away entirely you could resort to old-fashioned methods and just use your regular TV anyway. If you record it with a VCR or DVR then it’s yours forever.

    And also, they’re already depriving people from access. This oh-so wonderful effort is hopefully demonstrating that there’s a demand for the service on platforms. Someone running Windows can have access for 30 days, someone running Linux can have access for 7, at a lower quality.
  69. Jon

    Wrote at 2008-03-14 12:38 UTC using Internet Explorer 6.0 on Windows XP:

    All we need now is another script that can actually provide a list of available downloads
  70. Paul Battley

    Wrote at 2008-03-14 12:39 UTC using Firefox on Mac OS X:

    Jon: like this?
  71. Strawp

    Wrote at 2008-03-14 12:54 UTC using Firefox on Windows XP:

    Ooh, that could be quite fun :)

    Call the download script without args to be presented with a menu to select a programme to download?
  72. mrmond

    Wrote at 2008-03-14 13:18 UTC using Internet Explorer 6.0 on Windows (?):

    I think I have the latest.
    copied the script from your earlier link. there was other stuff below I didnt copy.
    Ruby is definately the latest version
  73. Stu

    Wrote at 2008-03-14 13:24 UTC using Firefox on Linux:

    This is the version I’m using for myself. It works for everything I’ve tested that is actually available for the iPhone.

    Are you pasting the full URL, or just up to the ”.shtml” I don’t know if it would make any difference. It probably shouldn’t, but might be worth a try.
  74. Stu

    Wrote at 2008-03-14 13:27 UTC using Firefox on Linux:

    Actually, this one!

  75. Ed

    Wrote at 2008-03-14 13:42 UTC using Firefox on Mac OS X:

    Great job. Just tried it with ruby on OS X Leopard and it’s working happily away. Well done, was going to attempt this myself over the weekend, so I’m glad someone else has done it to save me the time :)

    Now we need a GUI :)
  76. Stu

    Wrote at 2008-03-14 13:45 UTC using Firefox on Linux:

    I decided to do something about the attempted downloading of files that are unavailable to iPhones.

    The latest version I’ve uploaded checks to see if the file is available in mp4 format by checking the javascript embedded on the page. If it’s not then the script exits gracefully rather than just collapsing in a heap. :)

    I’d paste the code I’ve added here, but it wouldn’t be formatted correctly anyway.

    The new section has a comment above it saying:

    # See if the mp4 version is available

    If you add that section to your current script it should work just fine.
  77. Irregular Shed

    Wrote at 2008-03-14 14:02 UTC using iPhone on Mac OS X:

    Another problem URL:

    I get the “No connection could be made because the target machine actively refused it.” error. There’s an MP4 there, though – visiting the page as an iPhone shows the big blue Q and the Javascript lists its expiry time and date. I’ve tried both Windows and Linux platforms…
  78. brotherian

    Wrote at 2008-03-14 14:13 UTC using Safari 523.12.2 on Mac OS X:

    This is amazing. Downloading Wonderland as I type, thank you Paul for putting your time and energy into this.

    Is there an easier way of deploying this fabulous script in mac osx? i’m on tiger but using the comand line in Win2K running under parallels to get this puppy to work, surely i’m going round the houses a little here?

    Of course, a GUI would be, ahem, AWESOME!!!!

  79. mark boyce

    Wrote at 2008-03-14 14:29 UTC using Firefox on Windows XP:

    hi, how would I go about running this script?
  80. Ed

    Wrote at 2008-03-14 14:51 UTC using Firefox on Mac OS X:

    If you’re on OS X Leopard, Ruby is built in.

    You can just open the terminal
    Use cd to get to the directory where it is (e.g. cd ~/Documents)
    Type: chmod 777 iplayer-dl
    Type: ./iplayer-dl [YOUR URL HERE]

    If you don’t have have Leopard, you might want to try – I’ve not tried it, but it looks simple. If that doesn’t work, try MacPorts….
  81. Andy

    Wrote at 2008-03-14 16:45 UTC using Firefox on Linux:

    Mark: For other OSs (not OSX), read the comments above – it’s all been explained. In short, save the script as iplayer-dl.rb, then open a terminal and run it as such:
    ruby iplayer-dl.rb URL
    where URL is the url of the programme you want to download. Should work in either Linux or Windows once ruby is installed.

    Excellent script, much easier than the method I was using with bookmarks and so forth a couple of days ago. Thanks!
  82. Jay

    Wrote at 2008-03-14 16:58 UTC using Firefox on Windows XP:

    It’s all fine and dandy at the xp command line and you can paste into the window – click on the command icon (top right) and find the edit submenu – paste
  83. pup

    Wrote at 2008-03-14 18:04 UTC using Internet Explorer 6.0 on Windows XP:

    i dont want to sign up just to make a simple anonymous comment on the thread so its good you let me in here, free ;)

    i just wanted to say after reading the above, your ruby is cool and all that but its not a stand alone app and takes load of space ,not that thats a bad thing sometimes…

    however, this BBC thing NEEDS a super small stand alone GUI app so as to reach far more people and help them out..

    while im not a script writer i do follow lots of these things and it seems REBOL and it VIEW GUI scripting language is perfect for taking this BBC MP4 cross platform playing to a totally new level if your a good script writer.

    rebol core and rebol view runs on almost everything, its mega small and stand alone.

    the rebol view part is something like 600k total and yet has everything you might need for TVP/IP and UDP work and creating a GUI script that runs on all the platforms

    anyone used or willing to try rebol view to make a super small url parsing,processing,extracting,,download,renaming and passing to video app GUI ;)

    its scripting for the new age even if its been around a very long time but noones really tryed it seriously to make generic GUI’s.

    the backroom boys have used rebol for may years but dont really like GUIs so its more than capable but noones bothered to write them, and thats a real shame.

    convert YOUR RUBY TO REBOL and make loads of non programers real happy please….

    examples from the onliners

    REBOL in One Line (One-liners)
    REBOL has a long history of one-liner programs. Here are 45 examples one-liners that were submitted by REBOL users.

    One-liners are like Haiku poetry. Not always practical, not always readable, they are fun to write. As with any art, some are better than others, but from time-to-time, a true gem pops up.

    To try one, just cut and paste the code into the REBOL console.

    See other notes at end.

    1 – Print web page sourceprint read

    Summary: Very simple. Prints to the console the HTML source for a web page.
    Author(s): RT
    Length: 31 characters

    2 – Open a GUI, read web page, sent it as emailview layout [u: field “” h: field “http://” btn “Send” [send to-email u/text read to-url h/text alert “Sent”]]

    Summary: This example opens a window that displays a GUI form. You can input an email address and a web page URL. REBOL then sends the contents of that web page to that email address. Note that you must have your SMTP email configured in REBOL (in View’s User preferences).
    Author(s): Carl Sassenrath
    Length: 125 characters

    3 – FTP upload all filesforeach file load %./ [if not dir? file [write/binary join file read/binary file]]

    Summary: Uploads all the files in a directory using FTP. Files can be text, images, web pages, anything… but not directories.
    Author(s): RT
    Length: 111 characters

    4 – TCP port scannerrepeat n 100 [if not error? try [close open probe join tcp://localhost: n] [print [n “is open”]]]

    Summary: This is a simple port scanner. Given a TCP address, it will tell you which of the first 100 ports are accessible. The address can be a host name or number. The localhost name will scan ports on your own machine. You can scan more ports by increasing the number (from 100), or you can scan ranges by using a FOR loop rather than REPEAT.
    Author(s): Anonymous
    Length: 98 characters

    5 – Remove last item of a series (list, string, etc.)remove back tail list

    Summary: This line removes the last item from a block, string, or any series. It is more of an idiom, but worth posting.
    Author(s): RT
    Length: 21 characters

    6 – Save web page text to a fileremove-each tag page: load/markup [tag? tag] write %page.txt page

    Summary: This line reads a web page, strips all its tags (leaving just the text) and writes it to a file called page.txt. Note: requires newer releases of REBOL.
    Author(s): Carl Sassenrath
    Length: 87 characters —————————————————————-

    rebol user agent:

    rebol parsing urls gui

    rebol referer info

    ruby to rebol
  84. pup

    Wrote at 2008-03-14 18:17 UTC using Internet Explorer 6.0 on Windows XP:

    so the rebol view parsing and gui idea was a no go then?, shame.
  85. James Muscat

    Wrote at 2008-03-14 18:43 UTC using iPhone on Mac OS X:

    Trying to use the latest script ( to download the latest episode of Horizon from fails:

    $ ./iplayer-dl
    /usr/lib/ruby/1.8/net/http.rb:1109:in `addr_port’: undefined method `+’ for nil:NilClass (NoMethodError)
    from /usr/lib/ruby/1.8/net/http.rb:1069:in `begin_transport’
    from /usr/lib/ruby/1.8/net/http.rb:1044:in `request’
    from /usr/lib/ruby/1.8/net/http.rb:1034:in `request’
    from /usr/lib/ruby/1.8/net/http.rb:543:in `start’
    from /usr/lib/ruby/1.8/net/http.rb:1032:in `request’
    from /usr/lib/ruby/1.8/net/http.rb:945:in `request_get’
    from ./iplayer-dl:47:in `http_get’
    from ./iplayer-dl:90

    Viewing the site in Firefox with a iPlayer ident seems to indicate that the show should be available.
  86. hdskifreak

    Wrote at 2008-03-14 20:03 UTC using Firefox on Windows XP:

    I wanted to provide an update for the people having the exception on the http_get:

    I’m in the US, so that might have something to do with it.

    The problem is actually related to a previous request to get the PID. I edited the script to spit out the responses from the server, and the last response reads:


    This, in turn, causes the html address() call to return a null, and that causes the stack trace seen.

    Is it because of my location, or is it a bug?

    Thanks for the great effort, and best regards.
  87. ged

    Wrote at 2008-03-14 20:32 UTC using Safari 523.15 on Mac OS X:

    Forgive my ignorance, I am a newbie at this! When I click on the link I just get a page of text/commands. What do I do with it to get the hack to work. I am using osx 10.5.2.
  88. Paul Battley

    Wrote at 2008-03-14 20:45 UTC using Firefox on Linux:

    hdskifreak, that’s because you’re in the US. You can get around client restrictions, but not geographic ones (without a shell or proxy in the UK, at least).

    ged: To run it on OS X, see Ed’s comment above.
  89. Terence Eden

    Wrote at 2008-03-14 22:54 UTC using Firefox on Linux:

    Just to say, I’ve got this working on an Xbox running Xebian Linux – I’ve another Xbox running XBMC streaming the content off the first.

    Great stuff! Many thanks
  90. Simon

    Wrote at 2008-03-14 23:01 UTC using Firefox on Linux:

    Nice work! still works as well… Similar script, done in perl.
  91. David Attenborough

    Wrote at 2008-03-15 02:31 UTC using iPhone on Mac OS X:

    Thanks again to Paul-san for updating the script.

    Interesting that the torrent sites don’t seem to have any of these mp4/mov files from the web, but do have lots of stuff that has been broadcast

    Another sign that Digital Restrictions Madness isn’t required.
  92. Stu

    Wrote at 2008-03-15 11:50 UTC using Firefox on Linux:

    I don’t think you’ll see these on torrent sites. They’re lower quality than most TV rips. Plus, I imagine the people downloading them are only doing so for their own use. :)
  93. lescombes

    Wrote at 2008-03-15 12:26 UTC using Opera 9.25 on Linux:

    Gr8 work
  94. Hmmm...

    Wrote at 2008-03-15 13:16 UTC using Internet Explorer 7.0 on Windows XP:

    Sorry to be so dim!
    But can someone explain how to ‘run’ this script?
    (I’m on a Windows machine)

    I want to be able to view a program on my second monitor in ‘full screen’ mode – and continue to use my other monitor, at the moment the streaming iplayer doesn’t allow this so I’m hoping this script may overcome this.

  95. Daniel PETERS

    Wrote at 2008-03-15 13:47 UTC using Safari 523.12.2 on Mac OS X:

    Hi can someone please tell me in laymens terms how to download this video from the link below so i can put it on our youtube page or ipod touch
  96. Alexander Hanff

    Wrote at 2008-03-15 14:56 UTC using Safari 419.3 on Mac OS X:

    I can’t seem to get this (I am in the UK) to work. I get this error everytime:

    paladine@main:~/Videos$ ./iplayer-dl b00934×7 2Pints
    /usr/lib/ruby/1.8/net/http.rb:1109:in `addr_port’: undefined method `+’ for nil:NilClass (NoMethodError)
    from /usr/lib/ruby/1.8/net/http.rb:1069:in `begin_transport’
    from /usr/lib/ruby/1.8/net/http.rb:1044:in `request’
    from /usr/lib/ruby/1.8/net/http.rb:1034:in `request’
    from /usr/lib/ruby/1.8/net/http.rb:543:in `start’
    from /usr/lib/ruby/1.8/net/http.rb:1032:in `request’
    from /usr/lib/ruby/1.8/net/http.rb:945:in `request_get’
    from ./iplayer-dl:47:in `http_get’
    from ./iplayer-dl:61
  97. pup

    Wrote at 2008-03-15 15:56 UTC using Internet Explorer 6.0 on Windows XP:

    @ daniel

    as ed said for OSx, you download the script somewere.

    make it readable and executable

    cd to script dir and in the shell/cli/command prompt type

    ./iplayer-dl [YOUR URL HERE]

    all in line line, as in:
  98. pup

    Wrote at 2008-03-15 16:04 UTC using Internet Explorer 6.0 on Windows XP:


    your cant give it a name string, you need to give it the full URL and it will name it automaticly.

    as the example for daniel above
  99. Samtek

    Wrote at 2008-03-15 16:06 UTC using Mozilla 1.9b5pre on Linux:

    This script is awesome :D. It has removed the need for bittorrent when I miss BBC programmes. Thanks so much!

    To the last poster; I believe you need to use the full url such as “”. This works for me anyway.
  100. pup

    Wrote at 2008-03-15 16:31 UTC using Internet Explorer 6.0 on Windows XP:


    the scripts not made to stream, its made to download the whole file.

    for you , i assume you dont already have ruby (what this scripts written in) installed , so go to
    and grab the latest windows ruby install

    download the ruby script and put it somewere
    then just find the URL for the program you want , open a windows shell/cli/command prompt

    start/run and type

    then cd to the ruby script dir

    and type your
    ruby.exe iplayer-dl [YOUR URL HERE]

    the windows ruby i installed (an old one)didnt fill in the paths to the ruby install and i havent got around to re-booting sorting that out.

    i just did the lazy and put the iplayer-dl in the /bin dir of the windows ruby exe , Ohhhh

    your next part would be taking this downloaded MP4/mov video and playing it in your fave video app such as VLC,MPC or Mplayer, dragging that app to your other screen(s) toplay it.

    OC if some good coder/scripters took a look at the rebol i posted about above, and converted this ruby to rebol script, you wouldnt need to install ruby or anything other than the small rebol/view exe and the download script…..

    a rebol script would be able to be extended to pass any videos you had to these apps and much more, if only someone would take a look.
  101. pup

    Wrote at 2008-03-15 17:30 UTC using Internet Explorer 6.0 on Windows XP:

    this might seem like a silly question, but how do you get the right url to use for the program you want?. for instance.
    is it simply the last part, the pid=whatever, added to the generic

    plus .shtml

    so that search above, assuming its available for the pod would be
    for that first one and
    for the second ?,

    is that right and if not can you put me on the right track, did i use the wrong search URL and need one for the Ipod instead?....
  102. Jude Andrews

    Wrote at 2008-03-15 18:08 UTC using Internet Explorer 7.0 on Windows XP:

    How do I save a BBC iplayer file, that is already in my iplayer library, from being deleted? It has 4 days to go. I have copied it to my hard drive via windows media player and written it to a CD. I am worried that it will have an expiration programme embedded within it and that it will be deleted from my hard drive after 4days and that the CD will not play after 4 days.
  103. Arctic

    Wrote at 2008-03-15 18:14 UTC using Firefox 2.0 on Linux:

    Wonderful! Thank you, thank you, thank you! This is a godsend! And it’s so easy to use!
  104. Mike Trim

    Wrote at 2008-03-16 00:11 UTC using Firefox on Linux:

    pup: I don’t quite see what advantage this (closed-source) REBOL thing has over Ruby. If it’s a GUI you are wanting then it is quite feasible to do that in Ruby, although probably not worth the effort if the Beeb are going to continue playing cat and mouse.
  105. Nas

    Wrote at 2008-03-16 03:40 UTC using Safari 523.15 on Mac OS X:

    You’re only gonna end up killing the great service. STOP spoiling it for the rest of us. Just watch the F***ing thing, why do you need to download it.
  106. pup

    Wrote at 2008-03-16 03:59 UTC using Internet Explorer 6.0 on Windows XP:

    thanks for taking the time to reply at least Mike.

    rebol core and rebol view have always been free for personal use but ignoreing that aspect,if you look, you will see that infact the newest rebol R3 is open code, the only part that they will keep closed is the core kernel, everything else is fully open todo with as you please and improve.

    the bigest difference if you have a play with it is infact the size of even the largest rebol view GUi at 600k as apposed the basic ruby i just installed that takes 80megabytes, and thats with out any fancy GUI parts as far as i know.

    likei say, im not a coder/scripter so cant write you a working exaple of how it might be used, but take a look
    and you will see for yourself how small and yet perfect for GUI interactive TCP:IP UDP,even multicasting and tunnels have been written.

    some example GUI elements

    loads of scripts covering almost every aspect

    you can even write games and apps in rebol script and play them in your browser

    i like this 8kbyte Arkanoid game my self

    with just a quick flip through these links , id hope its clear why id like a scripted GUI made with rebol view, its more than powerful enough, and way smaller and easyer to use crossplatform then the other scripting languages.

    cant get easyer than download the rebol view exe somewere and pass it a script, no installing no messing ,unless you opt to install it for the long term OC and even thats an easy 30 seconds plus a bit of typing.
  107. pup

    Wrote at 2008-03-16 04:02 UTC using Internet Explorer 6.0 on Windows XP:


    you dont seem to understand, by the simple act of watching it on your Pod you are downloading it too.

    thats what its there for after all,are many UK Pad users so non-tech ?
  108. rock

    Wrote at 2008-03-16 07:06 UTC using Safari 523.15 on Mac OS X:

    If (hypothetically) you’re geographically impaired with respect to the Beeb’s iPlayer, in that you don’t in fact reside in the UK, you might have luck using something like Tor plus a proxy to make it look to the BBC’s servers as if you did. In which case you’d change the second line in the http_get routine to be

    # http =, url.port)
    proxy_class = Net::HTTP::Proxy(‘’, 8118)
    http =, url.port)

    Just hypothetically.
  109. Rob

    Wrote at 2008-03-16 08:47 UTC using Firefox on Windows Vista:

    Even as a non programmer I managed to install ruby and got it working. Thanks :0)

    Can I ask why downloading takes so long? It is converting or something?

    A half hour show took about 20 minutes
  110. Paul Battley

    Wrote at 2008-03-16 10:40 UTC using Firefox on Linux:

    Rob, it’s probably because the server is supposed to be streaming data to the client. It doesn’t need to serve it much faster than real-time for that. Whether that’s a deliberate decision to make it less convenient to grab the programmes, I couldn’t say.
  111. stoner

    Wrote at 2008-03-16 12:20 UTC using Netscape 3.0 on Unknown OS:

    Have the BBC stopped this working again? I was having no problems yesterday hoovering stuff down, but now I’m getting errors. I get the same trying programmes I have even downloaded successfully before, and as the script errors straight away, I wonder if the BBC have blacklisted me? :) I have 8 IPs, but trying from 2 of them I get the same (only 1 was used when downloading successfully)....

    user@host:~/iplayer$ ruby1.8 iplayer-dl.rb
    /usr/lib/ruby/1.8/net/http.rb:560:in `initialize’: Connection refused – connect(2) (Errno::ECONNREFUSED)
    from /usr/lib/ruby/1.8/net/http.rb:560:in `open’
    from /usr/lib/ruby/1.8/net/http.rb:560:in `connect’
    from /usr/lib/ruby/1.8/timeout.rb:48:in `timeout’
    from /usr/lib/ruby/1.8/timeout.rb:76:in `timeout’
    from /usr/lib/ruby/1.8/net/http.rb:560:in `connect’
    from /usr/lib/ruby/1.8/net/http.rb:553:in `do_start’
    from /usr/lib/ruby/1.8/net/http.rb:542:in `start’
    from /usr/lib/ruby/1.8/net/http.rb:1032:in `request’
    from /usr/lib/ruby/1.8/net/http.rb:945:in `request_get’
    from iplayer-dl.rb:47:in `http_get’
    from iplayer-dl.rb:82

    This is on Ubuntu 7.04. Thanks, and cheers for sharing your little script.
  112. Rob

    Wrote at 2008-03-16 14:03 UTC using Firefox on Windows Vista:

    Thanks Paul for the script and all your hard work

    Stoner – I’m getting mixed downloads today. Probably only 50% of them work. This is on Vista. Same error as above.
  113. Rob

    Wrote at 2008-03-16 14:05 UTC using Firefox on Windows Vista:

    Here’s my error message. It finishes with a pop up saying “windows cannot find 1. Please check up spelt the name correctly”

    Microsoft Windows [Version 6.0.6001]
    Copyright© 2006 Microsoft Corporation. All rights reserved.


    C:>cd ruby

    C:ruby>ruby.exe iplayer-dl
    c:/ruby/lib/ruby/1.8/net/http.rb:564:in `initialize’: No connection could be mad
    e because the target machine actively refused it. – connect(2) (Errno::ECONNREFU
    from c:/ruby/lib/ruby/1.8/net/http.rb:564:in `open’
    from c:/ruby/lib/ruby/1.8/net/http.rb:564:in `connect’
    from c:/ruby/lib/ruby/1.8/timeout.rb:48:in `timeout’
    from c:/ruby/lib/ruby/1.8/timeout.rb:76:in `timeout’
    from c:/ruby/lib/ruby/1.8/net/http.rb:564:in `connect’
    from c:/ruby/lib/ruby/1.8/net/http.rb:557:in `do_start’
    from c:/ruby/lib/ruby/1.8/net/http.rb:546:in `start’
    from c:/ruby/lib/ruby/1.8/net/http.rb:1044:in `request’
    from c:/ruby/lib/ruby/1.8/net/http.rb:957:in `request_get’
    from iplayer-dl:47:in `http_get’
    from iplayer-dl:82
    ‘filter’ is not recognized as an internal or external command,
    operable program or batch file.
    The system cannot find the file 1.
    ‘scope’ is not recognized as an internal or external command,
    operable program or batch file.
    ‘version_pid’ is not recognized as an internal or external command,
    operable program or batch file.
  114. Bill Gates

    Wrote at 2008-03-16 14:40 UTC using iPhone on Mac OS X:

    Looking at the page
    (with user agent set to iphone) it says

    “Sorry, Spendaholics: Series 4 is not available

    Please select another programme and try again.”

    I suggest that you try another program
    (Love soup, “10 days to war” are available)

    PS Thanks for buying my OS
  115. alex

    Wrote at 2008-03-16 15:43 UTC using Firefox on Mac OS X:

    The perl script worked better for me (OSX 10.5) all though I had to change permissions using chmod and tweak the script to change the download location from “Videos” to “Movies”

    I was thinking – can this be applied to the youtube videos which have been converted to mp4 format?
  116. James

    Wrote at 2008-03-16 16:24 UTC using Firefox on Windows Vista:

    It seems to be that mostly the longer urls are dowanloadable of this type …


    the shorter ones have never worked for me eg:
  117. simonp

    Wrote at 2008-03-16 16:39 UTC using Firefox on Mac OS X:

    A simple solution – use a screen recorder – problem solved, no drm issues
  118. Neil Houston

    Wrote at 2008-03-16 20:33 UTC using Safari 523.12.2 on Mac OS X:

    Loving the script, nice and simple and does what it says on the tin.

    One thing that would be good would be to display the filename after the put command showing what the progress is.

    The reason is that when I have many shows downloading at 100% I sometimes don’t know which one has actually finished.
  119. Neil

    Wrote at 2008-03-16 22:22 UTC using Safari 523.12.2 on Mac OS X:

    After reading the code it is as simple as :

    print ”\r#{percentage}% #{title}”

    Hope someone else finds that useful,
  120. Paul Battley

    Wrote at 2008-03-16 22:47 UTC using Firefox on Linux:

    Good idea, Neil. I’ve added that change.
  121. Nas

    Wrote at 2008-03-17 01:36 UTC using Safari 523.15 on Mac OS X:


    No all Pod users are not non-tech. What you don’t seem to understand is the difference between Downloading and Streaming. Yes, they are very similar in nature but streaming downloads the content in temporary storage and then deletes it when finished.

    This is what the iPhone/iPod Touch does and is what the license agreement of the iPlayer for iPhone allows. So what you are doing is wrong no matter how you want to go around it, and thus could end this service for us iPhone users.

    P.S It’s because of people like you who download “free” music, the reason why we have DRM in the first place. Thus spoiling it for the rest of us.
  122. Mick

    Wrote at 2008-03-17 07:13 UTC using Opera 9.50 on Linux:

    Thanks for your code! It works most of the time, but there are some programmes that seem to fail each time:
    $ ./
    /usr/lib/ruby/1.8/net/http.rb:564:in `initialize’: Address family not supported by protocol – socket(2) (Errno::EAFNOSUPPORT)
    from /usr/lib/ruby/1.8/net/http.rb:564:in `open’
    from /usr/lib/ruby/1.8/net/http.rb:564:in `connect’
    from /usr/lib/ruby/1.8/timeout.rb:48:in `timeout’
    from /usr/lib/ruby/1.8/timeout.rb:76:in `timeout’
    from /usr/lib/ruby/1.8/net/http.rb:564:in `connect’
    from /usr/lib/ruby/1.8/net/http.rb:557:in `do_start’
    from /usr/lib/ruby/1.8/net/http.rb:546:in `start’
    from /usr/lib/ruby/1.8/net/http.rb:1044:in `request’
    from /usr/lib/ruby/1.8/net/http.rb:957:in `request_get’
    from ./ `http_get’
    from ./

    Is this a bbc server issue?

    Thanks again,—
  123. John Wards

    Wrote at 2008-03-17 07:52 UTC using iPhone on Mac OS X:


    The BBC could easily offer the streaming service to all browsers/OS if they wished.

    Yes people could have (and look they have) built something to keep these streams. Just like taping off the radio, or Real Player saving streaming radio from…or even stripping the DRM from the windows downloads.

    They have a perfectly capable delivery mechanism that is able to stream to my computer, why are they stopping me from viewing?

    Its like blocking TV signals to everything but a Sony T.V.

    The iPhone is a minority mobile platform. If they wanted mass reach they could have built something for the S60 operating system. But that wouldn’t have got them the press they were looking for.

  124. Strawp

    Wrote at 2008-03-17 10:06 UTC using Firefox on Windows XP:


    This comments page is getting WAY too big, plus there are (and were) developers poking around with the BBC services distributed in forum threads, mailing lists and comment threads all over the place:

    – flickr
    – XBMC forums
    – BBC Backstage Mailing list
    – El Reg

    The Backstage mailing list was a good place to discuss all this sort of stuff, but when the “fix” was launched last week, I got a warning from a senior manager there for discussing a workaround.

    Anyway, I now see this script written in PHP, Ruby, perl and Python and we’re all replicating efforts and working things out on our own. I’d like to get a small community of excellent script monkeys in the same place. Wanna contribute to a wiki, and does your host offer a quick wiki creation feature? ;)

    I’m thinking “The iPlayer hacker’s Wiki”. I was already working on a script to pull down media from the RTMP stream – it might be needed again if the MP4 one gets pulled…

    Mail me if that sounds like a good idea.
  125. Del

    Wrote at 2008-03-17 12:34 UTC using Firefox on Linux:


    The difference between iplayer users like myself on Linux and people who download “free” music (as you put it!) is that I PAY my TV Licence for my TV sets at home and want to be able to watch this content on my computer if I missed a program or forget to set MythTV to record it.

    I pay the license, I should have equal access to the content.

    I bet there are some of iPod/iTouch users out there (no doubt as small a minority as us Linux users) who may not be paying a TV licence! I’m sure that won’t stop the BBC.
  126. Irregular Shed

    Wrote at 2008-03-17 14:12 UTC using Firefox on Windows XP:

    Nas, I’d actually quite like the BBC to drop support for the iPhone and iPod Touch altogether, and support something else equally niche, using equally open formats over equally open protocols, just so that you can see it from our perspective. So you too can get utterly frustrated by empty promises from a corporation chasing the next ‘big’ thing.

    The only difference would be that we can do something about it with our free software, and the stripped-down, locked-up operating system on the iPhone would find it a whole lot harder.

    Here’s the facts. The BBC are hosting reasonable quality, open format video files on their servers, but obscuring them so that only people with one of two products from one supplier can see them, regardless of all the other products that could also use them if the obscuring process wasn’t there.

    The BBC say they have to apply DRM to the video that’s available to download, but they prove this to be untrue by the fact that they’re not applying DRM to these open format video files. So it’s one rule for them, another for the rest. Digital apartheid. (The fact that they broadcast television without DRM is utterly lost on them, as is the fact that everything they’re offering, plus more, is available on half a dozen torrent sites at higher resolutions. I could go to torrent sites, but seeing as the BBC is offering this service to everyone in the UK, I’m happy to use it.)

    I’d happily put together a set of scripts to make content being pulled from the ‘only intended for iPhone’ feed behave the same as the DRMed downloads through Kontiki on Windows platforms, and make it delete files automatically after 30 days. It wouldn’t be hard. As it is, there’s been no need – I’ve downloaded, watched and deleted.

    The thing about DRM that I’ve always found abhorrent is that it treats you with suspicion from the get-go. What I’m doing shows that, if you treat someone as a reasonable adult, they act like one. (I’d hope that most of the people here will behave the same, and I’m glad nobody bit on the YouTube question.)

    Anyway, seeing as I’m running Linux on a PC, it’s okay. From the BBC News article:

    A download service for PC users lets viewers keep the programmes for up to 30 days on their PC.
    (Source: )

    I’m a PC user. So it’s okay. BBC News say so, and they could never, ever be wrong. Just so long as I don’t access iPlayer from anything other than my PC, everything is just fine…
  127. Phil Foxton

    Wrote at 2008-03-17 14:21 UTC using Firefox on Windows XP:

    Trying this and I get :

    [root@whitebox mythtv]# ./iplayer-dl
    ./iplayer-dl:70:in `+’: can’t convert nil into String (TypeError)
    from ./iplayer-dl:70

    Any ideas?
  128. Stu

    Wrote at 2008-03-17 14:29 UTC using Firefox on Linux:

    Phil: That’s a proper MP4 iplayer URL. You just need to put the regular browser URL in.

    It should look more like the following:

    Hope this helps. :)
  129. Cydermaster

    Wrote at 2008-03-18 00:23 UTC using Firefox on Linux:

    I banged my head against the wall trying to download Touchcloth and Ashes to Ashes, with no avail, then I read the comment about the DVD-sales-friendly programmes not being available for the iphone and tried Marcus Brigstock’s (excellent) Late Edition and it worked like a dream.

    Thanks LOADS for this script – now I just wish Aunty Beeb would put all their progs up in iphone versions ;-)
  130. Strawp

    Wrote at 2008-03-18 12:12 UTC using Firefox on Windows XP:

    As mentioned, there is now a wiki:

    Please edit away if you have anything to add. It’s pretty much a howto guide for script writers at the moment though…
  131. paulk

    Wrote at 2008-03-18 14:39 UTC using Firefox on Windows XP:

    Hi, I am having difficulty with the script on a few pages specifically:

    The link plays fine on the iPhone but the script refuses to download it?
  132. lescombes

    Wrote at 2008-03-19 08:34 UTC using Opera 9.25 on Linux:

    trouble with the script today, the python script still works okay, some folks are having issues with Ashes to Ashes etc…....wait until last day of program on listings… fine then as I have just done Ashes via the pythin script
  133. Lonesome Cowboy

    Wrote at 2008-03-19 10:21 UTC using Firefox on Windows XP:

    Thanks for a great script. Works a treat except there does not seem to be that many shows available on this platform.

    I downloaded Watchdog no problems but EastEnders, Torchwood and Horizon were no-go.

    What I’d also like to try is to download the DRM files that the Windows Iplayer downloads but without using the iplayer application? (I’m on Linux).

    Is this possible ?

    I realise they won’t play outside of Windows Media Player but that’s another topic. I just want my server to be able to download specific files for me without having to use the iplayer app because I’ve heard that performs P2P uploads too.
  134. lescombes

    Wrote at 2008-03-19 13:01 UTC using Opera 9.25 on Linux:

    sorry I mean’t perl script works okay still, the Ruby one keeps failing
  135. Irregular Shed

    Wrote at 2008-03-19 16:26 UTC using Firefox on Windows XP:

    @Lonesome Cowboy:

    Not possible. The Windows client is built around two parts – the Kontiki client and Windows Media Player’s DRM handling. Both are proprietary and are firmly ingrained into Windows systems.

    There was a push toward getting everything to work via Wine but it never succeeded as far as I know, and this method is far nicer as it uses common, published protocols. Plus Kontiki is the most unpleasant program I’ve ever had to uninstall…
  136. Lonesome Cowboy

    Wrote at 2008-03-20 07:42 UTC using Firefox on Linux:

    @Irregular Shed:

    Yes I was hoping to avoid Kontiki so I could get the files direct using “regular” means, stick them on my server and then let my Windows box play them with Windows Media Player, DRM and all.

    I’ve heard bad things about Kontiki and that it performs peer uploads that can’t be disabled: that and the fact that the programmes available via this method are limited and of lower quality make my reasoning for wanting to download the DRM files directly without using Kontiki.
  137. Chunky the Monkey

    Wrote at 2008-03-20 17:03 UTC using Safari 419.3 on Mac OS X:

    I just wanted to congratulate you on a wonderful piece of work. It’s great. Worked second or third time (after I realised you only needed to put in the actual url of the page rather than the one pointing to the iPhone stream… duh…). Keep up the good work. Just tried it on my iMac and it looks great. I suspect it’ll look even better on my Eee! Thanks again.
  138. Neil

    Wrote at 2008-03-20 20:31 UTC using Safari 523.12.2 on Mac OS X:

    Don’t know if others are reading this still but had another thought that I shall share, why not trim off the ‘jibberish’ when we input a long string, as it makes a ‘mess’

    .// http:////

    [1] 314
    [2] 315
    [3] 316
    [4] 317
    [4]+ Done go=Find+Programmes
    56.0% : 10 Days to War – You Are Welcome Here

    Anyone looked into the relationship of the naming conventions of the items: b009hn90 . . any easy way to set up a task that either:
    A) Pulls links from the RSS that is mentioned
    B) Pulls down programmes in the same grouping i.e the “10 days to war” programmes
  139. Neil

    Wrote at 2008-03-20 21:15 UTC using Safari 523.12.2 on Mac OS X:

    Ok, If anyone is using this piece of code from Stu:

    # See if the mp4 version is available

    if html =~ /iplayer_streaming_http_mp4 : [n ],/
    print “This show is not available for this platform.n”
    exit 1

    It will not allow you to download certain programmes, i.e torchwood.
  140. Penny

    Wrote at 2008-03-20 23:54 UTC using Firefox on Windows XP:

    Thanks for this guide, I’m not a programmer, but I can follow instructions and this worked a dream, unfortunately the one programme that I did want to d/l didn’t seem to work, curses! But it’s nice to know that I can get round the skanky streaming if I want, I find that it takes forever to watch a programme.

    Thanks again!
  141. Paul Battley

    Wrote at 2008-03-21 12:09 UTC using Firefox on Linux:

    Neil, the reason that you see all the strange output is that your shell is interpreting the ‘&’ specially.

    Either remove that stuff before pasting in the command line, or quote the whole parameter, and it should work as you expect.
  142. Matt

    Wrote at 2008-03-21 17:31 UTC using Safari 419.3 on Mac OS X:

    It looks like the BBC’s got another trick up it’s sleeve, it’s wrapping several of it’s programs with a splash page, when viewed on the iplayer/ipod touch it shows a splash page with a little blue arrow, clicking that starts the actual stream. So far I’ve seen it on a Top Gear Special, their Botswana Trip Episode (the one they’re trying to sell for an exorbitant price on DVD bundled with the US Special…) any ideas? I’d assume the link is exactly the same as the normal links but in windows with the iplayer user agent all I see is a quicktime loading box (as for normal ipod streams) , any ideas? The script fails with ECONNREFUSED but the video plays on the ipod, any ideas on how to get round this one? Thanks
  143. Leusacock

    Wrote at 2008-03-22 02:33 UTC using iPhone on Mac OS X:

    Think I’ve got this finally figured out. On Os x – you type “ruby ” then you can drag the .rb file from the desktop into the terminal window which gives you the directory address for the file and then paste the url after that.

    Seems to work. Right?
  144. ThatGuy

    Wrote at 2008-03-22 11:06 UTC using Safari 525.13 on Mac OS X:

    Hey Matt,

    Can you post a URL that you are having trouble with?

    afaik my iTouch has always viewed videos like that with the ‘splash screen’, and the only difficulties I’ve had are shows that haven’t yet been re-encoded for mp4.

    If that works for you go for it!

    I do
    cd ./desktop
    ./iplayer URL. And it will download to desktop, I can folder it away later.
  145. Matt

    Wrote at 2008-03-22 23:58 UTC using Firefox on Windows XP:

    Hey ThatGuy,

    Sure, it’s:

    it looks like it’s the same link that PaulK was having problems with…

    Yep, I’ve had problems with that for programs where it hasn’t been encoded but out of curiosity I checked it out on my girlfriend’s ipod touch and lo and behold I get a splash screen with a button, click it and you get the video, which is why I think this might be the BBC’s next trick?

  146. Matt

    Wrote at 2008-03-22 23:59 UTC using Firefox on Windows XP:

    Btw, as of checking the link at 23:58GMT tonight, there’s only 21hrs left on that D/L so if you try linking to the episode after that, it’ll probably fail because it isn’t there anymore…
  147. y4mz

    Wrote at 2008-03-23 21:18 UTC using Safari 525.13 on Mac OS X:

    script worked with a few URLs, but not:

    $ ./iplayer-dl
    ./iplayer-dl:88: undefined method `[]’ for nil:NilClass (NoMethodError)
  148. Leusacock

    Wrote at 2008-03-23 23:33 UTC using iPhone on Mac OS X:

    Within terminal in OS X, it gives the computer name, which is obviously my name. Am I right in saying that this isn’t something that the bbc sees? I’m sure all that their website is seeing is a link to the file from an iphone, but I wanted to check.
  149. olly

    Wrote at 2008-03-24 16:57 UTC using Firefox on Windows Vista:

    sorry how do you install it?
  150. Del

    Wrote at 2008-03-26 14:31 UTC using iPhone on Mac OS X:

    I’ve replaced:

    http =, url.port)


    pxyurl = URI.parse(ENV[‘http_proxy’])
    http = Net::HTTP::Proxy(, pxyurl.port).new(, url.port)

    in my script … allows me to use bandwidth at work ;-) rather than wasting my own.

    Might be worth incorporting into the main script?
  151. Richard

    Wrote at 2008-03-27 17:17 UTC using Firefox on Linux:

    I don’t seem to have any luck. I get:-

    /usr/lib/ruby/1.8/net/http.rb:1121:in `addr_port’: undefined method `+’ for nil:NilClass (NoMethodError)
    from /usr/lib/ruby/1.8/net/http.rb:1081:in `begin_transport’
    from /usr/lib/ruby/1.8/net/http.rb:1056:in `request’
    from /usr/lib/ruby/1.8/net/http.rb:1046:in `request’
    from /usr/lib/ruby/1.8/net/http.rb:547:in `start’
    from /usr/lib/ruby/1.8/net/http.rb:1044:in `request’
    from /usr/lib/ruby/1.8/net/http.rb:957:in `request_get’
    from /home/psrwebs/iplayer-dl:47:in `http_get’
    from /home/psrwebs/iplayer-dl:82

    I’m using ubuntu 7.10
  152. y4mz

    Wrote at 2008-03-27 22:42 UTC using Safari 525.13 on Mac OS X:

    $ ./iplayer-dl

    seems to be working now
  153. Dan Russell

    Wrote at 2008-03-31 13:29 UTC using Firefox on Windows XP:

    Trouble with discussing this in such detail gives the Beebs anti “piracy” techs somewhere straightforward to look for details of how the latest fix runs
  154. Paul Battley

    Wrote at 2008-03-31 13:43 UTC using Firefox 3.0b4 on Linux:

    Dan, you may be right, but if we didn’t publish our findings, no one would be able to make use of them.

    As the BBC have found out, security through obscurity isn’t very powerful. I’m pretty confident that we don’t really have anything to fear by making this public.

    Besides, judging by Ashley Highfield’s last post on the matter, they’ve given up trying to fight it!
  155. Paul Battley

    Wrote at 2008-04-01 21:17 UTC using Firefox on Linux:

    I’ve incorporated a variation on Del’s proxy suggestion. If the http_proxy environment variable is set, it should use that. I’d appreciate any feedback on whether it works as expected.
  156. rak

    Wrote at 2008-04-01 22:58 UTC using Firefox on Mac OS X:

    Anyone working on a GUI for the script?

    There’s a program called Platypus [] which can wrap a Ruby script into a clickable/droppable GUI app.

    Maybe someone out there can figure out how to put iplayer-dl into this.

    Some related tutorials:
  157. Em

    Wrote at 2008-04-04 09:26 UTC using Internet Explorer 6.0 on Windows XP:


    Have installed Ruby downloaded script but when I run command I get this error
    C:My Downloads>ruby.exe iplayer-dl.rb
    iplayer-dl.rb:1: syntax error, unexpected ‘
  158. Paul Battley

    Wrote at 2008-04-04 09:31 UTC using Firefox 3.0b4 on Mac OS X:

    Em, it sounds like the file you’ve downloaded has been mangled somehow.
  159. Em

    Wrote at 2008-04-04 09:40 UTC using Firefox on Windows XP:

    Hi Paul…thanks you were spot on downloaded it again and now working..great script..thanks

  160. Jaseabase

    Wrote at 2008-04-06 01:44 UTC using Firefox on Windows XP:

    I have tried a lot of things to get this to work with no avail. I am printing out the variables at each stage (location, response, the pid etc) but it seems to crash out on the following code:

    response = http_get( selector,

    ‘Cookie’ => cookies,

    ‘User-Agent’ => QT_UA,

    ‘Range’ => ‘bytes=0-1’ )
    When printing out response variable, its coming back with an error page, linking to the license URL:

    Any ideas :(?
  161. nick

    Wrote at 2008-04-06 21:36 UTC using Firefox 3.0b5 on Linux:

    I’m getting the EAFNOSUPPORT error as well. Its happening on the Louis Theroux video, the address is

    Is this just due to no mp4 being available or is it what Matt was talking about above?

    Also I’ve added a small gui in gtk to the script if anyone is interested.
  162. Paul Battley

    Wrote at 2008-04-06 21:40 UTC using Firefox 3.0b4 on Linux:

    I wonder if it’s due to the age restriction they have in place. The script doesn’t have the ‘I am over 16’ cookie set.

    It should be easy enough to spoof it. Anyone fancy having a go?
  163. Paul Battley

    Wrote at 2008-04-06 21:56 UTC using Firefox 3.0b4 on Linux:

    No, scratch that. The downloader works on this, which has an age warning. I spoofed the age validation anyway, but Nick’s link wouldn’t work for me.

    Does it work on an actual iPhone/iPod Touch?
  164. nick

    Wrote at 2008-04-06 22:07 UTC using Firefox 3.0b5 on Linux:

    Hey Paul, I’ve just tried sending the age cookie as well but no joy. Thankfully this video has only just gone up so we have all week to get it working. I’d be interested to know if it works on the iPhone as well. There are other videos which were added today that do work. Also this video doesn’t work either and has no age restrictions, it was also added today.
  165. paolo

    Wrote at 2008-04-08 21:41 UTC using Safari 525.13 on Mac OS X:

    Louis Theroux address I have and is downloading now –

    Do yo need all the crap on the end of it?
  166. Paul Battley

    Wrote at 2008-04-08 22:52 UTC using Firefox 3.0b4 on Linux:

    Paolo, you don’t need anything from the question mark onwards. This is enough:
  167. John Peters

    Wrote at 2008-04-09 08:12 UTC using Firefox on Windows Vista:

    BBC made a change? I am unable to use the script and only get the following error, from both home and the office.

    No connection could be made because the target machine actively refused it. – connect(2) (Errno::ECONNREFUSED)
  168. Paul Battley

    Wrote at 2008-04-09 08:15 UTC using Firefox 3.0b4 on Linux:

    John, it’s still working for me. How new are the things you’re trying to download?
  169. John Peters

    Wrote at 2008-04-09 08:27 UTC using Firefox on Windows Vista:


    Tried several other videos and bumped into one that works fine, but for an example of one that doesn’t see:

    It was broadcast a few days ago.
  170. Tom

    Wrote at 2008-04-09 10:36 UTC using Firefox 2.0 on Mac OS X:

    I’m also getting the error “Connection refused – connect(2) (Errno::ECONNREFUSED) ” for some videos.

    eg: fails, but works.
  171. Wilfred

    Wrote at 2008-04-09 13:13 UTC using Konqueror 3.5 on Linux:

    Works very well. Thankyou!
  172. Mike

    Wrote at 2008-04-09 17:25 UTC using Mozilla on Mac OS X:

    How do I convert the text file that i`ve downloaded at the top of the page into an executable file for Leopard ?

    I downloaded one from above called iplayer_dl and managed to get it working in the terminal, heres my log for that !
    Last login: Wed Apr 9 18:05:30 on ttys001
    milo-coons-power-mac-g4:~ milocoon$ cd /Volumes/Slave Data/IPlayer
    milo-coons-power-mac-g4:IPlayer milocoon$ ruby iplayer_dl

    iplayer_dl Copyright© 2008 Iain Wallace
    This program comes with ABSOLUTELY NO WARRANTY.
    This is free software, and you are welcome to redistribute it
    under the GPLv3 license.


    PID in URL: b009pgww
    Getting meta data from…
    Setting PID as b009pgvc, based on versions available
    title: Panorama
    subtitle: Jersey – Island of Secrets
    Saving media to “”
    Requesting from…
    Redirecting to location: /iplayer/licence/error.shtml?statuscode=404

    Produced zero-sized file – deleting…
    milo-coons-power-mac-g4:IPlayer milocoon$

    Any Ideas about zero-sized file error ?

    Thanks Mike
  173. Paul Battley

    Wrote at 2008-04-09 18:14 UTC using Firefox 3.0b5 on Linux:

    I think this thread has got far too long, so I’m going to close the comments here and invite you all to visit and contribute to the beebhack wiki for further development and discussion.