iplayer-dl for .NET

As of 10th December 2010, this program no longer works. Find out why.

One of my recent little projects has been to reimplement my iPlayer downloader in C#.

You can download the program from GitHub.

If you’re on Ubuntu or Windows, you’ll probably have everything you need; otherwise, you can install Mono (most platforms) or the .NET framework (Windows only).

You’ll either be able to run it directly or by using mono iplayer-dl.exe, depending on your platform.

It doesn’t have a GUI. You must run it from a command prompt. Give it a try, and tell me how it goes. It doesn’t have all the features of the Ruby version yet.

So … why did I make it?

Ruby’s fine, and I like Ruby, but it’s not a very good solution for getting programs out to the majority of people, because they need Ruby to run them. Using rubyscript2exe to package up the program with a Ruby interpreter is a solution that I’ve used, but it doesn’t seem to work on 64-bit versions of Windows, and it produces a very large package. It also requires a complete Windows development environment to build a Windows executable, which makes for an uncomfortable development workflow for me.

With .Net and Mono, it’s possible to develop and run the same compiled program on Linux, Windows, and OS X. C# is a reasonably tolerable programming language, with a number of sensible features that are absent from Java—closures, for example.

It’s been an interesting exercise. I suspect that test-driven development isn’t practised at Microsoft: the design of HttpWebRequest, for example, makes it very difficult to test. I’ve made a perfunctory effort at testing, but I’ve not tried especially hard to work past the difficult parts.

