Free host download

free down it

  1. // ==UserScript==
  2. // @name Free host download
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.95
  5. // @description free down it
  6. // @author kingweb
  7. // @license MIT
  8. // @match https://www.dudujb.com/*
  9. // @match https://www.iycdn.com/*
  10. // @match http://www.xunniuyun.com/*
  11. // @match http://www.xueqiupan.com/*
  12. // @match https://www.567site.com/*
  13. // @match https://www.567inc.com/*
  14. // @match https://www.77file.com/*
  15. // @match https://ownfile.net/*
  16. // @match http://moguwp.com/file/*
  17. // @match https://www.ayunpan.com/*
  18. // @match http://www.feiyunfile.com/*
  19. // @match https://www.yifile.com/*
  20. // @match https://dufile.com/*
  21. // @match https://www.520-vip.com/*
  22. // @grant none
  23. // ==/UserScript==
  24.  
  25. (function () {
  26.  
  27. 'use strict';
  28. var domain = window.location.host;
  29. let str = document.documentElement.outerHTML;
  30. let file_url = window.location.href;
  31.  
  32. //select the domain
  33.  
  34. if(domain == 'www.520-vip.com') {
  35. jumpTo(file_url);
  36.  
  37. if (file_url.indexOf('down-') > -1) {
  38. let file_id = get_down_url_id(file_url);
  39. console.log(file_id);
  40. down_process2(file_id);
  41. abox('downbox.php?file_id='+file_id+'','文件下载',480,350);
  42. }
  43. }
  44.  
  45. if (domain == 'dufile.com') {
  46.  
  47. if (file_url.includes("/file/")) {
  48. var urlParts = file_url.split('/');
  49. var dynamicParam = urlParts[urlParts.length - 1].split('.')[0];
  50. if (dynamicParam) {
  51. window.location.href = 'https://dufile.com/down/' + dynamicParam + '.html';
  52. } else {
  53. alert('获取参数失败');
  54. }
  55. }
  56.  
  57. }
  58. if(domain == 'moguwp.com') {
  59.  
  60. window.addEventListener('beforeunload', function() {
  61. // 销毁函数的逻辑
  62. down_file_link = function() {};
  63. });
  64.  
  65. const down_link = document.getElementById('down_link');
  66. down_link.style.display = 'none';
  67. down_link.remove();
  68. const down_link2 = document.getElementById('down_link2');
  69. down_link2.style.display = 'none';
  70. down_link2.remove();
  71. const down_div = document.getElementById('down_div');
  72. down_div.style.display = '';
  73.  
  74. }
  75.  
  76.  
  77. if (domain == 'www.yifile.com') {
  78.  
  79. alert('需要输入验证码下载,下载第一次后,第二次下载请等待约 10 秒后再输入验证码');
  80.  
  81. $('#A1').click();
  82.  
  83. window.onload = function () {
  84. downtime = 0;
  85. };
  86.  
  87. if (getCookie('yifile')) {
  88. console.log(getCookie('yifile'));
  89. delCookie('yifile');
  90. window.location.reload(true);
  91. } else {
  92. downtime2();
  93. }
  94.  
  95. }
  96.  
  97. if (domain == 'www.feiyunfile.com') {
  98.  
  99.  
  100.  
  101. if (file_url.includes("/file/")) {
  102.  
  103. var urlParts = file_url.split('/');
  104. var dynamicParam = urlParts[urlParts.length - 1].split('.')[0];
  105. if (dynamicParam) {
  106. window.location.href = 'http://www.feiyunfile.com/down/' + dynamicParam + '.html';
  107. } else {
  108. alert('获取参数失败');
  109. }
  110.  
  111. }
  112.  
  113. if (file_url.includes("/down/")) {
  114. let down_box = $('#addr_box')
  115. down_box.hide();
  116.  
  117. // 正则表达式匹配 file_id
  118. let sourceCode = document.body.outerHTML;
  119. const regex = /load_down_addr1\('(\d+)'\);/;
  120. const match = sourceCode.match(regex);
  121. if (match) {
  122. const fileId = match[1];
  123. load_down_addr1(fileId);
  124. } else {
  125. console.log('未找到 file_id');
  126. }
  127.  
  128.  
  129. }
  130. }
  131.  
  132. if (domain == 'www.ayunpan.com') {
  133. jumpTo(file_url);
  134. }
  135.  
  136. if (domain == 'ownfile.net') {
  137.  
  138. if (file_url.includes("/files/")) {
  139.  
  140. var urlParts = file_url.split('/');
  141. var dynamicParam = urlParts[urlParts.length - 1].split('.')[0];
  142. if (dynamicParam) {
  143. window.location.href = 'https://ownfile.net/down/' + dynamicParam + '.html';
  144. } else {
  145. alert('获取参数失败');
  146. }
  147.  
  148. }
  149.  
  150.  
  151. if (file_url.includes("/down/")) {
  152.  
  153. let scriptContent = document.body.innerHTML;
  154. var regex = /load_down_addr1\('([^']+)'\)/g;
  155. var match = regex.exec(scriptContent);
  156. let file_id = match[1];
  157. load_down_addr1(file_id);
  158.  
  159.  
  160. setTimeout(function () {
  161.  
  162. var s1 = setInterval(() => {
  163.  
  164. if (document.getElementById("addr_list")) {
  165. var href = $("#addr_list a").attr("href");;
  166. if (href && href.includes("file_id")) {
  167. $('#down_box h4').text('如果未列出有效地址,将会自动刷新,直到出现有效地址');
  168. load_down_addr1(file_id);
  169.  
  170. } else {
  171. clearInterval(s1);
  172. }
  173. }
  174. }, 1000);
  175.  
  176.  
  177. }, 1000);
  178.  
  179.  
  180.  
  181.  
  182. }
  183. }
  184.  
  185. if (domain == 'www.77file.com') {
  186.  
  187. if (file_url.includes("/s/")) {
  188. var urlParts = file_url.split('/');
  189. var dynamicParam = urlParts[urlParts.length - 1];
  190. window.location.href = '/down/' + dynamicParam + '.html';
  191. }
  192.  
  193. if (file_url.includes("/down/")) {
  194. let scriptContent = document.body.innerHTML;
  195. var regex = /load_down_addr1\('([^']+)'\)/g;
  196. var match = regex.exec(scriptContent);
  197. let file_id = match[1];
  198. let element = document.getElementById("addr_box");
  199. element.parentNode.removeChild(element);
  200. load_down_addr1(file_id);
  201. }
  202. }
  203.  
  204. if (domain == 'www.567site.com') {
  205. jumpTo(file_url);
  206. show_down_url_load_down_addr1(file_url);
  207. }
  208.  
  209. if (domain == 'www.xunniuwp.com') {
  210. jumpTo(file_url);
  211. show_down_url_load_down_addr1(file_url);
  212. }
  213.  
  214. if (domain == 'www.xunniuyun.com') {
  215. jumpTo(file_url);
  216. show_down_url_load_down_addr1(file_url);
  217. }
  218.  
  219. if (domain == 'www.iycdn.com') {
  220. jumpTo(file_url);
  221.  
  222. //判断当前 url 包含 down-2224.html
  223. if (file_url.indexOf('down-') > -1) {
  224. let down_box = document.getElementById('down_box');
  225. down_box.style.display = '';
  226. let file_id = get_down_url_id(file_url);
  227. //get download list
  228. $.ajax({
  229. type: 'post',
  230. url: 'ajax.php',
  231. data: 'action=load_down_addr2&file_id=' + file_id,
  232. dataType: 'text',
  233. success: function (msg) {
  234. var arr = msg.split('|');
  235. if (arr[0] == 'true') {
  236. $('#addr_list').html(arr[1]);
  237. $('#code_box').hide();
  238. } else {
  239. $('#addr_list').html(msg);
  240. }
  241. },
  242. error: function () {
  243. }
  244. });
  245. }
  246. }
  247.  
  248. if (domain == 'www.dudujb.com') {
  249.  
  250. jumpTo(file_url);
  251.  
  252. //判断当前 url 包含 down-2224.html
  253. if (file_url.indexOf('down-') > -1) {
  254. let down_box = document.getElementById('down_box');
  255. down_box.style.display = '';
  256. let file_id = get_down_url_id(file_url);
  257. //get download list
  258. $.ajax({
  259. type: 'post',
  260. url: 'ajax.php',
  261. data: 'action=load_down_addr2&file_id=' + file_id,
  262. dataType: 'text',
  263. success: function (msg) {
  264. var arr = msg.split('|');
  265. if (arr[0] == 'true') {
  266. $('#addr_list').html(arr[1]);
  267. $('#code_box').hide();
  268. } else {
  269. $('#addr_list').html(msg);
  270. }
  271. },
  272. error: function () {
  273. }
  274. });
  275. }
  276.  
  277.  
  278. }
  279.  
  280.  
  281.  
  282.  
  283.  
  284. //Some common methods
  285.  
  286. //junmp to url
  287. function jumpTo(file_url) {
  288.  
  289. if (file_url.indexOf('file-') > -1) {
  290. let file_id = get_file_url_id(file_url);
  291. if (file_id) {
  292. window.location.href = 'down-' + file_id + '.html';
  293. }
  294. }
  295. }
  296.  
  297. //get file url id
  298. function get_file_url_id(url) {
  299. let matches = url.match(/file-(\d+)/);
  300. if (matches[1]) {
  301. return matches[1];
  302. } else {
  303. alert('获取文件ID失败');
  304. }
  305.  
  306. }
  307.  
  308. //get down url id
  309. function get_down_url_id(file_url) {
  310. let matches = file_url.match(/down-(\d+)/);
  311. if (matches[1]) {
  312. return matches[1];
  313. } else {
  314. alert('获取文件ID失败');
  315. }
  316. }
  317.  
  318. //don't need ajax show download list
  319. function show_down_url_load_down_addr1(file_url) {
  320. if (file_url.indexOf('down-') > -1) {
  321. let down_box = document.getElementById('down_box');
  322. down_box.style.display = '';
  323. $("#codefrm").parent().hide();
  324. load_down_addr1(get_down_url_id(file_url));
  325. }
  326. }
  327.  
  328. function get_add_ref() {
  329. let id = document.documentElement.outerHTML.match(/add_ref\((\S*)\);/)[1];
  330. if (id) {
  331. return id;
  332. } else {
  333. alert('查找文件 ID 错误');
  334. }
  335. }
  336.  
  337. //取cookies
  338. function getCookie(name) {
  339. var cookieArr = document.cookie.split(";");
  340.  
  341. for (var i = 0; i < cookieArr.length; i++) {
  342. var cookiePair = cookieArr[i].split("=");
  343. var cookieName = cookiePair[0].trim();
  344.  
  345. if (cookieName === name) {
  346. var cookieValue = cookiePair[1];
  347. return decodeURIComponent(cookieValue);
  348. }
  349. }
  350.  
  351. // 如果未找到指定名称的 cookie,则返回 null 或适当的默认值
  352. return null;
  353. }
  354.  
  355. //删除cookie
  356. function delCookie(name) {
  357. var exp = new Date();
  358. exp.setTime(exp.getTime() - 1);
  359. var cval = getCookie(name);
  360. if (cval != null)
  361. document.cookie = name + "=" + cval + ";expires=" + exp.toGMTString() + ";path=/";
  362. }
  363.  
  364. })();