zimuku

zimuku明细页直接显示下载地址

  1. // ==UserScript==
  2. // @name zimuku
  3. // @namespace http://tampermonkey.net/
  4. // @version 3.11
  5. // @description zimuku明细页直接显示下载地址
  6. // @author backrock12
  7. // @match *zmk.pw/*
  8. // @include /.*zimuku\..*\/.*/
  9. // @require http://libs.baidu.com/jquery/2.0.0/jquery.min.js
  10. // @grant GM_xmlhttpRequest
  11. // @grant GM_download
  12. // @license MIT
  13. // ==/UserScript==
  14.  
  15. (function () {
  16. "use strict";
  17.  
  18. async function gethtml(url) {
  19. return new Promise((resolve, reject) => {
  20. GM_xmlhttpRequest({
  21. url: url,
  22. method: "GET",
  23. onload: function (response) {
  24. resolve(response.responseText);
  25. },
  26. });
  27. });
  28. }
  29.  
  30. async function showurl() {
  31. let lhref = location.href;
  32. lhref = lhref.replace("/detail/", "/dld/");
  33.  
  34. const htmltxt = await gethtml(lhref);
  35.  
  36. if (!htmltxt) return;
  37. let doc = $("<html></html>");
  38. doc.html(htmltxt);
  39. let td = doc.find(".col-xs-12 td:nth-child(1) div");
  40. //console.log(td);
  41.  
  42. const subinfo = $(".subinfo");
  43. subinfo.append(td);
  44. }
  45.  
  46. function noad() {
  47. function subnoad(csspath) {
  48. const ad1 = $(csspath);
  49. if (csspath.length > 0) ad1.css("display", "none");
  50. }
  51.  
  52. subnoad(".table");
  53. subnoad("div.tbhd");
  54. subnoad("font[color=#ca6445]");
  55. subnoad(".rside");
  56. subnoad(".rater-click-tips");
  57. subnoad(".rater-star-item-tips");
  58. }
  59.  
  60. async function subdown(url) {
  61. url = url.replace("/detail/", "/dld/");
  62. const htmltxt = await gethtml(url);
  63.  
  64. if (!htmltxt) return;
  65. let doc = $("<html></html>");
  66. doc.html(htmltxt);
  67. let td = doc.find(".down ul li a");
  68. if (td.length == 0) {
  69. alert("获取下载页失败");
  70. }
  71. const durl = td[0].href;
  72. td[0].click();
  73. console.log(durl);
  74.  
  75. return;
  76. GM_xmlhttpRequest({
  77. url: durl,
  78. method: "GET",
  79. onload: function (response) {
  80. console.log(response.finalUrl);
  81. },
  82. });
  83.  
  84. return;
  85. GM_download({
  86. url: durl,
  87. name: "name",
  88. onerror: (error) => {
  89. console.log(url);
  90. console.log(error);
  91. alert("下载失败");
  92. },
  93. });
  94. }
  95.  
  96. function showtable() {
  97. var ischeckbox = false;
  98.  
  99. //const alist = $("#subtb td.first a");
  100. const alist = $("table td.first > a");
  101.  
  102. alist.each((i, e) => {
  103. if (e.getAttribute("SHOWTABLE") == "true") {
  104. return;
  105. }
  106. e.setAttribute("SHOWTABLE", "true");
  107.  
  108. console.log(e.href);
  109.  
  110. const td = document.createElement("td");
  111. const button = document.createElement("button");
  112. button.id = "TALLDownBtnpage";
  113. button.textContent = "下载";
  114. button.className = "btn btn-md btn-default btn-sm";
  115. button.onclick = () => {
  116. subdown(e.href);
  117. };
  118. td.append(button);
  119. e.parentNode.parentNode.append(td);
  120.  
  121. //---------------------
  122. //insertcheckbox(e, i);
  123. });
  124.  
  125. function insertcheckbox(e, i) {
  126. function alldown() {
  127. const list = $("input[type='checkbox']:checked");
  128. //console.log(list);
  129. list.each(async (i, e) => {
  130. const vurl = $(e).attr("value");
  131. if (vurl) {
  132. await subdown(vurl);
  133. }
  134. });
  135. }
  136.  
  137. if (!ischeckbox) {
  138. $("th.first").before(
  139. "<td> <input style='width: 25px;height: 17px;' type='checkbox' id='allcheck' class='checkbox' /></td>"
  140. );
  141.  
  142. const allbutton = document.createElement("button");
  143. allbutton.id = "TALLDownBtnpage";
  144. allbutton.textContent = "下载";
  145. allbutton.className = "btn btn-md btn-default btn-sm";
  146. allbutton.onclick = alldown;
  147. $("th.first").append(allbutton);
  148.  
  149. $("#subtb thead > tr").append(
  150. "<td> <input style='width: 25px;height: 17px;' type='checkbox' id='allcheck' class='checkbox' /></td>"
  151. );
  152.  
  153. $("#allcheck").click(function () {
  154. $("input[type='checkbox']").attr("checked", $(this).prop("checked"));
  155. });
  156. ischeckbox = true;
  157. }
  158.  
  159. const td2 = document.createElement("td");
  160. const check = document.createElement("input");
  161. check.setAttribute("type", "checkbox");
  162. check.setAttribute("id", "mayi");
  163. $(td2).append(
  164. "<input style='width: 25px;height: 17px;' type='checkbox' id='downcheck' class='checkbox' value='" +
  165. e.href +
  166. "' name='" +
  167. i +
  168. "'/>"
  169. );
  170.  
  171. $(e).parent().before(td2);
  172. }
  173. }
  174.  
  175. function addtable() {}
  176.  
  177. function start() {
  178. if (/subs\/.*/.test(location.href)) {
  179. console.log("002");
  180. // noad();
  181. showtable();
  182. } else if (/detail\/.*/.test(location.href)) {
  183. console.log("003");
  184. noad();
  185. showurl();
  186. }else
  187. {
  188. console.log("001");
  189. showtable();
  190. }
  191. }
  192.  
  193. start();
  194. })();

QingJ © 2025

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