HTML5 player for Público TV

No ads, easily download videos and shows.

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name           HTML5 player for Público TV
// @name:es        Reproductor HTML5 para Público TV
// @description    No ads, easily download videos and shows.
// @description:es Sin anuncios, descarga fácilmente los vídeos.
// @namespace      https://greasyfork.org/users/4813-swyter
// @include        http://especiales.publico.es/publico-tv/*
// @version        2016.05.12
// @icon           https://i.imgur.com/PQgnzT4.jpg
// @grant          none
// @run-at         document-start
// ==/UserScript==

window.OVERON_Player = window.OVERON_Player || {};

/* override the flash video function and call it a day */
Object.defineProperty(window.OVERON_Player, 'init',
{
  configurable: false,
  writable: false,
  value: function(options)
  {
    console.info("check overriden! video arguments =>", arguments);

    v = document.createElement("video");

    v.width = options.width;
    v.height = options.height;
    v.src = ((t=document.createElement("textarea")).innerHTML = options.stream) && t.textContent;
    v.style = "display: block !important;";

    v.poster = options.preview_load;
    v.controls = 'true';

    /* replace the old SWF Flash object with it, voilà */
    elem = document.getElementById(options.container)
    elem.parentNode.replaceChild(v, elem);

    console.log("video replaced =>", v, elem);
  }
});

/* wait until the page is ready for the code snipped to run */
document.addEventListener('DOMContentLoaded', function()
{
  /* remove random crap */
  filters =
  [
    ".robapaginas",
    ".share",
    ".ads",
  ];

  for (var cur in (junk=document.querySelectorAll(filters.join(', '))))
  {
    if(typeof junk[cur] !== 'object')
      continue;

    console.log("Removed junk element: " + junk[cur]);
    junk[cur].parentElement.removeChild(junk[cur]);
  }
});