Comments

  1. Iain Cheyne

    Wrote at 2010-08-21 23:13 UTC using Firefox 3.6.8 on Windows 7:

    Thanks for this. It runs on 64-bit Windows 7 and downloads fine, but I can’t play the resulting MP4 in any of:
    • VLC
    • Media Player Classic
    • SMPlayer
    • Windows Media Player.
  2. Robin E

    Wrote at 2010-08-22 09:35 UTC using Firefox 3.6.8 on Windows XP:

    My main interest is to DL audio material. The new .NET version works excellently under WinXP and I use the Ruby version under Ubuntu. The only [very] slight glitch I see under .NET is that during the DL, “left” in the progress line, spasmodically shows as “leftt” as the number of preceding characters changes. Maybe a quick kludge would be to append a space as in “left ” to mask the effect.
    A nice extension would be the ability to find the “identifier” for a stream using some kind of list/search as does get_iplayer, rather than having to fire up iPlayer (or get_iplayer) to find this id.
    A very useful app… many thx.
  3. Paul Battley

    Wrote at 2010-08-22 14:06 UTC using Chrome 7.0.500.0 on Linux:

    There definitely seems to be a bug downloading larger files (which mainly affects TV) over 73,400,320 bytes in length. That’s exactly 0x4600000 which looks like a suspiciously round number.
  4. Paul Battley

    Wrote at 2010-08-23 00:28 UTC using Chrome 7.0.500.0 on Linux:

    OK, I think I’ve fixed the problem. I’d forgotten that the iPhone only fetches about 4 MB at a time. Try to fetch too much in one request, and the Beeb start serving garbage. If you’ve not got the newest version, go and get version 0.1.2.2594 and try that.

    Sorry about that.
  5. Greg Fleming

    Wrote at 2010-08-26 08:48 UTC using Safari 533.17.8 on Mac OS X:

    Looking forward to testing this on Ubuntu via Mono.

    Really enjoy the blog and insights. Thanks Paul.
  6. Greg Fleming

    Wrote at 2010-08-26 10:31 UTC using Firefox 3.6.8 on Linux:

    OK, I can confirm that this does indeed work perfectly on Ubuntu 10.04 with Mono (just ./iplayer-dl.exe [URL] at the terminal was all that was required). I’ve just successfully downloaded ”... Sings the Beatles”.

    Speed is good on my laptop over Wireless—I’m not sure if its as fast as the Ruby version but further tests should be revealing.

    I’m gonna have a peek at the source later too because I’m doing C# development at present and need to compare my gibberish to other people’s style.

    Nice work, Paul!
  7. Paul Battley

    Wrote at 2010-08-26 11:26 UTC using Chrome 7.0.500.0 on Linux:

    Greg, it certainly should work on Ubuntu: I’ve done all the development and compilation on Ubuntu using Mono. I’m glad to hear confirmation, though!

    I’d expect it to have the potential to download faster than the Ruby version, but in reality it’ll be the internet connection that’s the limiting factor in most cases.
  8. Sarah

    Wrote at 2010-08-26 18:27 UTC using Internet Explorer 7.0 on Windows Vista:

    Does this software download the drm version of the shows? How can you un-drm them?
  9. Paul Battley

    Wrote at 2010-08-27 00:05 UTC using Chrome 7.0.500.0 on Linux:

    Sarah, the programmes downloaded are free of DRM. (They won’t be of as high quality as the DRM’d ones from the desktop player, mind.)
  10. ria

    Wrote at 2010-08-29 18:15 UTC using Firefox 3.6.8 on Windows 7:

    hey …. its perfect …. works just fine first time …. thanks a million
  11. Paul

    Wrote at 2010-08-31 21:40 UTC using Chrome 5.0.375.127 on Windows 7:

    Working fine here too, Paul. Thanks
  12. john lee

    Wrote at 2010-09-22 21:28 UTC using Chrome 6.0.472.62 on Windows XP:

    errorlevel?
    using latest .net download on xp – download seem fines fine. However, if one uses say xx as parameter, it gives a (correct) error message saying ‘no recognised as ID’ but doesn’t appear to set errorlevel to be not equal to 0. This is standard for cli,... or did I miss something? Should be easy fix?

    BTW is the .net going to be the latest maintained version with all the latest fixes or will ipdl continue to be ‘latest’ ?

    John



    John
  13. john lee

    Wrote at 2010-09-23 14:47 UTC using Chrome 6.0.472.62 on Windows XP:

    feature/ minor bug

    running on win xp cl – it appears to crash the app if one uses redirection eg iplayer xxxx > jim.txt or >> jim.txt to redirect the output into a file. Since it works fine w/o redirection, I’m assuming this crash is related to the ‘progress’ indicator. If the progress indicator cannot be fixed to accomodate redirection, I suggest an option eg /noop to suppress the progress & just output an ‘ok’ or an error message to the file if redirection is used.
    John
  14. Martin

    Wrote at 2010-09-26 11:22 UTC using Firefox 3.6.10 on Windows XP:

    I had problems using the program identifier but worked when using the complete URL.

    http://pastie.org/1182304
  15. Paul Battley

    Wrote at 2010-09-27 00:35 UTC using Chrome 7.0.535.0 on Linux:

    Version 0.1.3 should fix the crash on output redirection. It also returns non-zero status on failure of a download.
  16. Nan M

    Wrote at 2010-09-28 17:48 UTC using Firefox 3.6.10 on Windows XP:

    Using v 0.1.3.1806 in xp home sp3.

    Nice light little thing, Mr Battley :-)
    We shall use it in preference to the Ruby one very happily.

    Using it to get radio mp3s only, but it ran 3 consecutive dls while reporting progress faultlessly.
    ie it reported a FAILED midway through the second file, with complete details of the partial, and resumed the download seamlessly when I restarted the download.

    These are only files smaller than 70MB.

    Thanks so much for all your support for your projects – access to the BBC is much treasured around these here parts.
  17. Jan

    Wrote at 2010-10-05 21:31 UTC using Internet Explorer 8.0 on Windows XP:

    Paul, this soooo off topic.
    I have a couple of old pcs running lightweight linux.(and XPish). Iplayer (flash based) just kills the pc (yup museum pieces). I was wondering whether IPDL can be rewritten so it outputs on the screen, audio to the soundcard. FF with useragent changer does not work (or I have not been able to get it to work.

    This must surely be lighter than Flash based?

    As long as “in the nightgarden” works….

    IPDL great for watching stuff on the plane… Love it thanks.

    Any ideas?
  18. Jameseh

    Wrote at 2010-10-19 21:48 UTC using Safari 533.18.5 on Windows 7:

    Jan, you could run VLC which would play the files as they download, then keep/delete the finished download accordingly.
  19. john lee

    Wrote at 2010-10-20 14:48 UTC using Chrome 6.0.472.63 on Windows XP:

    Paul, re 0.1.3, thanks for fix.

    Non zero status on failure works fine, but re the crash on redirection this still seems to happen if I don’t use -q. Wasn’t sure whether you thought that this was fixed, or if -q option is just suggested workaround.

    John
  20. Mike

    Wrote at 2010-11-04 08:17 UTC using Internet Explorer 8.0 on Windows XP:

    Hello Paul, thank you for the ipdl program it works really, really well for me. I have used it so much for programs on my ipod touch.
    Is it possible for you to adapt it to work on other tv sites ? or is there a `tweak` ( something basic) i could do to get this option ?
    many thanks again Mike.
  21. Jon

    Wrote at 2010-11-08 12:54 UTC using Firefox 3.6.11 on Windows 7:

    Very nice. Working on XP and Win7.
    Is there an option to download subtitles?
  22. Mike

    Wrote at 2010-11-17 17:19 UTC using Internet Explorer 8.0 on Windows XP:

    I have also tried just using the code:

    p00byqhh

    Still get the message: there is no page for this programme. This probably means the programme does not exist.

    Even though it is still there to watch.
  23. Alan Sharkey

    Wrote at 2010-12-09 22:44 UTC using Firefox 3.6.12 on Windows 7:

    I get this:

    C:UsersAlanDownloadsms>iplayer-dl http://www.bbc.co.uk/iplayer/episode/b00wh
    w3t/Baldi_Series_5_Food_of_the_Blue/
    Downloading: Baldi Series 5 Food of the Blue (b00whw3t)

    Unhandled Exception: System.Net.WebException: The request was aborted: Could not
    create SSL/TLS secure channel.
    at System.Net.HttpWebRequest.GetResponse()
    at IPDL.AbstractRequest.WithResponse(HttpWebRequest request, ResponseHandler
    handler)
    at IPDL.Downloader.Download(String pid, AtStartHandler atStart, ProgressHandl
    er progress, AtEndHandler atEnd)
    at IPDL.Cli.Download(String identifier)
    at IPDL.Cli.Run(String[] args)
    at App.Main(String[] args)

    C:UsersAlanDownloadsms>
  24. MikeH

    Wrote at 2010-12-09 22:56 UTC using Firefox 3.6.12 on Windows XP:

    Hi Paul

    I’ve been using your previous (non .Net) ipdl on WinXP very successfully for the past year or more (and many thanks to you, for it – a fine piece of work).

    Thought I would try your latest, so have run the .Net version 1.3 just now on Win XP Pro SP3, with Net framework 3.5 SP1 installed, but I get a crash – error output as follows:

    Downloading: Time to Remember Crime and Prohibition (b00vzy35)

    Unhandled Exception: System.Net.WebException: The request was aborted: Could not
    create SSL/TLS secure channel.
    at System.Net.HttpWebRequest.GetResponse()
    at IPDL.AbstractRequest.WithResponse(HttpWebRequest request, ResponseHandler
    handler)
    at IPDL.CoreMediaRequest.MakeInitialRangeRequestIfNecessary()
    at IPDL.Downloader.Download(String pid, AtStartHandler atStart, ProgressHandl
    er progress, AtEndHandler atEnd)
    at IPDL.Cli.Download(String identifier)
    at IPDL.Cli.Run(String[] args)
    at App.Main(String[] args)

    Does that tell you anything useful ?

    best regards
    Mike H
  25. MikeH

    Wrote at 2010-12-09 22:59 UTC using Firefox 3.6.12 on Windows XP:

    Ah… I see that is two of us now. I should just mention, that ipdl (original) has just stopped working for me today (partly the reason I tried the new one: I assumed the Beeb may have changed something). I wonder if they have…. I guess we’ll soon know if there is more feedback. OTHER USERS – please speak up if either tool is working for you on 9th December, thanks
  26. MikeH

    Wrote at 2010-12-09 23:10 UTC using Firefox 3.6.12 on Windows XP:

    I see everyone over on the other messageboard (original ipdl) is confirming that the BBC download is offline there too. Looks like the Beeb have changed something again :-(
  27. MartinT2

    Wrote at 2010-12-11 12:29 UTC using Firefox 3.6.12 on Windows XP:

    Hi Paul

    I am getting the same errors as Alan [2010-12-09 22:44 ] and Mike [2010-12-09 22:56] above.

    My original ipdl which worked fine last weekend now returns the “programme file not avaialble….” error for everything I have tried to download today.

    Please let me know if there is anything I can do to help to get ipdl up and running again. (I am sure that goes for everybody who uses ipdl!)
  28. MikeH

    Wrote at 2010-12-11 12:33 UTC using Firefox 3.6.12 on Windows XP:

    See my note over on the other messageboard [ http://po-ru.com/projects/iplayer-downloader/#leave_comment ] for details of the other tool that does this, get_iplayer. That acesses the flash video/audio if the iPhone video/audio is not accessible, so still works as of now.
  29. Alan Sharkey

    Wrote at 2010-12-11 15:05 UTC using Firefox 3.6.12 on Windows 7:

    I can’t get the other program (get_iplayer) to work at all. It seems you need to be a programming genius. Anyone got easy to use instructions?

    ALan
  30. Bruno Santos

    Wrote at 2010-12-12 06:04 UTC using Internet Explorer 8.0 on Windows 7:

    I’ve been using Agent Switcher on Firefox to fake myself to the latest ios but it still doesn’t work. According to fidler an exception happens :HTTPS connection failed.

    System.Security.Authentication.AuthenticationException: A call to SSPI failed, see inner exception.—-> System.ComponentModel.Win32Exception: The message received was unexpected or badly formatted
    —- End of inner exception stack trace—-

    It seems to be related to your previous thread:
    http://po-ru.com/diary/device-discrimination-on-the-internet/

    Your test data used in your tests don’t reflect the bbciplayer mobile site anymore. they now make the request to securegate.iplayer.bbc.co.uk and because you app doesn’t have the certificade it won’t trust the SSL conection. Is it possible that we could install an apple developers cert to be able to conect to it again?

    I would really like to hear the solution from you since I’ve been banging my head with this for some hours.

    Cheers