Friday 23 October 2009

get_iplayer

get_iplayer is a very useful command line utility to download, perfectly legally, programs from the BBC's iplayer facility.

Ordinarily, you can download the programs using iplayer's built in p2p system. This may or may not be attractive for you. It is useless if the program you are interested in is not available for download in a format you want for example. The alternative is watching the programs in the website's flash player. This is great, unless your ISP comprises a greater number of arseholes than a proctologist's final year exams. If so, you are likely to find your ISP bandwidth throttles real time video. You can find out if your ISP is doing this here.

If you suffer from this problem, then get_iplayer could be the solution. There are various packages for distributions etc etc available on the website, and it even works in windows. To install it from scratch though, use the following commands from your home folder, or where ever:
wget http://linuxcentre.net/get_iplayer/packages/get_iplayer-current.tar.gz
tar -xzvf get_iplayer-current.tar.gz
cd get_iplayer*
wget http://download.savannah.gnu.org/releases-noredirect/flvstreamer/source/flvstreamer-1.8k.tar.gz
tar -xzvf flvstreamer-1.8k.tar.gz
cd flvstreamer
make flvstreamer
make streams
cd ..

The software will now be installed, with the important flvstreamer addon. Download the iplayer database by running this command from the isntall folder:

./get_player

You can configure default options by running these commands:
./get_iplayer --prefs-add --modes=flashhd,flashvhigh,flashhigh,flashnormal,iphone
./get_iplayer --prefs-add --flvstreamer "./flvstreamer/flvstreamer_x86"
You can check and remove these default options by running:

./get_iplayer --prefs-show
./get_iplayer --prefs-clear

By way of example, you can now download a clip embedded in a BBC webpage by running this command:

./get_iplayer --url="http://news.bbc.co.uk/sport1/hi/motorsport/formula_one/8304965.stm"

You can download live F1, and presumably other sports, with a little more effort. First, install the Firebug add-on for firefox. Now, activate the add-on and browse to the live website. Use the “All Panels” option from the bug icon in the lower right corner of Firefox. Then, left click the bug to bring up the information, select the 'Net' tab, and look for a connection like this:

http://www.bbc.co.uk/mediaselector/4/gtis/?server=cp52115.live.edgefcs.net&identifier=sport6a_hq@s5444&kind=akamai&application=live&cb=59251
Copy that URL, and paste it into the command above as the text between the quotes.