These forums are archived

See this post for further info

get_iplayer forums

Forum archived. Posting disabled.

UserScript to complement get_iplayer

user-586

Install the UserScript below in your browser (e.g Firefox)
and when you navigate the www.bbc.co.uk site each programme link
of the kind
Code:
/programmes\/b04xxxxx
becomes instead command
to put that programme into the PVR queue.

Of course you need to start up get_iplayer's WebPVR before
you click those new links



Ref: http://userscripts-mirror.org/

Code:
// ==UserScript==
// @id             yourName
// @name           PVR Embedded
// @version        1.0
// @namespace      
// @author         yourName
// @description    Embedded get_iplayer links into schedule
// @include        http://www.bbc.co.uk/*
// @run-at         document-end
// ==/UserScript==

  for( var i=0; i<document.links.length; i++ )
  {
    var myLink = document.links[i]

    if( myLink.pathname.match( /^\/programmes\/b04[a-z,0-9]{5}$/) )
    {
      var pid = myLink.pathname.split('/')[-1];
      console.log('pid:' + pid)
       var str=""
  str +="http://localhost:1935/?SEARCH=&SEARCHFIELDS=name&PROGTYPES=radio&URL=http%3A%2F%2Fwww%2Ebbc%2Eco%2Euk%2Fprogrammes%2F"
  str += pid
  str +="&VERSIONLIST=default&EXCLUDE=&CATEGORY=&EXCLUDECATEGORY=&CHANNEL=&EXCLUDECHANNEL=&SINCE=&BEFORE=&FUTURE=0&SORT=index&REVERSE=0&PAGESIZE=10&HIDE=0&HIDEDELETED=0&COLS=thumbnail&COLS=type&COLS=name&COLS=episode&COLS=desc&COLS=channel&COLS=categories&COLS=timeadded&OUTPUT=&MODES=default&PROXY=&SUBTITLES=0&METADATA=&THUMB=0&PVRHOLDOFF=&FORCE=0&AUTOWEBREFRESH=1&AUTOPVRRUN=4&REFRESHFUTURE=0&BITRATE=&VSIZE=&VFR=&STREAMTYPE=&SAVE=0&SEARCHTAB=yes&COLUMNSTAB=no&DISPLAYTAB=no&RECORDINGTAB=no&STREAMINGTAB=no&PAGENO=1&INFO=0&NEXTPAGE=pvr%5Fqueue&ACTION=&.cgifields=REFRESHFUTURE&.cgifields=FUTURE&.cgifields=SUBTITLES&.cgifields=HISTORY&.cgifields=REVERSE&.cgifields=PROGTYPES&.cgifields=THUMB&.cgifields=HIDE&.cgifields=HIDEDELETED&.cgifields=FORCE&.cgifields=COLS"
  document.links[i].href = str;
  document.links[i].target = 'PVR'
    }
  }

user-627

Thanks for this script, makes life a bit simpler now they have killed off the feed system.

I found one small change to the script makes it work with more content, if you change the line

Code:
if( myLink.pathname.match( /^\/programmes\/b04[a-z,0-9]{5}$/) )

to

Code:
if( myLink.pathname.match( /^\/programmes\/b0[a-z,0-9]{6}$/) )

You should find all the content pages will now become a link as the content will not always start with b04 older stuff starts at b00. The only downside is that it will turn EVERY link match it finds into a PVR link. The site uses the same url format for series info and episode info links so the script assumes any match is a valid queueable item. I'm playing around some more and see if I can rig up the 'Watch Now' on the actual player page to queue in the PVR, this would prevent every link becoming a queue link, if I can suss that out then I shall try and make it a separate button.

LATE NIGHT EDIT: I sussed out making the 'Watch Now' button perform the queue function, will test more tomorrow night and post the code up. Really should go to bed now :)

user-626

Forgive me if I'm being stupid... I installed this script in Firefox using Greasemonkey (have never tried userscripts before). When I go to BBC iplayer the browser says the script is enabled OK. I have the Web PVR open in a second tab.

When I click on a show on the iplayer tab, what should I expect to happen? If I flip back to the Web PVR tab nothing has changed (I tried refreshing).

Sorry for this noob question. If I could restore even some user-friendly functionality to the Web PVR it would be a great result.

user-637

Hi There!

I have been using get_iplayer for many years and love it!

I have been making some code using Perl that may get the Web PVR "Refreshed" again. I have just started on it today by using some of the scripts posted here already. I hope that it will be possible soon to get some functionality back with the Web PVR.

Early days, but it may help someone out there.

