vidcloud9-type direct linker

jwplayer dl

当前为 2021-10-07 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         vidcloud9-type direct linker
// @namespace    http://tampermonkey.net/
// @version      0.1
// @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?*
// @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);
})();