-
-
Save jeanpierrebertola/c8d055e77c37ed979f97295f06161848 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| // ==UserScript== | |
| // @name arte v2 stream url | |
| // @namespace http://tampermonkey.net/ | |
| // @version 0.1.5.2 | |
| // @description try to take over the world! | |
| // @author You | |
| // @match https://www.arte.tv/de/videos/* | |
| // @match https://www.arte.tv/fr/videos/* | |
| // ==/UserScript== | |
| var loc = window.location.pathname.split('/'); | |
| var lang = loc[1]; | |
| var id = loc[3]; | |
| var name = loc[4]; | |
| var url = ""; | |
| var api_base = " https://api.arte.tv/api/player/v2/config/" + lang + "/"; | |
| var download_url = api_base + id; | |
| var filmtitle = document.querySelector('meta[property="og:title"]').content; | |
| filmtitle = filmtitle.replace(" | ARTE", "").replace(/ /g, "_").replace(/[^a-z0-9 \.,_-]/gim, ""); | |
| window.onload = function () { | |
| var para = document.createElement("span"); | |
| para.setAttribute('id', 'dwnl'); | |
| para.setAttribute('style', 'font-weight: bold'); | |
| para.setAttribute('style', 'color: white'); | |
| para.setAttribute('class', ' css-d7iwcn'); | |
| var node = document.createTextNode('Stream URL'); | |
| para.appendChild(node); | |
| document.getElementsByClassName(' css-15dgfxu')[0].insertBefore(para, null); | |
| var getJSON = function(url, callback) { | |
| var xhr = new XMLHttpRequest(); | |
| xhr.open('GET', url, true); | |
| xhr.responseType = 'json'; | |
| xhr.onload = function() { | |
| var status = xhr.status; | |
| if (status == 200) { | |
| callback(null, xhr.response); | |
| } else { | |
| callback(status); | |
| } | |
| }; | |
| xhr.send(); | |
| }; | |
| getJSON(download_url, function(err, data) { | |
| if (err != null) { | |
| console.error(err); | |
| } else { | |
| url = data.data.attributes.streams[0].url; | |
| } | |
| }); | |
| document.getElementById('dwnl').addEventListener("click", function(){ | |
| var test = prompt("stream URL (OK for ffmpeg command or cancel)", url); | |
| if (test !== null) { | |
| prompt("ffmpeg command", 'ffmpeg -referer "' + location.href + '" -user_agent "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:99.0) Gecko/20100101 Firefox/99.0" -i "' + url + '" -c copy -bsf:a aac_adtstoasc "' + filmtitle + '.mp4"'); | |
| } | |
| }); | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment