gdriveplayer+vidcloud9+vidstreaming+hydrax direct link redirector/downloader

cool

目前為 2020-08-05 提交的版本,檢視 最新版本

// ==UserScript==
// @name         gdriveplayer+vidcloud9+vidstreaming+hydrax direct link redirector/downloader
// @namespace    http://tampermonkey.net/
// @version      0.8
// @description  cool
// @author       You
// @match        http*://vidcloud9.com/videos/*
// @match        http*://www.vidcloud9.com/videos/*
// @match        http*://vidstreaming.io/videos/*
// @match        http*://www.vidstreaming.io/videos/*
// @match        http*://vidcloud9.com/streaming.php?*
// @match        http*://vidcloud9.com/load.php?*
// @match        http*://vidstreaming.io/streaming.php?*
// @match        http*://vidstreaming.io/load.php?*
// @match        http*://database.gdriveplayer.me/google.php?*
// @match        http*://database.gdriveplayer.me/player.php?*
// @match        http*://databasegdriveplayer.me/google.php?*
// @match        http*://databasegdriveplayer.me/player.php?*
// @match        http*://database.gdriveplayer.io/google.php?*
// @match        http*://database.gdriveplayer.io/player.php?*
// @match        http*://databasegdriveplayer.io/google.php?*
// @match        http*://databasegdriveplayer.io/player.php?*
// @match        http*://database.gdriveplayer.us/google.php?*
// @match        http*://database.gdriveplayer.us/player.php?*
// @match        http*://databasegdriveplayer.us/google.php?*
// @match        http*://databasegdriveplayer.us/player.php?*
// @match        http*://databasegdriveplayer.xyz/google.php?*
// @match        http*://databasegdriveplayer.xyz/player.php?*
// @match        http*://playhydrax.com/*
// @grant        none
// @run-at       document-start
// ==/UserScript==

(function() {
    'use strict';

    //in order to download hydrax videos, you must use a header changing extension
    //i recommend simple-modify-header:
    //firefox: https://addons.mozilla.org/en-US/firefox/addon/simple-modify-header
    //chrome: https://chrome.google.com/webstore/detail/gjgiipmpldkpbdfjkgofildhapegmmic
    //import this config: https://pastebin.com/dl/VfZGYwJW
    //and press the start button
    //then you can change the below variable to true :)
    //!!NOTE!!: make sure you turn off the header changer extension because it currently wildcards ALL .monster domains
    var justDownloadHydrax=false;

    var gdriveplayerhosts=["database.gdriveplayer.me","databasegdriveplayer.me","database.gdriveplayer.io","databasegdriveplayer.io","database.gdriveplayer.us","databasegdriveplayer.us","databasegdriveplayer.xyz"];
    if(window.location.hostname=='playhydrax.com'||window.location.hostname.endsWith('.playhydrax.com')){
        function setCookie(cname, cvalue, timeMs) {
            var d = new Date();
            d.setTime(d.getTime() + timeMs);
            var expires = "expires=" + d.toUTCString();
            document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
        }
        setCookie('isNoAds', true, 24 * 60 * 60 * 1e3);//disable ads in hydrax lol
        document.close();
        document.open();
        document.write(`<script>var urll,slug,isdone=false;slug=window.location.search.indexOf('v=')?window.location.search.match(/[?&]v=([^&]+)/)[1]:alert('error: video id not specified');var fd=new FormData();fd.append('slug',slug);var data=new URLSearchParams(fd);fetch('https://ping.idocdn.com',{method:'post',body:data}).then(d=>d.json()).then(res=>{if(!res.status)return alert('error: video id not found');urll=res.url;fetch('https://'+urll,{method:'post',body:data}).then(()=>{document.querySelector('img').src='https://ping.'+urll+'/ping.gif'});});</script>
                        <img onload="${justDownloadHydrax?`var a=document.querySelector('a');a.download=slug+'.mp4';a.href='https://www.'+urll;a.click();`:`document.querySelector('video').src='https://www.'+urll;`}"/><!--"www." makes the video HD-->
                        <video style="position:fixed;top:0;left:0;right:0;bottom:0;width:100%;height:100%;padding:0;margin:0;border:0;z-index:99999;" controls></video>
                        ${justDownloadHydrax?`<a download="hydrax.mp4">download</a>`:``}
                       `);
        document.close();
    }else{
        window.addEventListener("DOMContentLoaded",async function(){
            function endsWithAny(str,arr){
                for(var item in arr){
                    if(str.endsWith(item))return true;
                }
                return false;
            }
            if(gdriveplayerhosts.includes(window.location.hostname)||endsWithAny(window.location.hostname,gdriveplayerhosts))(new Function('eval',document.querySelectorAll("body script")[1].innerText))(function(a){
                var b=[a.slice(0,a.indexOf(';')+1),a.slice(a.indexOf(';')+1)];
                b[1]='ae'+b[1].slice(b[1].indexOf('()')+2);
                (new Function('ae',b[1]))({document:{write:function(c){
                    c=c.replace('<script>','').replace('</script>','').trim();
                    (new Function('eval',b[0]+c))(function(e){
                        (new Function('eval','player',e))(function(f){
                            var urls=f.split("{sources:[").slice(1),
                                url=f.slice(f.indexOf("if(countcheck=='")+16);
                            function finishurls(ur,i){
                                var urr=eval(ur.slice(0,ur.indexOf("]")+1).replace(/"\+countcheck\+"/g,i));
                                return urr[urr.length-1].file;
                            }
                            urls=urls.map((r,i)=>finishurls("["+r,i));
                            urls.push(eval(url.slice(url.indexOf("{jwplayer().remove();window.location='")+37,url.indexOf("}"))));
                            urls=urls.map(j=>(new URL(j,window.location.href)).href);
                            document.close();
                            document.open();
                            document.write(`<body bgcolor="black"><script>var urls=JSON.parse(atob('${btoa(JSON.stringify(urls))}'));function errhandl(v){if(v.currentSrc==urls[urls.length-1])window.location.href=v.currentSrc;}</script><video controls style="position:fixed;top:0;left:0;right:0;bottom:0;width:100%;height:100%;padding:0;margin:0;border:0;z-index:99999;">${urls.map(k=>'<source src="'+k+'"></source>').join("")}</video><script>document.querySelector("video").addEventListener('error',function(e){errhandl(this);},true);</script></body>`);
                            document.close();
                        },function(){});
                    });
                }}});
            });
            if(window.location.hostname=='vidcloud9.com'||window.location.hostname.endsWith('.vidcloud9.com')||window.location.hostname=='vidstreaming.io'||window.location.hostname.endsWith('.vidstreaming.io')){
                if(window.location.pathname.startsWith("/videos/")){
                    var currDomain=window.location.hostname;
                    try{
                        document.querySelector("iframe").outerHTML='<video controls src="'+(await (await fetch("https://"+currDomain+"/ajax.php"+document.querySelector("iframe").src.split(".php")[1])).json()).source_bk[0]["file"]+'" style="position:absolute;top:0;left:0;width:100%;height:100%;z-index:999;"></video>';
                    }catch(e){
                        console.log(e);
                    }
                }else{
                    document.querySelectorAll('li.linkserver').forEach(e=>{
                        var xd=e.innerText.toLowerCase();
                        if(xd.includes('hydrax')||xd.includes('hyrax'))location.href=e.dataset.video.replace('hydrax.net','playhydrax.com');
                    });
                }
            }
        });
    }
})();