get magentamusik stream url with just one click
// ==UserScript==
// @name magentamusik stream url
// @namespace http://tampermonkey.net/
// @version 1.5
// @description get magentamusik stream url with just one click
// @author mihau
// @match https://www.magentamusik.de/*
// @supportURL https://gf.qytechs.cn/en/scripts/551875-magentamusik-stream-url
// @license MIT
// ==/UserScript==
$qa = function(_) {return document.querySelectorAll(_)}
setTimeout(function () {
var movieid = "";
var live = "[data-js-element='o-main-stage__config']";
var arch = "[data-js-element='o-video-player__config']";
var dmm = /DMM_MOVIE_(.*?)"/;
if ($qa(live)[0]) {
movieid = $qa(live)[0].innerText.match(dmm)[1];
} else if ($qa(arch)[0]) {
movieid = $qa(arch)[0].innerText.match(dmm)[1];
} else {
var loc = window.location.pathname.split('-');
movieid = loc[loc.length - 1];
}
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("https://wcps.t-online.de/cvss/magentamusic/vodclient/v2/assetdetails/58938/DMM_MOVIE_" + movieid, function(err, data) {
// ^^^^^ // < hardcoded, kann sich jederzeit ändern
if (err != null) {
console.error(err);
} else {
getJSON(data.content.partnerInformation[0].features[0].player.href, function(err, data) {
if (err != null) {
console.error(err);
} else {
const xhr = new XMLHttpRequest();
xhr.open("GET", data.content.feature.representations[0].contentPackages[0].media.href);
xhr.responseType = "document";
xhr.overrideMimeType("text/xml");
xhr.onload = () => {
if (xhr.readyState === xhr.DONE && xhr.status === 200) {
var logo = document.getElementsByClassName("o-header__trigger")[0].innerHTML;
document.getElementsByClassName("o-header__trigger")[0].innerHTML = '<a id="m3u8" href="#" style="font-size:30px; text-decoration:none">🡇</a> ' + logo;
document.getElementsByClassName("o-header__trigger")[0].onclick = function() {showURL(window.streamurl);event.preventDefault()};
}
};
xhr.send();
}
});
}
});
}, 5000);
function showURL() {
var test = prompt("stream URL (OK for ffmpeg command or cancel)", window.streamurl);
if (test !== null) {
prompt("ffmpeg command (OK for AUDIO-ONLY command or cancel)", 'ffmpeg -referer "' + location.href + '" -user_agent "' + window.navigator.userAgent + '" -i "' + window.streamurl + '" -c copy -bsf:a aac_adtstoasc "' + location.pathname.replace(/\//, "") + '.mp4"');
if (test !== null) {
prompt("ffmpeg AUDIO-ONLY command", 'ffmpeg -referer "' + location.href + '" -user_agent "' + window.navigator.userAgent + '" -i "' + window.streamurl + '" -vn -c:a copy "' + location.pathname.replace(/\//, "") + '-audio.m4a"');
}
}
}
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址