These forums are archived

See this post for further info

get_iplayer forums

Forum archived. Posting disabled.

Downloading using multiple PIDs

user-585

Hi,
Now that the search functionality is gone, is it possible to stack pids for download like we used to stack the index numbers?

I have read a few things about this in the guides but they only seemed to work if the stacked PIDs were already in the cache and not with ones that weren't. So is this possible?

user-30

EDIT - NO.

What you saw in the guides section talked about index numbers. I've just updated the TV Download guide (and am working on the Radio guide) to indicate the difference between the index number and PID.

EDIT - I got a bit excited, incorrect answer removed. Read next post.

user-2

Unfortunately, you can't stack PIDs with
Code:
--pid
like you could stack index numbers. For programmes in the (now non-existent) cache you could stack by using the form
Code:
--get pid:PID1 pid:PID2
, but that doesn't work with
Code:
--pid
either. I expect to put out an interim release in a few days that will support multiple PIDs with
Code:
--pid
.

user-585

Thanks user-2 that would be brilliant.

user-616

I think I would find this feature useful too.

I'm thinking about knocking up a script / program that does searches using the webpage and then mines the pids from the returned HTML. e.g. http://www.bbc.co.uk/iplayer/search?q=ha...ws+for+you returns a webpage containing these: href="/iplayer/episode/b04mh8y5/have-i-got-news-for-you-series-48-episode-4" title="Have I Got News for You, Series 48: Episode 4" class="list-item-link stat" data-object-type="episode-standard"

Obviously it'll be fairly fragile, but should work until they make more site changes?

user-2

I've had the same idea rattling around for a while. There are still other options for get_iplayer, but a web scraper might be the last resort if those disappear. As you say, it could be pretty fragile - the Beeb have changed search results a few times over the years. You also have the complication of teasing out multiple pages of results. If you go for it, please consider writing it in Perl so that I can steal it for get_iplayer :}

user-514

Is Nitro - https://developer.bbc.co.uk/nitro - something that could be used in the future? From a quick glance, it seems like it would be useful.

user-514

"The BBC Developer site is currently open for registration to BBC Employees. Account requests from other users are not currently being activated. Please check back soon for more info."

Yeah, nevermind. But it does sound like it will be opened up more eventually.

user-2

I don't see Nitro as a solution for get_iplayer, at least not directly. You can be sure that get_iplayer wouldn't get direct access, and even if that were possible, rate limiting and other restrictions might be too tight. There are still details missing, and as you noted, outsiders can't see Nitro yet.

user-619

I also had the scrape idea. Seems like a good chance it would work. What are the other ideas? How can I help? I'm really sad about this. What can I do to help?

user-619

What about teaming up with TVDB folks and having a PID field that the community could help keep populated, we could then use the APIs that 'The Renamer' and 'TVRRenamer' uses to pull that info down

user-619

One other point of interest, the moveably the BBC instantly broke all the iPlayer features in Samsung TV's. You can read about it on Samsung's website.

user-586

Meantime here is a UserScript I use in Firefox to queue programme to the PVR List
First you start get_iplayer's WebPVR on localhost as usual.
The you navigate the BBC schedule pages.
When my userscript each link to a programme page such as
/programmes/b04xxxxx get replaced by a link to queue the programme to PVR.
Once they are queued RunPVR goes and get them.

Here is the script:

Code:
// ==UserScript==
// @id             gjb
// @name           PVR Embedded
// @version        1.0
// @namespace      
// @author         gjb
// @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'
    }
  }




More about UserScripts here: http://userscripts-mirror.org/

user-622

FWIW I wrote a quick'n'dirty (and probably buggy as hell) python script that uses the ion api to get tv listings and prints it out in tv.cache format.
I don't think the ion api will last for much longer though...

user-622

I thought I attached the script but it doesn't show up.
Here it is inline

Code:
import urllib
import json

class bbc:
  def __init__(self):
    self.index=0

  def newline(self,id,title,channel,episode='',seriesnum='',episodenum=''):
    self.index=self.index+1
    try:
      srs=str(int(seriesnum.split()[-1]))
    except:
      srs=''
    #index|type|name|pid|available|episode|seriesnum|episodenum|versions|duration|desc|channel|categories|thumbnail|timeadded|guidance|web
    line = '%d|tv|%s|%s|available|%s|%s|%s|versions|duration|desc|%s|categories|thumbnail|timeadded|guidance|web' % (self.index,title,id,episode,srs,episodenum,channel)
    print line.encode('utf-8')

  def child_episodes(self,master,child):
    #print "================== master ==============="
    #for kk in master.keys():
    #  try:
    #    print kk,'->',master[kk]
    #  except:
    #    print kk, '(???)'  
    #print "------------ child ----------"  
    channel=''
    if master.has_key('masterbrand_title'):
      channel=master['masterbrand_title']
    for episode in child:
      #for kk in episode.keys():
      #  try:
      #    print kk,'->',episode[kk].encode('utf-8')
      #  except:
      #    print kk, '(???)'  
      if channel=='' and episode.has_key('masterbrand_title'):
        channel=episode['masterbrand_title']
      self.newline(episode['id'],master['title'],channel,episode['title'],episode['series_title'],episode['position'])

  def scan(self):
    for brand in ('bbc_one','bbc_two','bbc_three','bbc_four'):
      for letter in 'abcdefghijklmnopqrstuvwxyz':
         url='http://www.bbc.co.uk/iplayer/ion/atoz/format/json/service_type/tv/masterbrand/%s/letter/%s/' % (brand,letter)
         r=json.load(urllib.urlopen(url))
         for programme in r['blocklist']:
            oldindex=self.index
            if programme.has_key('child_episodes'):
              self.child_episodes(programme,programme['child_episodes'])
            if programme.has_key('series'):
              for series in programme['series']:
                if series.has_key('child_episodes'):
                  self.child_episodes(programme,series['child_episodes'])
            if oldindex==self.index:
              self.newline(programme['id'],programme['title'],programme['masterbrand_title'])

b=bbc()
b.scan()

user-2

@boisemick: There is no way TVDB could be kept sufficiently current, and it doesn't help at all for radio.

@pipoolippo: I'm wary of the ION feeds as well, though they they might be the only source for certain information for now.

I'm closing this thread. If anyone has a script to contribute, create a new thread, where people will see it.

These forums are archived

See this post for further info