Greasy Fork

Greasy Fork is available in English.

arte stream url

get arte stream url with just one click

当前为 2025-09-28 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         arte stream url
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  get arte stream url with just one click
// @author       mihau
// @match        https://www.arte.tv/de/videos/*
// @match        https://www.arte.tv/fr/videos/*
// @license MIT
// @supportURL   http://greasyfork.icu/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

// if you want to get the url the second the page loads, change this from 0 to 1:
var loadonload = 0;

// do not edit below this line
$   = function(_) {return document.getElementById(_)}
$tn = function(_) {return document.getElementsByTagName(_)}
$cn = function(_) {return document.getElementsByClassName(_)}
$qa = function(_) {return document.querySelectorAll(_)}
$qs = function(_) {return document.querySelector(_)}

var mode = "";
var jsoncontainer = 0;

for (var i = 0, l = $tn("script").length; i < l; ++i) {

  if ($tn("script")[i].innerText.indexOf("Generate/") != -1) {
    jsoncontainer = i;
    break;
  }

}

var nix = $tn("script")[jsoncontainer].innerText;
var myregex = /Generate\/.*?\/\//;
var match = nix.match(myregex);
var mynewregex = new RegExp("\/.*", "gi")
// very, very dirty regex, but hey - it works, no XHR necessary:
var thisisthefilmid = match[0].replace("Generate/", "").replace(mynewregex, "");

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;

  if ((loadonload != 0) && (thisisthefilmid != null) && (thisisthefilmid != "null") && (thisisthefilmid != "") && (thisisthefilmid != "undefined") && (thisisthefilmid != undefined) && (thisisthefilmid != NaN)) {
    url = "https://manifest-arte.akamaized.net/api/manifest/v1/Generate/" + thisisthefilmid + "/" + lang + "/XQ+KS+CHEV1/" + id + ".m3u8";
    showURL();
  }

var filmtitle = $qs('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("_-_","-");

function showURL() {
    var test = prompt("stream URL (OK for ffmpeg command or cancel)", url);
      if (test !== null) {
          prompt("ffmpeg command (OK for yt-dlp command or cancel)", 'ffmpeg -referer "' + location.href + '" -user_agent "' + window.navigator.userAgent + '" -i "' + url + '" -c copy -bsf:a aac_adtstoasc "' + filmtitle + '.mp4"');
      }
      if (test !== null) {
          prompt("yt-dlp command", "yt-dlp " + url);
      }
}

    $tn("body")[0].onclick = function () {

        var para = document.createElement("a");
        para.setAttribute('id', 'dwnl');
        para.setAttribute('style', 'color: red; font-weight: 800; padding-left: 5px');
        para.setAttribute('class', 'ds-64fl0u'); 

        var node = document.createElement("span");
        node.setAttribute('class', 'ds-11ckmbs'); 
        node.setAttribute('style', 'padding-left: 10px; color: #FA481C');
        node.innerText = "Stream URL";
        para.appendChild(node);

      if ($cn('ds-1r0jukn')[0]) {
        $cn('ds-1r0jukn')[0].insertBefore(para, null);
      } else if ($cn('ds-1rm5mah')[0]) {
        $cn('ds-1rm5mah')[0].insertBefore(para, null);
      }
      
      if ((thisisthefilmid != null) && (thisisthefilmid != "null") && (thisisthefilmid != "") && (thisisthefilmid != "undefined") && (thisisthefilmid != undefined) && (thisisthefilmid != NaN)) {
        url = "https://manifest-arte.akamaized.net/api/manifest/v1/Generate/" + thisisthefilmid + "/" + lang + "/XQ+KS+CHEV1/118236-000-A.m3u8";
        mode = "local"
        console.log(mode+"!");
      } else {
                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;
                            mode = "remote"
                            console.log(mode+"!");
                    }
                });
      }
      
        $('dwnl').addEventListener("click", function(){
              showURL();
        });
      
      $tn("body")[0].onclick = function () {}
      
    };

setTimeout('document.getElementsByTagName("body")[0].click()', 3500);