SHARE
TWEET

francetv_get_m3u8.user.js

baptx May 8th, 2016 (edited) 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name        get_m3u8
  3. // @namespace   francetvinfo
  4. // @include     http://www.francetvinfo.fr/*
  5. // @version     1
  6. // @grant       none
  7. // ==/UserScript==
  8.  
  9. /* Using Content Script Injection (window.functionName) to make function available outside GreaseMonkey scope
  10. Page reload is needed if using existing function _jsonp_loader_callback_request_0. */
  11. window._jsonp_loader_callback_request_1 = function(json)
  12. {
  13.   alert(json.videos[1].url);
  14. }
  15.  
  16. window._jsonp_loader_callback_request_2 = function(json)
  17. {
  18.   alert(json.videos[5].url);
  19. }
  20.  
  21. function get_m3u8()
  22. {
  23.   // replay
  24.   var el = document.getElementById("catchup");
  25.   if (el) {
  26.     var id = el.href.match(/video\/(.*)@/)[1];
  27.     var script = document.createElement("script");
  28.     script.src = "http://sivideo.webservices.francetelevisions.fr/tools/getInfosOeuvre/v2/?idDiffusion=" + id + "&catalogue=Info-web&callback=_jsonp_loader_callback_request_1";
  29.     document.getElementsByTagName("head")[0].appendChild(script);
  30.   } else {
  31.     // live
  32.     var el = document.getElementById("en_direct_video");
  33.     if (el) {
  34.       var id = el.href.match(/video\/(.*)/)[1];
  35.       var script = document.createElement("script");
  36.       script.src = "http://sivideo.webservices.francetelevisions.fr/tools/getInfosOeuvre/v2/?idDiffusion=" + id + "&catalogue=Pluzz&callback=_jsonp_loader_callback_request_2";
  37.       document.getElementsByTagName("head")[0].appendChild(script);
  38.     }
  39.   }
  40. }
  41.  
  42. get_m3u8();
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top