Tiiveni.
Refresh_Cache_V0_1.pl_.txt

user-586

Quote:<div class="d4p-bbp-quote-title">Quote:</div>Forgive me if I’m being stupid… I installed this script in Firefox using Greasemonkey (have never tried userscripts before). When I go to BBC iplayer the browser says the script is enabled OK. I have the Web PVR open in a second tab.

When I click on a show on the iplayer tab, what should I expect to happen? If I flip back to the Web PVR tab nothing has changed (I tried refreshing).

Sorry for this noob question. If I could restore even some user-friendly functionality to the Web PVR it would be a great result.
You don't need Web PVR open in a second tab. But it doens't hurt.
You clink on the program link.
First time a new tab opens with the PVR list containing that program
(not by name but by time/date pid etc)
Second time that tab gets updated with the 2nd program in the queue.
repeat ...
Until your ready.
Now enter the tab again and press Run PVR and wait until the downloads
complete.

That's it.

user-626

Hi - thanks for the reply, but it doesn't work that way for me. I'm clicking links on the BBC iplayer page (www.bbc.co.uk/iplayer).

On closer inspection, the iplayer links aren't the same format as in your first post. You mentioned links that are like this: "/programmes\/b04xxxxx".

For me, a typical programme link looks like this:
http://www.bbc.co.uk/iplayer/episode/b04...-episode-1

Maybe I'm trying to do this from the wrong sort of BBC page... Can I ask where you found links that include that backslash and the word "programmes"?

thanks!

user-627

Here's my tweaked version of forget.it's excellent code, It works a little differently but does a similar job. I changed the search params so it will respond to pids that start with a b or p which is handy for web only links and older content.

You need to use it on pages like these http://www.bbc.co.uk/programmes/b006q2x0...des/player or these http://www.bbc.co.uk/programmes/b04n1wqmthen then click the iplayer triangle to queue, you will lose the ability to watch anything live when running when using these pages but it will download anything. Radio fans can use the script on the radio program pages that offers the 'pop out player' button clicking that will queue that program for download.

Quality is set for best in all cases and will download subtitles for TV content. One thing you will need to change in the script is the destination. I use D:\Downloads\~~iplayer which in the script is the '&OUTPUT=D\:\\Downloads\\~~iPlayer\\' line you can either remove everything ofter the = to let it go to it's default location or replace it with another path. Remember to escape your slashes and colons :)

I hope this all makes sense it's my first userscript, add this whichever way you prefer to do so to get it into Firefox and enjoy. Future ideas are to make it present a choice to play content as normal, queue or stream to external player as the in browser player is awful even on my 80+MB Infinity connection.

