BBC iPlayer video download

Easily download videos from BBC iPlayer (with youtube-dl)

Alt: v3.7 - 08.01.2017 - Code refactor + added quality selector
Neu: v3.8 - 14.01.2017 - Added support for videos in articles (e.g. BBC Arts)

  • --- /tmp/diffy20250502-1180718-m2yvv9 2025-05-02 02:08:58.452392477 +0000
  • +++ /tmp/diffy20250502-1180718-xhtqwi 2025-05-02 02:08:58.452392477 +0000
  • @@ -2,7 +2,7 @@
  • // @name BBC iPlayer video download
  • // @namespace http://andrealazzarotto.com/
  • // @include http://www.bbc.co.uk/*
  • -// @version 3.7
  • +// @version 3.8
  • // @description This script allows to save videos from BBC iPlayer.
  • // @copyright 2015+, Andrea Lazzarotto - GPLv3 License
  • // @require http://code.jquery.com/jquery-latest.min.js
  • @@ -10,6 +10,7 @@
  • // @connect edgesuite.net
  • // @connect bbc.co.uk
  • // @connect akamaihd.net
  • +// @connect llnwd.net
  • // @license GPL version 3 or any later version; http://www.gnu.org/copyleft/gpl.html
  • // ==/UserScript==
  • @@ -276,6 +277,9 @@
  • // compose the M3U8 stream URL
  • get_text(m3u8, function(r) {
  • var urls = r.split('\n').slice(1);
  • + console.log(m3u8);
  • + console.log(r);
  • + console.log(urls);
  • var final_url = (m3u8.indexOf('prod_af') < 0 && urls[1].indexOf('_av.') > 0) ? urls[1] : m3u8;
  • console.log('FINAL_URL: ' + final_url);
  • @@ -332,7 +336,7 @@
  • urls.each(function() {
  • var bitrate = $(this).attr('bitrate');
  • - var href = $(this).find('connection').attr('href');
  • + var href = $(this).find('connection:not([href*=akamaized])').attr('href');
  • media[bitrate] = href;
  • });
  • var subURL = $xml.find('media[service="captions"] connection').attr('href');
  • @@ -411,6 +415,11 @@
  • var isMediator = !!$('script:contains("mediator.bind")').length;
  • var isMorph = !!unsafeWindow.Morph;
  • + console.log("isRadio: " + isRadio);
  • + console.log("isProgramme: " + isProgramme);
  • + console.log("isMediator: " + isMediator);
  • + console.log("isMorph: " + isMorph);
  • +
  • mediaselector = get_JSON(config_url).mediaselector;
  • if (isRadio) {
  • @@ -446,11 +455,15 @@
  • }
  • if (isProgramme) {
  • - var clipid = location.href.split("/")[4];
  • + var clipid = location.href.split("/")[4];
  • + var element = $("[data-pid]");
  • + if (element.length == 1) {
  • + clipid = element.data("pid");
  • + }
  • +
  • $.getJSON('http://www.bbc.co.uk/programmes/' + clipid + '/playlist.json', function(data) {
  • var vpid = data.defaultAvailableVersion.pid;
  • console.log("VPID: " + vpid.toString());
  • - handle_pid(vpid, '.island .cf.component, .episode-playout');
  • + handle_pid(vpid, '.island .cf.component, .episode-playout, .island');
  • });
  • }