Python conquors the BBC [was Re: IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what?]

Chris “Kwpolska” Warrick kwpolska at gmail.com
Wed Aug 27 04:12:07 EDT 2014


On Wed, Aug 27, 2014 at 2:58 AM, Twirlip2 <ahrodg at googlemail.com> wrote:
> It just pulls a lot of HTML and XML from the website, and extracts the
> addresses of various other pages, and eventually *.WMA streams, and
> hands the stream URLs over to XMPlay <http://www.un4seen.com/>.
>
> It 'knows' what pages to visit, because I have manually built up a plain
> text file containing a list of (at the moment) 274 BBC radio programmes,
> represented by 579 different mnemonic key strings - of which the user
> only needs to type in a sufficiently long initial segment to disambiguate.
>
> Anyone else could use the same list, or build up their own, or use mine as
> a basis for their own. (I just maintain it using a text editor.  I haven't
> [yet] attempted to do any database programming.)
>
> I have plenty of ideas for improving the program, but first I have to
> re-organise the present spaghetti code in a more logical fashion.

I have a better idea: use an existing solution.  get_iplayer, to be precise.

See here: http://www.infradead.org/get_iplayer/html/get_iplayer.html

It’s written in Perl.  They claim to have a Windows installer.  I have
not tested the Windows thing, but it worked fine when I set it up on
Linux, and managed to download a radio programme on August 12th.

Sample usage (on Linux, you might need to adjust for no grep)

$ get_iplayer --type=radio --refresh | grep 'Chris Evans'
12876:  The Chris Evans Breakfast Show - Borrowing Boyfriends, BBC
Radio 2, Discussion & Talk Shows,Entertainment,Music,Radio
12877:  The Chris Evans Breakfast Show - 21/08/2014, BBC Radio 2,
Discussion & Talk Shows,Entertainment,Music,Radio
12878:  The Chris Evans Breakfast Show - Peter Capaldi, Daniel
Radcliffe, Jon Hamm and Ruby Turner, BBC Radio 2, Discussion & Talk
Shows,Entertainment,Music,Radio
12879:  The Chris Evans Breakfast Show - John Bishop sits in, BBC
Radio 2, Discussion & Talk Shows,Entertainment,Music,Radio
12880:  The Chris Evans Breakfast Show - Babooshka!, BBC Radio 2,
Discussion & Talk Shows,Entertainment,Music,Radio
$ get_iplayer --type=radio 12878 --get

And kaboom, #12878, "Peter Capaldi, Daniel Radcliffe, Jon Hamm and
Ruby Turner", is downloaded and stored on your hard drive.

-- 
Chris “Kwpolska” Warrick <http://chriswarrick.com/>
PGP: 5EAAEA16
stop html mail | always bottom-post | only UTF-8 makes sense



More information about the Python-list mailing list