m3u8

替换JS网页播放器

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

You will need to install an extension such as Tampermonkey to install this script.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği indirebilmeniz için ayrıca Tampermonkey gibi bir eklenti kurmanız gerekmektedir.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name         m3u8
// @namespace    https://greasyfork.org/zh-CN/users/235730-jangj001
// @version      0.1
// @description  替换JS网页播放器
// @author       QQ:1073481777
// @include      *
// @grant        none
// @run-at document-start
// @license MIT
// ==/UserScript==

(function () {
    globalThis.geturl='';

    function inject(){
        var domStr = `<input type="submit" id="m3u8-jump" value="跳转下载" class="bgs_btn">`
        var div = document.createElement('div')
        div.innerHTML = domStr
        div.style.position = 'fixed'
        div.style.zIndex = '9999'
        div.style.bottom = '20px'
        div.style.right = '20px'
        div.style.textAlign = 'center'
        document.body.appendChild(div);

        var m3u8Jump = document.getElementById('m3u8-jump')
        m3u8Jump.addEventListener('click', function () {
            window.open('https://jx.wujinkk.com/dplayer/?url='+globalThis.geturl);
        })

    }


    var originXHR = window.XMLHttpRequest;
    var stop=false;
    var urls=[];
    function hookAjax() {
        var originOpen = originXHR.prototype.open;
        window.XMLHttpRequest = function () {
            var realXHR = new originXHR();
            realXHR.open = function (method, url) {
                if(!stop){
                    originOpen.call(realXHR, method, url)
                    console.log(url+'\n');
                    if(url.indexOf('.m3u8') > 0){
                        urls.push(url);
                        if(urls.length>0){
                            stop=true;
                            console.log(urls.length+'\n'+urls[urls.length-1]);
                            globalThis.geturl=urls[urls.length-1];

                        }

                    }
                }
            }
            return realXHR
        }
    }
    setInterval(hookAjax(),1000);
    console.log(globalThis.geturl);
    var set=setInterval(()=>{
        if (document.getElementById("m3u8-jump")==null){
            inject();
            console.log(globalThis.geturl);
        }
    },1000);
    setInterval(()=>{if (document.getElementById("m3u8-jump")){ clearInterval(set)}},1000);

})();