-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
GuGuss
committed
Aug 22, 2014
1 parent
44890cc
commit 835ca46
Showing
3 changed files
with
310 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
// ==UserScript== | ||
// @name Arte +7 Download - CHROME | ||
// @namespace GuGuss | ||
// @description Display a button to get RTMP URL of an Arte video | ||
// @include http://videos.arte.tv/*/videos/*.html | ||
// @version 1.0 | ||
// ==/UserScript== | ||
|
||
if ('function' !== GM_xmlhttpRequest) { | ||
console.log('Userscript manager not supported'); | ||
} else { | ||
console.log("C'est bon c'est good !"); | ||
} | ||
|
||
var GM_Debug = 0; | ||
|
||
if(!GM_Debug) { | ||
console.log('Debug mode is disabled'); | ||
console.log = function() {}; | ||
} else { | ||
console.log('Debug mode is enabled'); | ||
} | ||
|
||
// Create a download button. | ||
var downloadButton = document.createElement( 'input' ); | ||
with( downloadButton ) { | ||
setAttribute( 'onclick', 'triggerOnClick();' ); // For FF | ||
setAttribute( 'value', 'Download' ); | ||
setAttribute( 'type', 'button' ); | ||
} | ||
|
||
downloadButton.onclick = function() { triggerOnClick() }; // For Chrome | ||
|
||
// Append the button on the page | ||
document.getElementsByTagName( 'body' )[ 0 ].appendChild( downloadButton ); | ||
|
||
/* | ||
* Action callback when clicking the Download button. | ||
*/ | ||
function triggerOnClick(){ | ||
console.log('onClick triggered'); | ||
|
||
// Get the current language from the URL | ||
var currentLanguage = getCurrentLanguage(); | ||
|
||
// Get the Player XML URL | ||
var playerXmlUrl = getPlayerXmlUrl(currentLanguage); | ||
|
||
// Get the Video As Player XML URL | ||
GM_xmlhttpRequest({ | ||
method: "GET", | ||
url: playerXmlUrl, | ||
onload: function(response) { | ||
getVideoAsPlayerXmlUrl(response); | ||
} | ||
}); | ||
|
||
} | ||
|
||
/* | ||
* Get the current language from the URL. | ||
*/ | ||
function getCurrentLanguage() { | ||
// Get current page URL | ||
var currentURL = window.location.href; | ||
/* TODO : Remove that line to use the correct URL */ | ||
currentURL = "http://videos.arte.tv/fr/videos/le-president-et-la-chanceliere-face-aux-jeunes--7263932.html"; | ||
|
||
/* TODO : Explode the currentURL to use the correct language from the URL. */ | ||
currentLanguage = 'fr'; | ||
|
||
return currentLanguage; | ||
} | ||
|
||
/* | ||
* Get the Player XML URL from the current URL in the correct language. | ||
*/ | ||
function getPlayerXmlUrl(currentLanguage) { | ||
// Get current page URL | ||
var currentURL = window.location.href; | ||
|
||
// Get the video path (without the domain) | ||
var videoPath = currentURL.split("/").pop(); // Get the last element of the URL | ||
|
||
// Get the video name (without the extension) | ||
var playerXML = videoPath.split(".").shift(); // Get the first element of the video path | ||
console.log("playerXML : " + playerXML); | ||
|
||
var playerXmlUrl = "http://videos.arte.tv/" + currentLanguage + "/do_delegate/videos/" + playerXML + ",view,asPlayerXml.xml"; | ||
console.log("playerXmlUrl : " + playerXmlUrl); | ||
|
||
return playerXmlUrl; | ||
} | ||
|
||
/* | ||
* Get the Video As Player XML URL. | ||
*/ | ||
function getVideoAsPlayerXmlUrl(response){ | ||
var responseXML = null; | ||
|
||
// Inject responseXML into existing Object (only appropriate for XML content). | ||
if (!response.responseXML) { | ||
responseXML = new DOMParser().parseFromString(response.responseText, "application/xml"); | ||
} | ||
|
||
// Get the Videos As Player XML URLs | ||
var videosHTML = responseXML.getElementsByTagName("video"); | ||
console.log("videosHTML : " + videosHTML); | ||
|
||
for(var i = 0; i < videosHTML.length; i++) { | ||
if (videosHTML[i].getAttribute("lang") == currentLanguage) var videoAsPlayerXmlUrl = videosHTML[i].getAttribute("ref"); | ||
} | ||
|
||
console.log("videoAsPlayerXmlUrl : " + videoAsPlayerXmlUrl); | ||
|
||
// Get the RTMP stream URL | ||
GM_xmlhttpRequest({ | ||
method: "GET", | ||
url: videoAsPlayerXmlUrl, | ||
onload: function(response) { | ||
getRtmpStreamUrl(response); | ||
} | ||
}); | ||
|
||
} | ||
|
||
/* | ||
* Get the RTMP stream URL. | ||
*/ | ||
function getRtmpStreamUrl(response){ | ||
var responseXML = null; | ||
|
||
// Inject responseXML into existing Object (only appropriate for XML content). | ||
if (!response.responseXML) { | ||
responseXML = new DOMParser().parseFromString(response.responseText, "application/xml"); | ||
} | ||
|
||
// Get the RTMP stream URLs | ||
var urlsTag = responseXML.getElementsByTagName("urls"); | ||
console.log(urlsTag); | ||
|
||
var rtmpUrls = urlsTag[0].childNodes; | ||
console.log(rtmpUrls); | ||
|
||
var rtmpUrl = null; | ||
|
||
for(var i = 0; i < rtmpUrls.length; i++) { | ||
if(rtmpUrls[i].nodeName == "url") { | ||
console.log("bingo"); | ||
if (rtmpUrls[i].getAttribute("quality") == "sd") rtmpUrl = rtmpUrls[i].textContent; | ||
} | ||
} | ||
|
||
alert(rtmpUrl); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
{ | ||
"videoSearchParams":{ | ||
"detailLevel":"L1", | ||
"lang":"F", | ||
"offset":0, | ||
"searchOperator":"OR", | ||
"order":"AIRDATE_DESC", | ||
"videoId":["048858-000_PLUS7-F"], | ||
"videoFormat":"ALL", | ||
"videoQuality":"ALL", | ||
"versionProg":"1", | ||
"mobileAvailable":true, | ||
"tvAvailable":false,"pcAvailable":true,"prereleased":0, | ||
"searchFields":["videoSubtitle","videoTags","videoTitle"],"firstVideoId":"048858-000_PLUS7-F" | ||
}, | ||
"video":{ | ||
"lastModified":"20/06/2014 18:18:56 +0200", | ||
"videoDurationSeconds":5223,"videoRemontageContenu":"A", | ||
"videoStreamUrl":"http://www.arte.tv/papi/tvguide/videos/stream/F/048858-000_PLUS7-F/ALL/ALL.json", | ||
"videoIsoLang":"fr_FR","videoSwitchLang":{ | ||
"de_DE":"048858-000_PLUS7-D" | ||
}, | ||
"videoPlatform":[{ | ||
"platformId":5,"platformName":"ARTE FUTURE" | ||
}], | ||
"programImage":"http://www.arte.tv/papi/tvguide/images/1205155/W940H530/048858-000_masteruniverse_02-1401165914243.jpg", | ||
"videoRank":2,"isLive":false, | ||
"tracking":{ | ||
"tablet":{ | ||
"ANDROID":"https://www-secure.arte.tv/api/tracking/v1/048858-000/A/fr/TVGUIDE/TABLET/ANDROID/pixel.gif", | ||
"IOS":"https://www-secure.arte.tv/api/tracking/v1/048858-000/A/fr/TVGUIDE/TABLET/IOS/pixel.gif", | ||
"WINDOWS_8":"https://www-secure.arte.tv/api/tracking/v1/048858-000/A/fr/TVGUIDE/TABLET/WINDOWS_8/pixel.gif", | ||
"WEB":"https://www-secure.arte.tv/api/tracking/v1/048858-000/A/fr/TVGUIDE/TABLET/WEB/pixel.gif" | ||
}, | ||
"tv":{ | ||
"PANASONIC":"https://www-secure.arte.tv/api/tracking/v1/048858-000/A/fr/TVGUIDE/TV/PANASONIC/pixel.gif", | ||
"PHILIPS":"https://www-secure.arte.tv/api/tracking/v1/048858-000/A/fr/TVGUIDE/TV/PHILIPS/pixel.gif", | ||
"TOSHIBA":"https://www-secure.arte.tv/api/tracking/v1/048858-000/A/fr/TVGUIDE/TV/TOSHIBA/pixel.gif", | ||
"SAMSUNG":"https://www-secure.arte.tv/api/tracking/v1/048858-000/A/fr/TVGUIDE/TV/SAMSUNG/pixel.gif", | ||
"XBOX":"https://www-secure.arte.tv/api/tracking/v1/048858-000/A/fr/TVGUIDE/TV/XBOX/pixel.gif","LG":"https://www-secure.arte.tv/api/tracking/v1/048858-000/A/fr/TVGUIDE/TV/LG/pixel.gif","HBBTV":"https://www-secure.arte.tv/api/tracking/v1/048858-000/A/fr/TVGUIDE/TV/HBBTV/pixel.gif" | ||
}, | ||
"desktop":{ | ||
"WEB":"https://www-secure.arte.tv/api/tracking/v1/048858-000/A/fr/TVGUIDE/DESKTOP/WEB/pixel.gif" | ||
}, | ||
"mobile":{ | ||
"ANDROID":"https://www-secure.arte.tv/api/tracking/v1/048858-000/A/fr/TVGUIDE/MOBILE/ANDROID/pixel.gif","APP":"https://www-secure.arte.tv/api/tracking/v1/048858-000/A/fr/TVGUIDE/MOBILE/APP/pixel.gif","IOS":"https://www-secure.arte.tv/api/tracking/v1/048858-000/A/fr/TVGUIDE/MOBILE/IOS/pixel.gif","WINDOWS_PHONE_8":"https://www-secure.arte.tv/api/tracking/v1/048858-000/A/fr/TVGUIDE/MOBILE/WINDOWS_PHONE_8/pixel.gif","WEB":"https://www-secure.arte.tv/api/tracking/v1/048858-000/A/fr/TVGUIDE/MOBILE/WEB/pixel.gif" | ||
} | ||
}, | ||
"mobileAvailable":true,"tvAvailable":true,"pcAvailable":true,"remontage":"A", | ||
"videoPlayerUrl":"http://www.arte.tv/papi/tvguide/videos/stream/player/F/048858-000_PLUS7-F/ALL/ALL.json", | ||
"videoWarning":false,"caseProgram":"138_geopolitique","genreProgram":"documentaire", | ||
"postroll":"https://www-secure.arte.tv/papi/tvguide/videos/postroll/F/6.json", | ||
"genre":"Documentaire","videoBroadcastTimestamp":1403040871550,"prereleased":false,"infoProg":"(ALLEMAGNE, 2013, 87mn) HR", | ||
"director":"Marc Bauder","conductor":true,"VID":"048858-000_PLUS7-F","VTY":"ARTE_PLUS_SEVEN", | ||
"VTI":"Master of the Universe","VDU":87, | ||
"VTU":{ | ||
"original":"http://www.arte.tv/papi/tvguide/images/1205155/ORIGINAL/048858-000_masteruniverse_02-1401165914243.jpg", | ||
"IID":"1205155", | ||
"IUR":"http://www.arte.tv/papi/tvguide/images/1205155/W940H530/048858-000_masteruniverse_02-1401165914243.jpg" | ||
}, | ||
"VCH":[{"channelID":"SOC","label":"Société"},{"channelID":"DOC","label":"Documentaire"}], | ||
"VCM":[{"channelID":"ACU","label":"Actualité / Société"},{"channelID":"DOU","label":"Documentaires / Magazines"}], | ||
"VPO":1,"VDA":"17/06/2014 23:30:00 +0200","VGB":"ALL","VRA":"17/06/2014 23:34:31 +0200", | ||
"VRU":"24/06/2014 23:34:31 +0200","VAD":false,"VVI":40645,"VRT":0.0,"VRC":true, | ||
"VTR":"http://www.arte.tv/guide/fr/048858-000/master-of-the-universe","VSU":"Confessions d'un banquier", | ||
"VDE":"Après une vie au service de banques d’investissement allemandes, Rainer Voss, la cinquantaine, a décidé de parler. Il décortique sans fard les mécanismes du monde bancaire, qui s'est peu à peu déconnecté du monde réel. Un huis clos documentaire stupéfiant.", | ||
"VED":false,"VPR":false,"VSO":"arteplus7","VTA":["crise financière","investissement","traders","banque","secteur bancaire"], | ||
"VIT":"https://www-secure.arte.tv/api/tracking/v1/048858-000/A/fr/TVGUIDE/DESKTOP/WEB/pixel.gif", | ||
"VST":{ | ||
"VNA":"master_of_the_universe","VS1":"fr","VS2":"138geopolitique", | ||
"VS3":"ARTE7","VS4":"048858-000","VS5":"17062014","VGE":"documentaire" | ||
}, | ||
"V7T":"Les banques d’investissement vues de l'intérieur et analysées par un ancien employé. Stupéfiant!", | ||
"VPI":"048858-000","VTX":"ARTE+7", | ||
"VUP":"http://www.arte.tv/guide/fr/048858-000/master-of-the-universe","VTT":"https://www-secure.arte.tv/api/tracking/v1/048858-000/A/fr/TVGUIDE/TV/HBBTV/pixel.gif", | ||
"VTM":"https://www-secure.arte.tv/api/tracking/v1/048858-000/A/fr/TVGUIDE/MOBILE/APP/pixel.gif", | ||
"VMV":false,"VCG":"Documentaire","VTH":["Stéréo","VF","16 / 9","HD natif"], | ||
"VSR":[ | ||
{ | ||
"version":"VF-STF","versionProg":"1","VFO":"HBBTV", | ||
"VQU":"HQ","VMT":"mp4", | ||
"VUR":"http://artestras.vo.llnwxd.net/o35/nogeo/HBBTV/048858-000-A_HQ_2_VF-STF_01334266_MP4-800_AMM-HBBTV.mp4" | ||
}, | ||
{ | ||
"version":"VF-STF","versionProg":"1","VFO":"HBBTV", | ||
"VQU":"EQ","VMT":"mp4", | ||
"VUR":"http://artestras.vo.llnwxd.net/o35/nogeo/HBBTV/048858-000-A_EQ_2_VF-STF_01334267_MP4-1500_AMM-HBBTV.mp4" | ||
}, | ||
{ | ||
"version":"VF-STF","versionProg":"1","VFO":"BT","VQU":"HQ","VMT":"mp4", | ||
"VUR":"ftp://ftp.hubee.tv/048858-000-A_HQ_2_VF-STF_01334271_TS-1800_AMM-BT.ts" | ||
}, | ||
{ | ||
"version":"VF-STF","versionProg":"1","VFO":"SFR","VQU":"HQ","VMT":"mp4", | ||
"VUR":"ftp://ovh-p-cftp.wiztivi.com/048858-000-A_HQ_2_VF-STF_01334272_TS-1800_AMM-SFR.ts" | ||
}, | ||
{ | ||
"version":"VF-STF","versionProg":"1","VFO":"M3U8","VQU":"HQ","VMT":"mp4", | ||
"VUR":"http://artestras.vo.llnwd.net/o35/geo/arte7/ALL/tvguide/048858-000-A_HQ_2_VF-STF_01334273_MP4-2200_AMM-HLS/048858-000-A_HQ_2_VF-STF_01334273_MP4-2200_AMM-HLS.m3u8" | ||
}, | ||
{ | ||
"version":"VF-STF","versionProg":"1","VFO":"RMP4","VQU":"SQ","VMT":"mp4", | ||
"VUR":"rtmp://artestras.fcod.llnwd.net/a3903/o35/geo/videothek/ALL/tvguide/048858-000-A_SQ_2_VF-STF_01334278_MP4-2200_AMM-Tvguide.mp4?e=1403294642&h=1c5ffe8f72744c01dab3eb91cc43f3cd" | ||
}, | ||
{ | ||
"version":"VF-STF","versionProg":"1","VFO":"NUMERICABLE","VQU":"SQ","VMT":"ts", | ||
"VUR":"ftp://numericable.arte.hubee.tv/048858-000-A_SQ_2_VF-STF_01334279_MP2-3750_AMM-NC.ts" | ||
}, | ||
{ | ||
"version":"VF-STF","versionProg":"1","VFO":"REACH","VQU":"HQ","VMT":"mp4", | ||
"VUR":"http://artestrsmv.rd.llnwd.net/o35/nogeo/tvguide_reach/048858-000-A_HQ_2_VF-STF_01334268_MP4-1500_AMM-Reach.mp4" | ||
}, | ||
{ | ||
"version":"VF-STF","versionProg":"1","VFO":"HBBTV","VQU":"SQ","VMT":"mp4", | ||
"VUR":"http://artestras.vo.llnwxd.net/o35/nogeo/HBBTV/048858-000-A_SQ_2_VF-STF_01334274_MP4-2200_AMM-HBBTV.mp4" | ||
}, | ||
{ | ||
"version":"VF-STF","versionProg":"1","VFO":"ORANGE_ZNE","VQU":"HQ","VMT":"wmv", | ||
"VUR":"ftp://passportftp.optv.fr/048858-000-A_HQ_2_VF-STF_01334275_WMV-1500_AMM-OrangeZNE.wmv" | ||
}, | ||
{ | ||
"version":"VF-STF","versionProg":"1","VFO":"RMP4","VQU":"HQ","VMT":"mp4", | ||
"VUR":"rtmp://artestras.fcod.llnwd.net/a3903/o35/geo/videothek/ALL/tvguide/048858-000-A_HQ_2_VF-STF_01334276_MP4-800_AMM-Tvguide.mp4?e=1403294642&h=ec9dbdf3e3e46fc3de5219bebd6a7307" | ||
}, | ||
{ | ||
"version":"VF-STF","versionProg":"1","VFO":"RMP4","VQU":"MQ","VMT":"mp4", | ||
"VUR":"rtmp://artestras.fcod.llnwd.net/a3903/o35/geo/videothek/ALL/tvguide/048858-000-A_MQ_2_VF-STF_01334277_MP4-300_AMM-Tvguide.mp4?e=1403294642&h=3f58f510727001d1a33b47735b211fc4" | ||
}, | ||
{ | ||
"version":"VF-STF","versionProg":"1","VFO":"FREE","VQU":"HQ","VMT":"mp4", | ||
"VUR":"ftp://ftp.hubee.tv/in/048858-000-A_HQ_2_VF-STF_01334280_TS-1800_AMM-Free.ts" | ||
}, | ||
{ | ||
"version":"VF-STF","versionProg":"1","VFO":"RMP4","VQU":"EQ","VMT":"mp4", | ||
"VUR":"rtmp://artestras.fcod.llnwd.net/a3903/o35/geo/videothek/ALL/tvguide/048858-000-A_EQ_2_VF-STF_01334269_MP4-1500_AMM-Tvguide.mp4?e=1403294642&h=8bf265d2cf303760b3bea79d69c77902" | ||
}, | ||
{ | ||
"version":"VF-STF","versionProg":"1","VFO":"ORANGE","VQU":"SQ","VMT":"mp4", | ||
"VUR":"ftp://passportftp.optv.fr/048858-000-A_SQ_2_VF-STF_01334270_MP4-2200_AMM-Orange.ts" | ||
} | ||
], | ||
"VPG":"2","VPC":"138","VLA":"F" | ||
} | ||
} |