Code:
// ==UserScript==
// @id             Nebular Nerd
// @name           get_iplayer queue linkificator
// @version        1.0
// @namespace      
// @author         Nebular Nerd
// @description    Converts the 'Watch Now' or 'Pop Out' player button on iPlayer pages to produce get_iplayer queue links, based on forget.ite's most excellent script.
// @include        http://www.bbc.co.uk/*
// @run-at         document-end
// ==/UserScript==
for (var i = 0; i < document.links.length; i++)
{
  var myLink = document.links[i]
  if (myLink.pathname.match(/^\/radio\/player\/(b|p)[a-z,0-9]{7}$/))
  {
    var pid = myLink.pathname.split('/') [ + 3];
    console.log('pid:' + pid)
    var str = ''
    str += 'http://localhost:1935/?SEARCH=&SEARCHFIELDS=name&PROGTYPES=radio&URL=http%3A%2F%2Fwww%2Ebbc%2Eco%2Euk%2Fradio%2Fplayer%2F'
    str += pid
    str += '&OUTPUT=D\:\\Downloads\\~~iPlayer\\'
    str += '&VERSIONLIST=default&EXCLUDE=&CATEGORY=&EXCLUDECATEGORY=&CHANNEL=&EXCLUDECHANNEL=&SINCE=&BEFORE=&FUTURE=0&SORT=index&REVERSE=0&PAGESIZE=10&HIDE=0&HIDEDELETED=0&COLS=thumbnail&COLS=type&COLS=name&COLS=episode&COLS=desc&COLS=channel&COLS=categories&COLS=timeadded&MODES=best&PROXY=&SUBTITLES=1&METADATA=&THUMB=0&PVRHOLDOFF=&FORCE=0&AUTOWEBREFRESH=1&AUTOPVRRUN=4&REFRESHFUTURE=0&BITRATE=&VSIZE=&VFR=&STREAMTYPE=&SAVE=0&SEARCHTAB=yes&COLUMNSTAB=no&DISPLAYTAB=no&RECORDINGTAB=no&STREAMINGTAB=no&PAGENO=1&INFO=0&NEXTPAGE=pvr%5Fqueue&ACTION=&.cgifields=REFRESHFUTURE&.cgifields=FUTURE&.cgifields=SUBTITLES&.cgifields=HISTORY&.cgifields=REVERSE&.cgifields=PROGTYPES&.cgifields=THUMB&.cgifields=HIDE&.cgifields=HIDEDELETED&.cgifields=FORCE&.cgifields=COLS'
    document.links[i].href = str;
    document.links[i].target = 'PVR'
  }
  else if (myLink.pathname.match(/^\/iplayer\/episode\/(b|p)[a-z,0-9]{7}$/))
  {
    var pid = myLink.pathname.split('/') [ + 3];
    console.log('pid:' + pid)
    var str = ''
    str += 'http://localhost:1935/?SEARCH=&SEARCHFIELDS=name&PROGTYPES=tv&URL=http%3A%2F%2Fwww%2Ebbc%2Eco%2Euk%2Fiplayer%2Fepisode%2F'
    str += pid
    str += '&OUTPUT=D\:\\Downloads\\~~iPlayer\\'
    str += '&VERSIONLIST=default&EXCLUDE=&CATEGORY=&EXCLUDECATEGORY=&CHANNEL=&EXCLUDECHANNEL=&SINCE=&BEFORE=&FUTURE=0&SORT=index&REVERSE=0&PAGESIZE=10&HIDE=0&HIDEDELETED=0&COLS=thumbnail&COLS=type&COLS=name&COLS=episode&COLS=desc&COLS=channel&COLS=categories&COLS=timeadded&MODES=best&PROXY=&SUBTITLES=1&METADATA=&THUMB=0&PVRHOLDOFF=&FORCE=0&AUTOWEBREFRESH=1&AUTOPVRRUN=4&REFRESHFUTURE=0&BITRATE=&VSIZE=&VFR=&STREAMTYPE=&SAVE=0&SEARCHTAB=yes&COLUMNSTAB=no&DISPLAYTAB=no&RECORDINGTAB=no&STREAMINGTAB=no&PAGENO=1&INFO=0&NEXTPAGE=pvr%5Fqueue&ACTION=&.cgifields=REFRESHFUTURE&.cgifields=FUTURE&.cgifields=SUBTITLES&.cgifields=HISTORY&.cgifields=REVERSE&.cgifields=PROGTYPES&.cgifields=THUMB&.cgifields=HIDE&.cgifields=HIDEDELETED&.cgifields=FORCE&.cgifields=COLS'
    document.links[i].href = str;
    document.links[i].target = 'PVR'
  }
  
}

user-626

Hmmm... this does work for me - it adds the show to the PVR. But when I run the PVR, nothing gets recorded. The PVR says:

ONCE_http_www.bbc.co.uk_iplayer_episode_b04mmcmm
INFO: Episode-only pid detected
INFO: Trying pid: b04mmcmm using type: tv
INFO Trying to stream pid using type tv
INFO: pid not found in tv cache

WARNING: No programmes are available for this pid with version(s): default

(I'd like to point out I'm not a keen follower of DIY SOS... I was just experimenting...)

user-627

Is this using my script or forget.it's one?

Just tried with mine and worked ok for me, queue up another show and look in C:\Users\<user>\.get_iplayer\pvr\<filename with pid you want> you should get something looking like this.

Code:
comment http:__www_bbc_co_uk_iplayer_episode_b04mmcmm - - (queued: Sat Nov  1 15:20:03 2014)
force 0
modes best
output D:\Downloads\~~iPlayer\
pid http://www.bbc.co.uk/iplayer/episode/b04mmcmm
subtitles 1
thumb 0
type tv



In which case it should work, if not post up your output and I shall take a look, might not be tonight though I'm off to the pub :)

user-637

Hello,

I have been trying to write some Perl code to get the get_iplayer functioning again as normal. Now, some things seem to be working again, but not as nicely as before the BBC made the changes.

I guess that this only works with a Windows PC. I have two files that I copy into the get_iplayer directory which is "C:\Program Files (x86)\get_iplayer" (on this machine). I then remove the ".txt" from the end of both files so that they are simply named "Refresh_Cache_V0_2.pl" and "Refresh_Cache_V0_2.pl.cmd". I will try to upload the two files with this message.

