添加新脚本
// ==UserScript==
// @name 星耀云/飞猫云/kufile/rosefile/expfile/城通网盘优化
// @namespace http://tampermonkey.net/
// @version 2.09
// @description 快速下载 精简页面
// @author huajiqaq
// @match *://*/f/*
// @match *://*/file/*
// @match *://*/d/*
// @match *://*/dir/*
// @match *://www.feimaoyun.com/s/*
// @match *://www.feimaoyun.com/index.php/*
// @match *://www.expfile.com/down*
// @match *://www.xingyaopan.com/fs/*
// @match *://rosefile.net/*
// @match *://down.tv002.com/*/*
// @match *://*/dl2.php*
// @match *://www.kufile.net/vip.php
// @match *://www.xingyaopan.com/vip.php/
// ==/UserScript==
/* globals file_id */
/* globals userid */
/* globals file_chk */
(function() {
"use strict";
var getfid;
var dlURL;
var fid;
var downurl;
var getdown;
var getxtxt;
var getxtlink;
var getxt;
var getlink;
var getpass;
//下载函数
function Download(content) {
const iframe = document.createElement("iframe");
iframe.setAttribute("hidden","hidden");
document.body.appendChild(iframe);
iframe.onload = () => {
if(iframe){
iframe.setAttribute('src','about:blank');
}
};
iframe.setAttribute("src",content);
}
//等待元素加载完毕
function waitForKeyElements(selectorOrFunction, callback, waitOnce, interval, maxIntervals) {
if (typeof waitOnce === "undefined") {
waitOnce = true;
}
if (typeof interval === "undefined") {
interval = 300;
}
if (typeof maxIntervals === "undefined") {
maxIntervals = -1;
}
var targetNodes =
typeof selectorOrFunction === "function" ? selectorOrFunction() : document.querySelectorAll(selectorOrFunction);
var targetsFound = targetNodes && targetNodes.length > 0;
if (targetsFound) {
targetNodes.forEach(function(targetNode) {
var attrAlreadyFound = "data-userscript-alreadyFound";
var alreadyFound = targetNode.getAttribute(attrAlreadyFound) || false;
if (!alreadyFound) {
var cancelFound = callback(targetNode);
if (cancelFound) {
targetsFound = false;
} else {
targetNode.setAttribute(attrAlreadyFound, true);
}
}
});
}
if (maxIntervals !== 0 && !(targetsFound && waitOnce)) {
maxIntervals -= 1;
setTimeout(function() {
waitForKeyElements(selectorOrFunction, callback, waitOnce, interval, maxIntervals);
}, interval);
}
}
//判断网盘 并执行相应事件
if (window.location.host == "www.kufile.net") {
if (window.location.pathname.split("/")[1].indexOf("vip.php") == 0) {
document.querySelector("html").innerHTML = "<head></head><body><p><font size=\"24\"><font color=\"#FF0000\">本人技术有限 无法屏蔽弹出页面 弹出本页面属于正常现象 请手动关闭</font> </font></p><br><br><p></p></body>";
}
else {
document.getElementsByClassName("adc_bottom")[0].style.display = "none";
document.getElementsByClassName("cright")[0].style.display = "none";
document.getElementsByClassName("downs")[0].style.display = "none";
document.getElementsByClassName("u3")[0].innerHTML = "";
getfid = new XMLHttpRequest();
getfid.onreadystatechange = function() {
if (getfid.readyState == 4) {
if (getfid.status == 200) {
fid = getfid.responseText.match(/down_process\('(\S*)'\)/)[1];
getdown = new XMLHttpRequest();
getdown.onreadystatechange = function() {
if (getdown.readyState == 4) {
if (getdown.status == 200) {
dlURL = getdown.responseText
document.getElementsByClassName("u3")[0].innerHTML = dlURL;
} else {
alert("请求失败 可能当前脚本不是最新版本或接口在维护");
}
}
};
downurl = "https://pandown.vercel.app/api/kufile?file=" + fid
getdown.open("get", downurl);
getdown.send(null);
} else {
alert("请求失败 可能当前脚本不是最新版本或接口在维护");
}
}
};
getfid.open("get", window.location.href);
getfid.send(null);
}
}
//判断网盘 并执行相应事件
if (window.location.host == "www.feimaoyun.com") {
//判断为电脑端执行的事件
if (window.location.pathname.split("/")[1].indexOf("s") == 0) {
getpass = new XMLHttpRequest();
getpass.onreadystatechange = function() {
if (getpass.readyState == 4) {
if (getpass.status == 200) {
if (getpass.responseText.match(/if_check_pucode":"(\S*)","auth_name/)[1] == "1") {
function pass() {
document.getElementsByClassName("banner")[0].style.display = "none";
}
waitForKeyElements(' [class="banner"]', pass);
function btn() {
document.getElementsByClassName("btn")[3].outerHTML = `<span class=\"el-input__suffix-inner\"><span class=\"btn\">立即下载</span><!----><!----><!----></span>`
}
waitForKeyElements(' [class="btn"]', btn);
function desc() {
document.getElementsByClassName("desc")[3].innerText = "请正确输入密码后点击下载 点击下载需要等待几秒 请耐心等待"
}
waitForKeyElements(' [class="desc"]', desc);
document.getElementsByClassName("btn")[3].onclick = function() {
getfid = new XMLHttpRequest();
getfid.onreadystatechange = function() {
if (getfid.readyState == 4) {
if (getfid.status == 200) {
if (getfid.responseText.match(/file_id":"(\S*)","file_name/)) {
getdown = new XMLHttpRequest();
getdown.onreadystatechange = function() {
if (getdown.readyState == 4) {
if (getdown.status == 200) {
dlURL = getdown.responseText;
Download(dlURL)
} else {
document.getElementsByClassName("desc")[3].innerText = "下载链接加载失败 请刷新网页重试"
}
}
};
downurl = "https://pandown.vercel.app/api/feimao?file=" + getfid.responseText.match(/"file_id":"(\S*)","file_name/)[1]
getdown.open("get", downurl);
getdown.send(null);
} else {
alert("输入密码错误 请检查后再次输入")
}
} else {
alert("请求失败 可能当前脚本不是最新版本或接口在维护");
}
}
};
getfid.open("POST", "https://www.feimaoyun.com/index.php/wap/file");
getfid.setRequestHeader('Content-type', 'application/x-www-form-urlencoded')
getfid.send("id=" + window.location.pathname.slice(3) + "&pucode=" + document.getElementsByClassName("el-input__inner")[1].value)
}
} else if (getpass.responseText.match(/if_check_pucode":"(\S*)","auth_name/)[1] == "0") {
function downjz() {
document.getElementsByClassName("link")[0].innerText = "下载链接未加载完毕 无法下载 加载完毕本按钮文本会更新 请耐心等待"
}
waitForKeyElements(' [class="act act1"]', downjz);
function webad() {
document.getElementsByClassName("openProCom jmloading")[0].style.display = "none";
}
waitForKeyElements(' [class="openProCom jmloading"]', webad);
function webade() {
document.getElementsByClassName("openVipCom youthVipCom")[0].style.display = "none";
}
waitForKeyElements(' [class="openVipCom youthVipCom"]', webade);
function webadq() {
document.getElementsByClassName("noVipDownBox")[0].style.display = "none";
}
waitForKeyElements(' [class="noVipDownBox"]', webadq);
getfid = new XMLHttpRequest();
getfid.onreadystatechange = function() {
if (getfid.readyState == 4) {
if (getfid.status == 200) {
fid = getfid.responseText.match(/file_id":"(\S*)","file_name/)[1];
getdown = new XMLHttpRequest();
getdown.onreadystatechange = function() {
if (getdown.readyState == 4) {
if (getdown.status == 200) {
dlURL = getdown.responseText;
document.getElementsByClassName("act act1")[0].outerHTML = `<a class=\"act act1\"><img src=\"https://webimg.fmapp.com/Public/web/img/webapp/fm2022/downa_icon_2.png\" class=\"img\"> <span>\n VIP/Pro会员下载\n <!----></span></a>`
document.getElementsByClassName("act act1")[0].onclick = function() {
Download(dlURL)
}
} else {
document.getElementsByClassName("act act1")[0].innerText = "下载链接加载失败 请刷新网页重试"
}
}
};
downurl = "https://www.qq1000.com/wp-content/uploads/2022/07/4t5O1u.png" class="downBtnBg"> <div class="downCon rowcenter"><img src="https://imges.qq1000.com/qq1000/2022/07/22/05f2606f4318511c125d3ca6c40ab76e.png" class="downIcon"><span class="downtxt">VIP下载</span></div></a>`
document.getElementsByClassName("downBtnBox")[0].onclick = function() {
Download(dlURL)
}
} else {
document.getElementsByClassName("username")[0].innerText = "下载链接加载失败 请刷新网页重试"
}
}
};
downurl = "https://www.qq1000.com/wp-content/uploads/2022/07/4t5O1u.png') {
console.log(localStorage.getItem("ctdownxianlu"))
if (localStorage.getItem("ctdownxianlu") === null) {
localStorage.setItem("ctdownmode","一");
localStorage.setItem("ctdownxianlu","https://773mfa0k57347.cfc-execute.bj.baidubce.com/ctdown/");
}
//判断是否为手机页面
function mobile() {
//判断数值是否存在
if (localStorage.getItem("mobilemode") === null) {
localStorage.setItem("mobilemode",1);
location.reload();
}
//一般用不到 防止用户切换界面
if (localStorage.getItem("mobilemode") === "0") {
var error;
var r = confirm("使用的是手机版网页吗? 如果是请点击确定 手机版如果不能使用请及时更新脚本 确认后大约需要加载2秒 请耐心等待");
if (r == true) {
localStorage.setItem("mobilemode","1");
location.reload();
} else {
error = "很抱歉 不开启会影响脚本使用 如果判断错误请联系作者恢复 如果是直接进入此网页 请尝试刷新网页";
document.write(error);
}
}
}
waitForKeyElements(' [class="alert alert-light mb-0"]', mobile);
//判断是否为电脑界面
function pc() {
//判断数值是否存在
if (localStorage.getItem("mobilemode") === null) {
localStorage.setItem("mobilemode","0");
location.reload();
}
//一般用不到 防止用户切换界面
if (localStorage.getItem("mobilemode") === "1") {
var error;
var r = confirm("使用的是电脑网页吗?如果是请点击确定 确认后大约需要加载2秒 请耐心等待");
if (r == true) {
localStorage.setItem("mobilemode",0);
location.reload();
} else {
error = "很抱歉 不开启会影响脚本使用 如果判断错误请联系作者恢复 如果直接进入此网页 请尝试刷新网页";
document.write(error);
}
}
}
waitForKeyElements(' [class="btn btn-warning ml-3"]', pc);
//当检测为下载界面时执行的代码
if (window.location.pathname.split("/")[1].indexOf("f") == 0) {
//判断是否为电脑界面
if (localStorage.getItem("mobilemode") === "0") {
//增加提示文字
function loadingtext() {
if (typeof document.getElementsByClassName("text-white mb-2")[1] === "undefined") {
let cstext = document.createElement("h4");
cstext.innerText = "小提示:点击后需要等待几秒后才能下载 请耐心等待 谢谢配合";
cstext.className = "text-white mb-2";
document.getElementsByClassName("col")[0].insertBefore(cstext, document.getElementsByClassName("text-white mb-2")[0].nextSibling);
}
}
waitForKeyElements(' [class="row text-white align-items-center no-gutters"]', loadingtext);
//显示VIP下载 隐藏购买VIP页面
function vipdown() {
document.getElementsByClassName("card-deck")[0].style.display = "block";
document.getElementsByClassName("card-deck")[1].style.display = "none";
}
waitForKeyElements(' [class="card-deck"]', vipdown);
function buyvip() {
document.getElementsByClassName("row no-gutters")[1].style.display = "none";
}
waitForKeyElements(' [class="row no-gutters"]', buyvip);
//隐藏广告
function webad() {
document.getElementsByClassName("card bg-light mb-3")[2].style.display = "none";
}
waitForKeyElements(' [class="card bg-light mb-3"]', webad);
//对于一些不支持的功能进行隐藏
function notsupport() {
document.getElementsByClassName("mb-3")[1].style.display = "none";
}
waitForKeyElements(' [class="mb-3"]', notsupport);
//重写下载按钮
function dxdown() {
getxt = new XMLHttpRequest();
getxt.onreadystatechange = function() {
if (getxt.readyState == 4) {
if (getxt.status == 200) {
getxtlink = getxt.responseText.match(/xt_link":"(\S*)","file_name/)[1]
} else {
alert("请求失败 可能当前脚本不是最新版本或接口在维护");
}
}
};
getxtxt = "https://webapi.ctfile.com/get_file_url.php?uid=" + userid + "&fid=" + file_id + "&file_chk=" + file_chk + "&app=1&acheck=2&rd=" + Math.random()
getxt.open("get", getxtxt);
getxt.send(null);
document.getElementsByClassName("btn btn-outline-secondary fs-1 mt-3")[0].onclick = function() {
getlink = new XMLHttpRequest();
getlink.onreadystatechange = function() {
if (getlink.readyState == 4) {
if (getlink.status == 200) {
dlURL = getlink.responseText;
Download(dlURL);
} else {
alert("请求失败 可能当前脚本不是最新版本或接口在维护");
}
}
};
downurl = localStorage.getItem("ctdownxianlu") + "电信/?file=" + file_id + "&xtlink=ctfile://xturl" + getxtlink
getlink.open("get", downurl);
getlink.send(null);
};
}
waitForKeyElements(' [class="btn btn-outline-secondary fs-1 mt-3"]', dxdown);
function ltdown() {
getxt = new XMLHttpRequest();
getxt.onreadystatechange = function() {
if (getxt.readyState == 4) {
if (getxt.status == 200) {
getxtlink = getxt.responseText.match(/xt_link":"(\S*)","file_name/)[1]
} else {
alert("请求失败 可能当前脚本不是最新版本或接口在维护");
}
}
};
getxtxt ="https://webapi.ctfile.com/get_file_url.php?uid=" + userid + "&fid=" + file_id + "&file_chk=" + file_chk + "&app=1&acheck=2&rd=" + Math.random()
getxt.open("get", getxtxt);
getxt.send(null);
document.getElementsByClassName("btn btn-outline-info fs-1 mt-3")[0].onclick = function() {
getlink = new XMLHttpRequest();
getlink.onreadystatechange = function() {
if (getlink.readyState == 4) {
if (getlink.status == 200) {
dlURL = getlink.responseText;
Download(dlURL);
} else {
alert("请求失败 可能当前脚本不是最新版本或接口在维护");
}
}
};
downurl = localStorage.getItem("ctdownxianlu")+ "/联通/?file=" + file_id + "&xtlink=ctfile://xturl" + getxtlink
getlink.open("get", downurl);
getlink.send(null);
};
}
waitForKeyElements(' [class="btn btn-outline-info fs-1 mt-3"]', ltdown);
function yddown() {
getxt = new XMLHttpRequest();
getxt.onreadystatechange = function() {
if (getxt.readyState == 4) {
if (getxt.status == 200) {
getxtlink = getxt.responseText.match(/xt_link":"(\S*)","file_name/)[1]
} else {
alert("请求失败 可能当前脚本不是最新版本或接口在维护");
}
}
};
getxtxt = "https://webapi.ctfile.com/get_file_url.php?uid=" + userid + "&fid=" + file_id + "&file_chk=" + file_chk + "&app=1&acheck=2&rd=" + Math.random()
getxt.open("get", getxtxt);
getxt.send(null);
document.getElementsByClassName("btn btn-outline-dark fs-1 mt-3")[0].onclick = function() {
getlink = new XMLHttpRequest();
getlink.onreadystatechange = function() {
if (getlink.readyState == 4) {
if (getlink.status == 200) {
dlURL = getlink.responseText;
Download(dlURL);
} else {
alert("请求失败 可能当前脚本不是最新版本或接口在维护");
}
}
};
downurl = localStorage.getItem("ctdownxianlu")+ "移动/?file=" + file_id + "&xtlink=ctfile://xturl" + getxtlink
getlink.open("get", downurl);
getlink.send(null);
};
}
waitForKeyElements(' [class="btn btn-outline-dark fs-1 mt-3"]', yddown);
//隐藏推广搜索按钮
function searchad() {
document.getElementsByClassName("nav-item")[0].style.display = "none";
}
waitForKeyElements(' [class="nav-item"]', searchad);
}
//判断是否为手机界面
if (localStorage.getItem("mobilemode") === "1") {
//增加提示文字
function loadingtext() {
if (typeof document.getElementsByClassName("text-white mb-3")[1] === "undefined") {
let cstext = document.createElement("h5");
cstext.innerText = "小提示:点击后需要等待几秒后才能下载 请耐心等待 谢谢配合";
cstext.className = "text-white mb-3";
document.getElementsByClassName("col")[0].insertBefore(cstext, document.getElementsByClassName("text-white mb-3")[0].nextSibling);
}
}
waitForKeyElements(' [class="row text-white align-items-center no-gutters"]', loadingtext);
//显示VIP下载
function vipdown() {
document.getElementsByClassName("card-deck")[0].style.display = "block";
document.getElementsByClassName("card-deck")[1].style.display = "none";
}
waitForKeyElements(' [class="card-deck"]', vipdown);
//隐藏广告
function webad() {
document.getElementById("mobile-500x200")
.style.display = "none";
}
waitForKeyElements(' [id="mobile-500x200"]', webad);
//重写下载按钮
function down() {
getxt = new XMLHttpRequest();
getxt.onreadystatechange = function() {
if (getxt.readyState == 4) {
if (getxt.status == 200) {
getxtlink = getxt.responseText.match(/xt_link":"(\S*)","file_name/)[1]
} else {
alert("请求失败 可能当前脚本不是最新版本或接口在维护");
}
}
};
getxtxt = "https://webapi.ctfile.com/get_file_url.php?uid=" + userid + "&fid=" + file_id + "&file_chk=" + file_chk + "&app=1&acheck=2&rd=" + Math.random()
getxt.open("get", getxtxt);
getxt.send(null);
if (typeof document.getElementsByClassName("btn btn-outline-secondary fs-1 mt-3")[2] === "undefined") {
document.getElementsByClassName("btn btn-outline-secondary fs-1 mt-3")[0].innerText = "电信下载";
document.getElementsByClassName("btn btn-outline-secondary fs-1 mt-3")[0].onclick = function() {
getlink = new XMLHttpRequest();
getlink.onreadystatechange = function() {
if (getlink.readyState == 4) {
if (getlink.status == 200) {
dlURL = getlink.responseText;
Download(dlURL);
} else {
alert("请求失败 可能当前脚本不是最新版本或接口在维护");
}
}
};
downurl = localStorage.getItem("ctdownxianlu")+ "/电信/?file=" + file_id + "&xtlink=ctfile://xturl" + getxtlink
getlink.open("get", downurl);
getlink.send(null);
};
let lt = document.createElement("a");
lt.innerText = "联通下载";
lt.className = "btn btn-outline-secondary fs-1 mt-3";
lt.onclick = function() {
getlink = new XMLHttpRequest();
getlink.onreadystatechange = function() {
if (getlink.readyState == 4) {
if (getlink.status == 200) {
dlURL = getlink.responseText;
Download(dlURL);
} else {
alert("请求失败 可能当前脚本不是最新版本或接口在维护");
}
}
};
downurl = localStorage.getItem("ctdownxianlu")+ "/联通/?file=" + file_id + "&xtlink=ctfile://xturl" + getxtlink
getlink.open("get", downurl);
getlink.send(null);
};
document.getElementsByClassName("card-body position-relative")[0].append(lt);
let yd = document.createElement("a");
yd.innerText = "移动下载";
yd.className = "btn btn-outline-secondary fs-1 mt-3";
yd.onclick = function() {
getlink = new XMLHttpRequest();
getlink.onreadystatechange = function() {
if (getlink.readyState == 4) {
if (getlink.status == 200) {
dlURL = getlink.responseText;
Download(dlURL);
} else {
alert("请求失败 可能当前脚本不是最新版本或接口在维护");
}
}
};
downurl = localStorage.getItem("ctdownxianlu")+ "/移动/?file=" + file_id + "&xtlink=ctfile://xturl" + getxtlink
getlink.open("get", downurl);
getlink.send(null);
};
document.getElementsByClassName("card-body position-relative")[0].append(yd);
}
}
waitForKeyElements(' [class="btn btn-outline-secondary fs-1 mt-3"]', down);
}
}
//当检测为目录界面时执行的代码
if (window.location.pathname.split("/")[1].indexOf("d") == 0) {
//判断是否为电脑节目
if (localStorage.getItem("mobilemode") === "0") {
//隐藏网站广告
function webad() {
document.getElementsByClassName("card bg-light mb-3")[1].style.display = "none";
}
waitForKeyElements(' [class="card bg-light mb-3"]', webad);
//对于一些不支持的功能进行隐藏或提示
function notsupport() {
document.getElementsByClassName("btn btn-falcon-default mr-2")[2].style.display = "none";
document.getElementsByClassName("btn btn-falcon-default mr-2")[3].style.display = "none";
document.getElementsByClassName("btn btn-falcon-default mr-2")[5].style.display = "none";
document.getElementsByClassName("btn btn-falcon-default mr-2")[4].onclick = function() {
alert("很抱歉 此功能无法实现 本人技术有限");
};
}
waitForKeyElements(' [id="dashboard-actions"]', notsupport);
//隐藏推广搜索按钮
function searchad() {
document.getElementsByClassName("nav-item")[0].style.display = "none";
}
waitForKeyElements(' [class="nav-item"]', searchad);
}
//判断是否为手机界面
if (localStorage.getItem("mobilemode") === "1") {
//去除搜索广告
function searchad() {
document.getElementsByClassName("btn btn-warning btn-sm")[0].style.display = "none";
}
waitForKeyElements(' [class="btn btn-warning btn-sm ml-2"]', searchad);
}
}
}
}
//某些特殊情况的判断
//判断城通网盘异常跳转
if (window.location.host == "down.tv002.com" && window.location.pathname.split("/")[1].indexOf("premium") == 0) {
var error;
var r = confirm("解析失败 请问是否切换线路二 还不行请手动尝试每个线路可用性 如果文件大于2GB可委托代下 代下请把链接发送到[email protected] 当前为线路"+ localStorage.getItem("ctdownmode"));
if (r == true) {
if (localStorage.getItem("ctdownmode") == "一") {
localStorage.setItem("ctdownxianlu","https://pandown.vercel.app/api/ctfile/")
localStorage.setItem("ctdownmode","二")
location.reload()
} else {
localStorage.setItem("ctdownxianlu","https://773mfa0k57347.cfc-execute.bj.baidubce.com/ctdown/")
localStorage.setItem("ctdownmode","一")
location.reload()
}
} else {
}
}
//判断网盘异常跳转
if (document.querySelector("body > p:nth-child(2) > font > a")) {
if (document.querySelector("body > p:nth-child(2) > font > a").innerText=="点击购买") {
document.querySelector("html").innerHTML = "<head></head><body class=\" pace-done\"><p><font size=\"24\"><font color=\"#FF0000\">文件可能还没同步到当前服务器,请等待几分钟后再下载</font> </font></p><br><br><p></p></body>"
}
}
})();
测试了expfile可以rosefile不行
© 版权声明
THE END
暂无评论内容