BBC iPlayer Ruby code

I threw together some code for querying and parsing the BBC iPlayer search pages and emailing the results to you. You configure it by putting the names of the programmes you want to look out for into config.yaml, along with your email details, e.g.

search_terms:
  - mighty boosh
  - lead balloon
  - never better

email:
  email_to: email@example.com
  email_from: email@example.com
  server: mail.example.com
  user: email@example.com
  pass: password
  auth_type: login

Copy the sample config.yaml.dist to config.yaml in the same directory and edit.

I run the command line script via cron once a day by calling the cli.rb script with an --email switch, e.g. with the following line in crontab:

0 21 * * * /usr/bin/ruby /home/ell/dev/iplayer/cli.rb --email

You could as easily run it from a Windows scheduled task.

Dependencies are:

  • hpricot
  • rack

What it does is request the iPlayer search page with each search term, one after the other. If there are multiple pages of results, it fetches each of those too, aggregating the results. It will then email you a list of links to the programmes on the iPlayer site. One thing it does which the iPlayer search page doesn't do is sort the matching results by how long is left for you to watch them: the ones with the least amount of time left are at the top.

You can also run it as a local web server on port 3334 with:

ruby server.rb

Which then becomes accessible at:

http://localhost:3334/

Nothing fancy: just an HTML page with the search results in it, using the same config. as the command-line client. You can also call the page with extra search parameters to perform custom one-off searches, e.g.

http://localhost:3334/?search=doctor+who

It's not a serious project, just a convenience for me. GPL licence.

AttachmentSize
iplayer.zip5.08 KB

Comments

thanks for these codes ;)

thanks for these codes ;)

Is this code is applicable

Is this code is applicable only for uk?

The iPlayer

I'm not too clued up with scripting. So, is this an external script that you run when the search page is open, or does the script somehow tap into the iplayer search page?

Andy

I've updated this recently:

I've updated this recently: see this blog entry instead.

It's a script which you run from the command line, which presents itself as a web site. Behind the scenes, using the web site makes calls to the iPlayer site in the background. The other alternative is to run it as a scheduled task (Windows) or cron job (Linux), where the script will perform your searches and email the results.

It's not really intended for non-technical users, so if you're not a command line user, you may find it tricky to get started with.

UK Proxy

someone got a list of uk proxies available?

only in UK

if you are not in UK, it won't work...
bbc only let you download if you're in UK.
what a bullshit....

Ah, sorry Fred. Though if

Ah, sorry Fred. Though if you could get a UK proxy you might be able to pretend you're over here...