Digit77 Helper

Digit77下载助手。自动复制提取码,跳过ouo.io的三秒等待时间!

  1. // ==UserScript==
  2. // @name Digit77 Helper
  3. // @namespace cn.XYZliang.digit77Helper
  4. // @version 2.3
  5. // @description Digit77下载助手。自动复制提取码,跳过ouo.io的三秒等待时间!
  6. // @require https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.slim.min.js
  7. // @license GNU General Public License v3.0
  8. // @author XYZliang
  9. // @supportURL https://qianniuossplus.jxufesoftware.club/README.html
  10. // @homepage https://gf.qytechs.cn/zh-CN/scripts/445961-digit77-helper
  11. // @match *://www.digit77.com/*
  12. // @match *://ouo.press/*
  13. // @match *://ouo.io/*
  14. // @match *://app.mediatrack.cn/shares/*
  15. // @match *://app.mediatrack.cn/shares/*
  16. // @match *://download.kstore.space/download/2078/Digit77Helper/*
  17. // @match *://*.sharepoint.com/*
  18. // @match *://www.aliyundrive.com/*
  19. // @match *://cloud.189.cn/*
  20. // @match *://*.jxufesoftware.club/*
  21. // @match *://www.wulihub.com.cn/gc/JPKAvA/*
  22. // @icon https://www.digit77.com/lib/img/logo.svg
  23. // @grant unsafeWindow
  24. // @grant GM_setClipboard
  25. // @grant GM_setValue
  26. // @grant GM_getValue
  27. // @grant GM_deleteValue
  28. // @grant GM_listValues
  29. // @grant GM_xmlhttpRequest
  30. // @grant GM_notification
  31. // @run-at document-end
  32. // @connect *
  33.  
  34. // ==/UserScript==
  35. /* globals jQuery, $ */
  36.  
  37. // 用户设置
  38. let seeting = GM_getValue("seeting")
  39. if (seeting == null || seeting.length == 0 || seeting == undefined || seeting) {
  40. seeting = "{\"autofill\":true,\"ouo\":true,\"unzip\":true,\"fenmiaozhen\":true,\"baidu\":true,\"onedriver\":true,\"tianyi\":true,\"aliyun\":true,\"error\":true,\"fmzautofill\":true,\"fmzautodown\":true,\"fmzautofav\":false,\"fmzautosave\":false,\"bdautofill\":true,\"bdautodown\":true,\"bdautosave\":false,\"odautofill\":true,\"odautodown\":false,\"tyautofill\":true,\"tyautodown\":true,\"tyautosave\":false,\"alautofill\":true,\"alautodown\":true,\"alautosave\":false}"
  41. GM_setValue("seeting", seeting)
  42. }
  43. seeting = JSON.parse(seeting)
  44. let values = GM_listValues()
  45. if (values.length > 200) {
  46. for (let i = 0; i < values.length; i++) {
  47. if (values[i] != "seeting") {
  48. GM_deleteValue(values[i])
  49. }
  50. }
  51. consoleLog("已自动清除缓存!")
  52. }
  53. // 脚本代码
  54. 'use strict';
  55. let url = location.host;
  56. consoleLog("Digit77 Helper 加载成功!")
  57. if (url == "www.digit77.com" && seeting.autofill) {
  58. if ($("#history_version details").length > 0) {
  59. $("#history_version th")[2].innerText = "下载链接(已开启Digit77 Helper自动复制提取码)"
  60. $("#history_version a").each(function () {
  61. let codeText = this.innerHTML;
  62. let code = codeText.split(" ")[1]
  63. if (code != undefined) {
  64. let ouoLinkCode = (this.href).split("/")
  65. GM_setValue(ouoLinkCode[ouoLinkCode.length - 1], code);
  66. // this.addEventListener('click', function () {
  67. // let text=code
  68. // GM_setClipboard(text)
  69. // });
  70. }
  71. })
  72. let frontElement = $("#history_version details")[0]
  73. let insertHtml = '<details style="margin-top: 20px;">' +
  74. '<summary style="background-color: crimson;">Digit77 Helper设置</summary>' +
  75. ' <div class="table-wrapper" style="padding-right: 10px;overflow-x: hidden;">' +
  76. '<iframe src="https://download.kstore.space/download/2078/Digit77Helper/index.html" style="border: 5px solid #e835351a;border-radius: 10px;width: 100%;height: 400px;overflow-x: hidden;">' +
  77. '</iframe></div>' +
  78. '</details>'
  79. frontElement.insertAdjacentHTML('afterend', insertHtml);
  80. }
  81. } else if (url.indexOf("ouo") != -1 && seeting.ouo) {
  82. consoleLog("正在跳过ouo")
  83. $(document).ready(function () {
  84. $("h4").innerText = "Digit77 Help正在跳过等待!"
  85. $(".btn-main").innerText = "欢迎使用Digit77 Helper"
  86. })
  87. if (location.pathname.split("/")[1] == "go") {
  88. let reallyUrlGeter = location.origin + "/xreallcygo/" + location.pathname.split("/")[2]
  89. let reallyUrlData = $("#form-go").serializeArray()
  90. GM_xmlhttpRequest({
  91. method: "POST",
  92. url: reallyUrlGeter,
  93. data: $.param(reallyUrlData),
  94. headers: {
  95. "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
  96. },
  97. onload: function (response) {
  98. let url = addGetParameter(response.finalUrl, "Digit77HelperPwd", GM_getValue(location.pathname.split("/")[2]))
  99. if (response.status == 200) {
  100. //延长一下待在页面的时间,提升广告的佣金?
  101. setTimeout(function () {
  102. window.location.href = url
  103. }, 1000)
  104. } else {
  105. failedToGetJumpAddress(GM_getValue(location.pathname.split("/")[2]))
  106. }
  107. },
  108. onerror: function () {
  109. failedToGetJumpAddress(GM_getValue(location.pathname.split("/")[2]))
  110. }
  111. });
  112. } else {
  113. //延长一下待在页面的时间,提升广告的佣金?
  114. setTimeout(function () {
  115. $(".btn-main").click()
  116. }, 1500)
  117. }
  118. } else if (url == "app.mediatrack.cn" && seeting.fenmiaozhen) {
  119. let pass = getUrlParam("Digit77HelperPwd")
  120. if ((pass != null || pass != "") && seeting.fmzautofill) {
  121. let code = (location.pathname).split("/")[2]
  122. let keyName = "mtweb_" + code + "password"
  123. let extractCodeThere = false
  124. if (localStorage.getItem(keyName) != null) {
  125. extractCodeThere = true
  126. consoleLog("提取码存在!延期提取码。")
  127. } else {
  128. extractCodeThere = false
  129. consoleLog("提取码不存在!注入提取码。")
  130. }
  131. //{"value":"9742","options":{"seconds":86400},"expiredAt":1654346827431,"createAt":1654260427431}
  132. let now = new Date().getTime()
  133. let expiredTime = 24 * 60 * 60
  134. let codeValue = {
  135. "value": pass,
  136. "options": {
  137. "seconds": expiredTime
  138. },
  139. "expiredAt": now + expiredTime * 1000,
  140. "createAt": now
  141. }
  142. window.localStorage.setItem(keyName, JSON.stringify(codeValue))
  143. consoleLog("已注入提取" + pass)
  144. if (!extractCodeThere) {
  145. window.location.reload()
  146. }
  147. } else {
  148. consoleLog("没有提取码或未打开功能!")
  149. }
  150. let time = setInterval(function () {
  151. let fun = document.getElementsByClassName("MuiButtonBase-root MuiButton-root MuiButton-contained btn normal")
  152. if (fun.length > 2) {
  153. if (seeting.fmzautodown) {
  154. fun[2].click()
  155. let time1 = setInterval(function () {
  156. let downFun = $(":contains(确定)")
  157. if (downFun.length > 0) {
  158. consoleLog("检测到下载框")
  159. clearInterval(time1)
  160. setTimeout(function () {
  161. downFun[downFun.length -1].click()
  162. copyUnzipPwd()
  163. }, 500)
  164. }
  165. }, 333)
  166. }
  167. if (seeting.fmzautofav) {
  168. fun[0].click()
  169. }
  170. if (seeting.fmzautosave) {
  171. fun[1].click()
  172. }
  173. clearInterval(time)
  174. }
  175. }, 333)
  176. } else if (url.indexOf("sharepoint.com") != -1 && seeting.onedriver) {
  177. if (location.pathname.indexOf("onedrive.aspx") == -1) {
  178. consoleLog("非下载页面")
  179. if (seeting.odautofill && getUrlParam("Digit77HelperPwd") != null) {
  180. document.getElementById("txtPassword").value = getUrlParam("Digit77HelperPwd")
  181. document.getElementById("btnSubmitPassword").click();
  182. }
  183. } else {
  184. consoleLog("下载页面")
  185. if (seeting.odautodown) {
  186. let time = setInterval(function () {
  187. let downFun = document.getElementsByName("下载")
  188. if (downFun.length > 0) {
  189. consoleLog("检测到下载框")
  190. clearInterval(time)
  191. setTimeout(function () {
  192. downFun[0].click()
  193. copyUnzipPwd()
  194. }, 333)
  195. }
  196. }, 333)
  197. }
  198. }
  199. } else if (url = "www.aliyundrive.com" && document.title == "阿里云盘分享" && seeting.aliyun) {
  200. function downSave() {
  201. let time = setInterval(function () {
  202. let downFun = document.getElementsByClassName("ant-dropdown-trigger")
  203. if (downFun.length > 0) {
  204. clearInterval(time)
  205. setTimeout(function () {
  206. document.getElementsByClassName("ant-dropdown-trigger")[1].click()
  207. if (seeting.alautodown) {
  208. let time = setInterval(function () {
  209. let downFun = $(":contains(下载)")
  210. if (downFun.length > 10) {
  211. consoleLog("检测到下载框")
  212. clearInterval(time)
  213. setTimeout(function () {
  214. downFun[downFun.length - 1].click()
  215. copyUnzipPwd()
  216. }, 333)
  217. }
  218. }, 333)
  219. }
  220. if (seeting.alautosave) {
  221. let time = setInterval(function () {
  222. let saveFun = $(":contains(转存)")
  223. if (saveFun.length > 5) {
  224. consoleLog("检测到转存框")
  225. clearInterval(time)
  226. setTimeout(function () {
  227. saveFun[saveFun.length - 1].click()
  228. }, 333)
  229. }
  230. }, 333)
  231. }
  232. }, 333)
  233. }
  234. }, 333)
  235.  
  236. }
  237. let time = setInterval(function () {
  238. let saveFun = $(":contains(下载)")
  239. if (saveFun.length > 5) {
  240. consoleLog("加载完成")
  241. clearInterval(time)
  242. if ($(":contains(极速查看文件)").length > 0 && seeting.alautofill) {
  243. let input = ['.ant-input', 'input[type="text"]']
  244. let button = ['.button--fep7l', 'button[type="submit"]']
  245. doFillAction(input, button, getUrlParam("Digit77HelperPwd"));
  246. downSave()
  247. } else {
  248. downSave()
  249. }
  250. }
  251. }, 333)
  252. } else if (location.host == "cloud.189.cn" && seeting.tianyi) {
  253. function downSave() {
  254. if (seeting.tyautodown) {
  255. let time = setInterval(function () {
  256. let downFun = $(":contains(下载)")
  257. if (downFun.length > 10) {
  258. consoleLog("检测到下载框")
  259. clearInterval(time)
  260. setTimeout(function () {
  261. $(".btn-download")[0].click()
  262. }, 333)
  263. }
  264. }, 333)
  265. }
  266. if (seeting.tyautosave) {
  267. let time = setInterval(function () {
  268. let saveFun = $(":contains(转存)")
  269. if (saveFun.length > 5) {
  270. consoleLog("检测到转存框")
  271. clearInterval(time)
  272. setTimeout(function () {
  273. document.getElementsByClassName("btn-save-as")[0].click()
  274. }, 333)
  275. }
  276. }, 333)
  277. }
  278. }
  279. let time = setInterval(function () {
  280. let saveFun = $(":contains(属于私密分享)")
  281. if (saveFun.length > 5) {
  282. consoleLog("加载完成")
  283. clearInterval(time)
  284. let notice = $(":contains(属于私密分享)")
  285. setTimeout(function () {
  286. if ($(notice[notice.length - 1]).is(":visible") && seeting.tyautofill) {
  287. var input = ['.access-code-item #code_txt']
  288. var button = ['.access-code-item .visit']
  289. doFillAction(input, button, getUrlParam("Digit77HelperPwd"));
  290. downSave()
  291. } else {
  292. downSave()
  293. }
  294. }, 1000)
  295. }
  296. }, 333)
  297. } else {
  298. if ($(":contains(Helper设置)").length > 5) {
  299. consoleLog("进入设置页面!")
  300. document.getElementById("save").addEventListener('click', function () {
  301. let data = sumbit()
  302. GM_setValue("seeting", data);
  303. GM_notification("设置保存成功!", "Digit77 Helper")
  304. })
  305. document.getElementById("clean").addEventListener('click', function () {
  306. let datas = GM_listValues()
  307. for (let i = 0; i < datas.length; i++) {
  308. if (datas[i] != "seeting") {
  309. GM_deleteValue(datas[i])
  310. }
  311. }
  312. GM_notification("设置清除成功!", "Digit77 Helper")
  313. })
  314. let inputs = $("#seeting input")
  315. inputs.each(function () {
  316. let key = this.id
  317. this.checked = seeting[key]
  318. })
  319. updateForm()
  320. }
  321. }
  322.  
  323. function failedToGetJumpAddress(pwd) {
  324. if (!seeting.error) {
  325. return
  326. }
  327. GM_notification("获取ouo跳转链接失败!这导致无法自动填写提取码,请手动粘贴提取码!", "Digit77 helper错误")
  328. GM_setClipboard(pwd)
  329. }
  330.  
  331. function addGetParameter(url, name, value) {
  332. url += (url.split("?")[1] ? "&" : "?") + name + "=" + value;
  333. return url;
  334. }
  335.  
  336. function getUrlParam(name) {
  337. var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
  338. var r = window.location.search.substr(1).match(reg); //匹配目标参数
  339. if (r != null) return encodeURI(r[2]);
  340. return null; //返回参数值
  341. }
  342.  
  343. function consoleLog(text) {
  344. console.log("%c" + text, "color: #ff0000; font-size: 16px; font-weight: bold;");
  345. }
  346.  
  347. function insterScript(src, type) {
  348. var importJs = document.createElement('script') //在页面新建一个script标签
  349. importJs.setAttribute("type", type) //给script标签增加type属性
  350. importJs.setAttribute("src", src) //给script标签增加src属性, url地址为cdn公共库里的
  351. document.body.insertBefore(importJs, document.body.firstChild)
  352. }
  353.  
  354. function sumbit() {
  355. let inputs = $("#seeting input")
  356. let datas = {}
  357. inputs.each(function () {
  358. datas[$(this).attr("id")] = this.checked
  359. })
  360. let data = JSON.stringify(datas)
  361. return data
  362. }
  363.  
  364. function updateForm(notFirst = true) {
  365. let inputs = $("#seeting input")
  366. inputs.each(function () {
  367. let id = $(this).attr("id")
  368. switch (id) {
  369. case "fenmiaozhen":
  370. if (this.value == "on" || notFirst)
  371. openfmz.click()
  372. break
  373. case "baidu":
  374. if (this.value == "on" || notFirst)
  375. openbd.click()
  376. break
  377. case "onedriver":
  378. if (this.value == "on" || notFirst)
  379. openod.click()
  380. break
  381. case "tianyi":
  382. if (this.value == "on" || notFirst)
  383. openty.click()
  384. break
  385. case "aliyun":
  386. if (this.value == "on" || notFirst)
  387. openal.click()
  388. break
  389. }
  390. })
  391. }
  392.  
  393. function copyUnzipPwd(){
  394. GM.GM_setClipboard("digit77.com")
  395. }
  396. //  以下代码修改自 网盘智能识别助手
  397. let util = {
  398. clog(c) {
  399. console.group('[网盘智能识别助手]');
  400. console.log(c);
  401. console.groupEnd();
  402. },
  403.  
  404. parseQuery(name) {
  405. let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
  406. let r = location.search.substr(1).match(reg);
  407. if (r != null) return (r[2]);
  408. return null;
  409. },
  410.  
  411. getValue(name) {
  412. return GM_getValue(name);
  413. },
  414.  
  415. setValue(name, value) {
  416. GM_setValue(name, value);
  417. },
  418.  
  419. sleep(time) {
  420. return new Promise((resolve) => setTimeout(resolve, time));
  421. },
  422.  
  423. addStyle(id, tag, css) {
  424. tag = tag || 'style';
  425. let doc = document,
  426. styleDom = doc.getElementById(id);
  427. if (styleDom) return;
  428. let style = doc.createElement(tag);
  429. style.rel = 'stylesheet';
  430. style.id = id;
  431. tag === 'style' ? style.innerHTML = css : style.href = css;
  432. document.head.appendChild(style);
  433. },
  434.  
  435. isHidden(el) {
  436. try {
  437. return el.offsetParent === null;
  438. } catch (e) {
  439. return false;
  440. }
  441. },
  442.  
  443. query(selector) {
  444. if (Array.isArray(selector)) {
  445. let obj = null;
  446. for (let i = 0; i < selector.length; i++) {
  447. let o = document.querySelector(selector[i]);
  448. if (o) {
  449. obj = o;
  450. break;
  451. }
  452. }
  453. return obj;
  454. }
  455. return document.querySelector(selector);
  456. }
  457. };
  458.  
  459. function doFillAction(inputSelector, buttonSelector, pwd) {
  460. let maxTime = 10;
  461. let ins = setInterval(async () => {
  462. maxTime--;
  463. let input = util.query(inputSelector);
  464. let button = util.query(buttonSelector);
  465. if (input && !util.isHidden(input)) {
  466. clearInterval(ins);
  467. let lastValue = input.value;
  468. input.value = pwd;
  469. //Vue & React 触发 input 事件
  470. let event = new Event('input', {
  471. bubbles: true
  472. });
  473. let tracker = input._valueTracker;
  474. if (tracker) {
  475. tracker.setValue(lastValue);
  476. }
  477. input.dispatchEvent(event);
  478. await util.sleep(500); //1秒后点击按钮
  479. button.click();
  480.  
  481. } else {
  482. maxTime === 0 && clearInterval(ins);
  483. }
  484. }, 333);
  485. }

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址