Print requests with content-type 'application/vnd.apple.mpegurl'

Print content-type 'application/vnd.apple.mpegurl'

目前為 2023-04-13 提交的版本,檢視 最新版本

// ==UserScript==
// @name         Print requests with content-type 'application/vnd.apple.mpegurl'
// @namespace    http://your-domain-here/
// @version      10
// @description  Print content-type 'application/vnd.apple.mpegurl'
// @match        http://*/*
// @match        https://*/*
// @grant        GM_xmlhttpRequest
// @license MIT
// ==/UserScript==

(function() {
    'use strict';

    // Find the video player source file URL
    var scriptUrl = "";
    var scriptElements = document.getElementsByTagName("script");
    for(var i = 0; i < scriptElements.length; i++) {
        if(scriptElements[i].src.includes("video-player")) {
            scriptUrl = scriptElements[i].src;
            break;
        }
    }

    // Load the video player source file and extract the m3u8 link
    if(scriptUrl != "") {
        var xhr = new XMLHttpRequest();
        xhr.open("GET", scriptUrl, true);
        xhr.onreadystatechange = function() {
            if(xhr.readyState == 4 && xhr.status == 200) {
                var regex = /source.src\(\"(.+\.m3u8)\"\)/g;
                var match = regex.exec(xhr.responseText);
                if(match != null) {
                    var m3u8Link = match[1];
                    console.log("m3u8 link: " + m3u8Link);
                    // You can use the m3u8 link to download the video using a tool like FFmpeg
                }
            }
        };
        xhr.send();
    }
})();
长期地址
遇到问题?请前往 GitHub 提 Issues。