Getting some TV news programmes

I told you it’s boring to lay down the whole day (see previous post). And even if I have a laptop, it’s very uncomfortable to type when you are on your bed with a leg on top of 3 pillows. Anyway, I’m not here to talk about my life but to share two small Python scripts. Their goal is to retrieve two television evening news programmes (from RTBF1 and France2, both in French). With that, I can directly watch evening news from my laptop (no need to browse their website nor install ad hoc Firefox plugin; everything can be done from the command line).

For the RTBF1 evening news, it was quite easy since they just rely on a 3rd-party hosting company to provide the video stream. One has just to find the correct URL and voilà: (446b).

For the France2 evening news, it was a little bit more tricky since they give the programme date in the URL. In my script, it gives yesterday URL if it’s launched before 9.00pm (their programme starts at 8.00pm every evening so it’s reasonable not to download today programme before 9.00pm). Here is the script: (889b).

Both scripts only give you the URL of the video stream. You need then to feed this URL into your favorite multimedia player (mplayer, e.g.). Please note you’ll still need proprietary codecs in order to view these streams.