I then double click the "Refresh_Cache_V0_2.pl.cmd" file to open the command, which just starts running the Perl code ("Refresh_Cache_V0_2.pl.cmd"). My computer then sits there for a very long time scraping all the Data from the BBC iPlayer website and storing the results on the hard-disk, this refreshes the cache that get i-player uses to store all the data from the iPlayer system. You can watch the progress on the screen, but it needed 16 minutes to complete on my PC, as there are currently 3820 videos on BBC iPlayer! After this, I can then start the "PVR Manager" and use get_iplayer exactly as before.

Sadly, the images and most of the fine details for the programs are still missing! But, at least it gets things back on the road for now.

Thank you for all who have worked on this software!

Tiiveni.

Refresh_Cache_V0_2.pl_.cmd_.txt
Refresh_Cache_V0_1.pl_.txt

user-628

Just to update, just tried this on a Linux PC and it certainly updates the cache..


Thanks to everyone!

user-645

Tiiveni's PERL code worked nicely for me, once I had copied the files to the program files\get_iPlayer directory (which needed admin permission) then renamed the files (again needed Admin permission).

I also removed the trailing underscores on the file type extensions, giving file names ending .pl_.cmd and .pl as opposed to .pl_.cmd_ and .pl_

I tried it and it fetched the TV cache data, which loaded in the Get_iPlayer web interface, just like old times, but with a couple of glitches. Specifically the "Episode" no longer has the episode title, but an apparently random number of 3 or 4 digits (i.e. between 100 and 9999), and the "Time Added" shows as "44y 304d 20h ago".

Running PVR ran all my usual searches, one of which found a hit ( http://www.bbc.co.uk/iplayer/episode/p00...du-maurier ) and downloaded it, saving it with the file name "BBC_iPlayer_Feeds_-_743_p00nw1z9_default.mp4"

It plays just fine in VLC player.

Excellent work, thanks to all involved.

I haven't coded anything since the TV I used with my Sinclair ZX81 died, so I have no PERL knowledge and am a bit out of pratice. Is there anything I can do to make this work with Radio programmes, which is mostly what I used Get_iPlayer for?

user-626

To clarify my earlier ramblings: I can't get forget.it's script to work - I'm not knocking it, it's doubtless that I'm not implementing it quite right.

I have managed to make Nebular Nerd's script work, despite being a coding dunce. The biggest challenge was defining the download path and 'escaping' the dashes and colons in it. For anyone reading this who's as inexperienced as me, it involves putting backslashes before the colons & forward slashes of the download path, presumably so the coding language can understand it? So to have my files download to:
J:\My Videos/get_iplayer
...I amended the script in two places to:
str += '&OUTPUT=J\:\\My Videos\/get_iplayer\\' (see the extra backslashes?)

I was initially baffled by the subtitles on the videos until I realised they're a separate file that's downloaded alongside the MP4 with an '.srt' file extension. Once I deleted the subtitle file, they vanished from my videos.

One of the biggest problems I had with both the Userscript solutions was finding BBC pages in the 'www.bbc.co.uk/programme' format. Most of the iplayer triangles I clicked on simply bounced me into the iplayer website without sending anything to the get_iplayer PVR.

Finally Tiiveni's Perl code worked for me. Not sure how long it took to refresh the cache (I went away & left the computer to it), but when it had finished, the get_iplayer PVR appeared to run as normal. This is probably the method I'll stick with for now, as it's my closest match to the pre-breakdown way of working.

Everything I've downloaded since the breakdown has had a mangled filename, but that's a small price to pay - I'm glad to be getting anything at all.

Forget.it, Nebular Nerd & Tiiveni - you're keyboard maestros & I take my hat off to all three of you!

user-550

Many thanks to Tiveni for his perl script. It works brilliantly for TV feeds. Is there any way to get the same for Radio feeds?

I did try forget-it's script and the variations, but either I was missing something or had cut and paseted missing something, but I could not get it to perform at all. Hence my admiration for Tiveni's work.

Well done Tiveni!

user-626

Once I've downloaded a cache with Tiiveni's perl script, my old series links don't work anymore - no big deal as I can just recreate them, or pick off the episodes individually.

But now the search function works much better than it ever did before! I'm picking up shows' names with search terms that wouldn't have delivered any results in the past. A weird fringe benefit!

user-550

Not sure about the search, but the web PVR is showing programs as having been added 44y 305d ago! More weird!

user-628

Just a qualifier, the sript runs and creates a cache, it just needs some work on paths and that wrong way round windows \ ! ;)

These forums are archived

See this post for further info