get arte stream url via one click
当前为
// ==UserScript==
// @name arte stream url
// @namespace http://tampermonkey.net/
// @version 0.1.9
// @description get arte stream url via one click
// @author mihau
// @match https://www.arte.tv/de/videos/*
// @match https://www.arte.tv/fr/videos/*
// @license MIT
// @supportURL https://gf.qytechs.cn/en/scripts/533451-arte-stream-url
// ==/UserScript==
// this script provides a very simple way to get the m3u8/hls url to feed into VLC, MPC-HC or any other player capable of playing streams; it also offers a pre-built oneliner for ffmpeg to download said stream
//
// works on both DE and FR and covers standard programs as well as arte concert
//
// other tools you should consider using are "yt-dlp" and addons such as "The Stream Detector" for Firefox
// ( https://addons.mozilla.org/en-US/firefox/addon/hls-stream-detector/ )
//
// the initial version was based on https://gist.github.com/t3k4y/a88afc5907bca0ffaec316de9bdb8184
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;
[" | ARTE Concert"," | ARTE"," - Komplette Sendung"," - Programm in voller Länge"," - Film in voller Länge"," - Regarder le film complet"," - Regarder l’émission complète"].forEach((item) => { filmtitle = filmtitle.replace(item, "") });
filmtitle = filmtitle.replace(/ /g, "_").replace(/[^a-z0-9 \.,_-]/gim, "").replace("_-_","-");
document.getElementsByTagName("body")[0].onclick = function () {
var para = document.createElement("a");
para.setAttribute('id', 'dwnl');
para.setAttribute('style', 'font-weight: bold');
para.setAttribute('style', 'color: white');
para.setAttribute('class', ' ds-tgzo04');
var node = document.createElement("span");
node.setAttribute('class', ' ds-eul86b');
node.innerText = "Stream URL";
para.appendChild(node);
if (document.getElementsByClassName(' ds-rymcfw')[0]) {
document.getElementsByClassName(' ds-rymcfw')[0].insertBefore(para, null);
} else if (document.getElementsByClassName(' ds-2aqyii')[0]) {
document.getElementsByClassName(' ds-2aqyii')[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 "' + window.navigator.userAgent + '" -i "' + url + '" -c copy -bsf:a aac_adtstoasc "' + filmtitle + '.mp4"');
}
});
document.getElementsByTagName("body")[0].onclick = function () {}
};
setTimeout('document.getElementsByTagName("body")[0].click()', 2500);
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址