vidcloud9-type direct linker

jwplayer dl

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         vidcloud9-type direct linker
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  jwplayer dl
// @author       You
// @match        https://vidcloud9.com/streaming.php?*
// @match        https://vidnode.net/streaming.php?*
// @match        https://vidnext.net/streaming.php?*
// @match        https://vidembed.net/streaming.php?*
// @match        https://vidstreaming.io/streaming.php?*
// @match        https://gogo-stream.com/streaming.php?*
// @match        https://gogo-play.net/streaming.php?*
// @match        https://gogo-play.tv/streaming.php?*
// @match        https://streamani.net/streaming.php?*
// @match        https://k-vid.co/streaming.php?*
// @match        https://asianload.cc/streaming.php?*
// @match        https://asianload.io/streaming.php?*
// @match        https://asianload1.com/streaming.php?*
// @match        https://vidembed.cc/streaming.php?*
// @match        https://vidcloud9.com/load.php?*
// @match        https://vidnode.net/load.php?*
// @match        https://vidnext.net/load.php?*
// @match        https://vidembed.net/load.php?*
// @match        https://vidstreaming.io/load.php?*
// @match        https://gogo-stream.com/load.php?*
// @match        https://gogo-play.net/load.php?*
// @match        https://gogo-play.tv/load.php?*
// @match        https://streamani.net/load.php?*
// @match        https://k-vid.co/load.php?*
// @match        https://asianload.cc/load.php?*
// @match        https://asianload.io/load.php?*
// @match        https://asianload1.com/load.php?*
// @match        https://vidembed.cc/load.php?*
// @match        https://vidcloud9.com/loadserver.php?*
// @match        https://vidnode.net/loadserver.php?*
// @match        https://vidnext.net/loadserver.php?*
// @match        https://vidembed.net/loadserver.php?*
// @match        https://vidstreaming.io/loadserver.php?*
// @match        https://gogo-stream.com/loadserver.php?*
// @match        https://gogo-play.net/loadserver.php?*
// @match        https://gogo-play.tv/loadserver.php?*
// @match        https://streamani.net/loadserver.php?*
// @match        https://k-vid.co/loadserver.php?*
// @match        https://asianloadserver.cc/loadserver.php?*
// @match        https://asianloadserver.io/loadserver.php?*
// @match        https://asianloadserver1.com/loadserver.php?*
// @match        https://vidembed.cc/loadserver.php?*
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant        none
// @run-at       document-idle
// ==/UserScript==

(async function() {
    'use strict';
    var corsproxy="https://api.allorigins.win/raw?url=";

    async function checkStatusOfMp4(url){
        try{
            var tmpv=document.createElement("video"),
                status=0;
            tmpv.onloadedmetadata=function(){
                status=200;
                concludeStatus();
            };
            tmpv.onerror=function(){
                //empty string=cors error (which is why cors proxy is used for non firefox)
                status=(tmpv.error.code==4&&(tmpv.error.message.toLowerCase().includes("decoder")||tmpv.error.message.toLowerCase().includes("demuxer")||tmpv.error.message==""))?200:404;
                concludeStatus();
            };
            tmpv.src=(navigator.userAgent.toLowerCase().includes('firefox')?"":corsproxy)+url;
            function concludeStatus(){
                tmpv.remove();
            }
            for(var i=0;i<10000&&(status==0);i++)await sleep(1);
            if(status==0)status=404;
            return status;
        }catch(e){return 404;}
    }

    var vidurl="";
    var loopInt=setInterval(async ()=>{
        if(vidurl==""){
            try{
                vidurl=jwplayer("myVideo").getPlaylistItem()["file"];
            }catch(e){}
        }else{
            clearInterval(loopInt);
            if(vidurl=="null")return;
            document.close();
            document.open();
            prompt("Video URL:",vidurl);
            var tryfetch=0;
            try{tryfetch=(await fetch(vidurl,{method:"HEAD",mode:"cors"})).status;}catch(e){}
            if(!(tryfetch<310||(await checkStatusOfMp4(vidurl))==200)){
                vidurl=corsproxy+vidurl;
            }
            document.write(`<body bgcolor="black"><video controls style="position:absolute;top:0;left:0;width:100%;height:100%;z-index:999;"></video></body>`);
            document.close();
            var v=document.querySelector("video");
            v.onerror=function(){
                var hlsjs=document.createElement('script');
                hlsjs.onload=function(){
                    if(Hls.isSupported()){
                        var hls=new Hls();
                        hls.loadSource(v.src);
                        hls.attachMedia(v);
                    }
                };
                hlsjs.src='https://cdn.jsdelivr.net/npm/hls.js@latest';
                document.querySelector('head').appendChild(hlsjs);
            };
            v.src=vidurl;
        }
    },10);
})();