NetdiskAssistant

网赚网盘助手;支持20多种常见网赚网盘;1.减少人工操作;2.过滤网盘大部分广告;3.快速跳过等待倒计时;4.不需要输入验证码(大部分网盘);5.没有破解VIP,网站各种限制还在;

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         NetdiskAssistant
// @namespace    http://tampermonkey.net/
// @version      0.0.1
// @description  网赚网盘助手;支持20多种常见网赚网盘;1.减少人工操作;2.过滤网盘大部分广告;3.快速跳过等待倒计时;4.不需要输入验证码(大部分网盘);5.没有破解VIP,网站各种限制还在;
// @author       LuckyPhoenix
// @homepageURL  https://greasyfork.org/zh-CN/scripts/567319
// @require      https://mirrors.sustech.edu.cn/cdnjs/ajax/libs/jquery/1.8.3/jquery.min.js

// @match        https://windfiles.com/*

// @license      GPL-3.0-only
// @grant        GM_setClipboard
// @grant        GM_getValue
// @grant        GM_setValue
// @run-at       document-end
// @compatible	 Chrome
// ==/UserScript==
/* eslint-disable no-redeclare */
/* eslint-disable no-undef */

(function () {
  'use strict';
  // console.log('-----title-----' + document.title);
  // console.log('-----href-----' + document.location.href);

  /**
   * @param {string} strA
   * @param {string} classB
   * @param {string} tagC
   * @returns {HTMLElement}
   */
  function findAinBbyC(strA, classB, tagC) {
    var obj9 = null;
    var obj1 = document.querySelector(classB);
    if (obj1 != null) {
      //console.log(obj1.innerHTML);
      var obj2 = obj1.getElementsByTagName(tagC);
      for (var i = 0; i < obj2.length; i++) {
        console.log(i);
        console.log(obj2[i].outerHTML);
        if (obj2[i].outerHTML.indexOf(strA) >= 0)
          obj9 = obj2[i];

      }
    } return obj9;
  }
  /**
   * @param {string} strA
   * @param {string} SelectorB
   * @returns {HTMLElement}
   */
  function findAinB(strA, SelectorB) {
    var obj9 = null;
    var obj1 = document.querySelectorAll(SelectorB);//"div.package-download"
    if (obj1 != null && obj1.length > 0) {
      for (var i = 0; i < obj1.length; i++) {
        //console.log(obj1[i].innerHTML);
        if (obj1[i].innerHTML.indexOf(strA) >= 0) {
          obj9 = obj1[i];

        }
      }
    } return obj9;
  }
  /**
   * @param {string} Selector
   * @returns {string}
   */
  function getInnerHtml(Selector) {
    var obj1 = document.querySelector(Selector);
    if (obj1 != null) {
      console.log(obj1.innerHTML);
      return obj1.innerHTML;
    } else return '';
  }
  /**
   * @param {string} Selector
   * @returns {string}
   */
  function getInnerText(Selector) {
    var obj1 = document.querySelector(Selector);
    if (obj1 != null) {
      console.log(obj1.innerText);
      return obj1.innerText;
    }
    else return '';
  }
  /**
   * @param {string} source
   * @param {string} b
   * @param {string} e
   * @returns {string}
   */
  function getSubStr(source, b, e) {
    var s1 = source;
    var p1 = s1.indexOf(b);
    if (p1 > 0) {
      var p2 = s1.indexOf(e, p1);
      var l = b.length;
      var s2 = s1.substring(p1 + l, p2);
      return s2;
    } return '';
  }
  /**
   * 获取元素在页面上的绝对位置(横坐标)
   * @param {HTMLElement} element
   * @returns {number}
   */
  function getElementPageLeft(element) {
    var actualLeft = element.offsetLeft;
    var parent = element.offsetParent;
    while (parent != null) {
      actualLeft += parent.offsetLeft + (parent.offsetWidth - parent.clientWidth) / 2;
      parent = parent.offsetParent;
    } return actualLeft;
  }
  /**
   * 获取元素在页面上的绝对位置(纵坐标)
   * @param {HTMLElement} element
   * @returns {number}
   */
  function getElementPageTop(element) {
    var actualTop = element.offsetTop;
    var parent = element.offsetParent;
    while (parent != null) {
      actualTop += parent.offsetTop + (parent.offsetHeight - parent.clientHeight) / 2;
      parent = parent.offsetParent;
    } return actualTop;
  }
  var Tip = '<font size="4" color="green">💫 收费网盘助手 💫<p>1.减少人工操作<br>2.过滤网盘大部分广告<br>3.快速跳过等待倒计时<br>4.不需要输入验证码(部分网盘)<br>5.没有破解VIP,网站各种限制还在</font><p>';
  /**
   * 操作提示
   * @param {number} id
   * @param {string} Selector
   * @param {string} strText
   */
  function floatTip(id, Selector, strText) {
    var str = Tip;
    if (id == 0)
      str = str + '<font size="4" color="darkcyan" id="a0b">请等待……</font>';
    else if (id == 1)
      str = str + '<font size="4" color="red" id="a1b">请根据页面提示,完成验证;</font>';
    else if (id == 2)
      str = str + '<font size="4" color="brown" id="a2b">点击[普通下载]按钮开始下载。</font>';
    else if (id == 21)
      str = str + '<font size="4" color="brown" id="a2b">点击[免费下载]按钮开始下载。</font>';
    else if (id == 22)
      str = str + '<font size="4" color="brown" id="a2b">点击[下载]按钮开始下载。</font>';
    else if (id == 3)
      str = str + '<font size="4" color="darkred" id="a3b">点击[普通下载]按钮开始下载<br>不需要输入验证码!</font>';

    var top = 150;
    var left = 10;

    var obj1 = document.querySelectorAll(Selector);//"div.pull-right"
    if (obj1 != null && obj1.length > 0) {
      for (var i = 0; i < obj1.length; i++) {
        if (obj1[i].innerHTML.indexOf(strText) > 0) {
          top = getElementPageTop(obj1[i]);
          left = getElementPageLeft(obj1[i]);
          var lt = left + (obj1[i].clientWidth - 300);
          console.log(String(left) + "," + String(lt));
          left = lt;
        }
      }
    }

    var obj0 = document.getElementById('sg_tip_482');
    //console.log(obj0);
    if (obj0 == null) {
      console.log("floatTip left=" + String(left));
      var my = document.createElement("div");
      document.body.appendChild(my);
      my.style.backgroundColor = "#fefcee";
      my.style.border = "1px solid #dbdbdc"
      my.style.lineHeight = "normal";
      my.style.position = "absolute";
      my.style.top = String(top) + "px";
      if (left == 10) my.style.right = "10px"; else my.style.left = String(left) + "px";
      my.style.zIndex = "999999999";
      my.style.padding = "10px";
      my.innerHTML = str;
      my.id = "sg_tip_482";
    } else obj0.innerHTML = str;
  }
  /**
   * 操作提示
   * @param {string} id
   * @param {string} Selector
   */
  function inTip(id, Selector) {
    //console.log("inTip");
    var str = Tip;
    if (id == 0)
      str = str + '<font size="4" color="darkcyan" id="a0b">请等待……</font>';
    else if (id == 1)
      str = str + '<font size="4" color="red" id="a1b">请根据页面提示,完成验证;</font>';
    else if (id == 2)
      str = str + '<font size="4" color="brown" id="a2b">点击[普通下载]按钮开始下载。</font>';
    else if (id == 21)
      str = str + '<font size="4" color="brown" id="a2b">点击[免费下载]按钮开始下载。</font>';
    else if (id == 22)
      str = str + '<font size="4" color="brown" id="a2b">点击[下载]按钮开始下载。</font>';
    else if (id == 3)
      str = str + '<font size="4" color="darkred" id="a3b">点击[普通下载]按钮开始下载<br>不需要输入验证码!</font>';
    else if (id == 31)
      str = str + '<font size="4" color="darkred" id="a3b">点击[免费下载]按钮开始下载<br>不需要输入验证码!</font>';

    var obj1 = document.querySelectorAll(Selector);//"div.package-download"
    if (obj1 != null && obj1.length > 0) {
      for (var i = 0; i < obj1.length; i++) {
        obj1[i].style.lineHeight = "normal";
        if ((id == 3 || id == 31) && obj1[i].innerHTML.indexOf('a3b') < 0) obj1[i].innerHTML = str;
        if ((id == 2 || id == 21 || id == 22) && obj1[i].innerHTML.indexOf('a2b') < 0) obj1[i].innerHTML = str;
        if (id == 1 && obj1[i].innerHTML.indexOf('a1b') < 0) obj1[i].innerHTML = str;
        if (id == 0 && obj1[i].innerHTML.indexOf('a0b') < 0) obj1[i].innerHTML = str;
      }
    }
  }
  /**
   * @param {string} Selector
   * @param {string} html
   */
  function setInnerHtml(Selector, html) {
    var obj1 = document.querySelectorAll(Selector);//"div.package-download"
    if (obj1 != null && obj1.length > 0) {
      for (var i = 0; i < obj1.length; i++)
        obj1[i].innerHTML = '<font size="4" color="red">' + html + '</font>';
    }
  }

  function block_ads() {
    var k = 0;
    var obj1 = $('iframe');
    //console.log(obj1.length);
    var i = 0;
    if (obj1 != null && obj1.length > 0) {
      for (i = 0; i < obj1.length; i++) {
        var str = obj1[i].getAttribute('src');
        //console.log(str);
        if (str != null && str.indexOf('/pagead/') != -1) {
          obj1[i].removeAttribute('src');
          obj1[i].setAttribute('display', 'none');
          obj1[i].setAttribute('style', '');
          k++;
          console.log("****ads***** " + k);
        }
      }
    } return k;
  }
  var timeID = setInterval(function () { if (block_ads() == 0) clearInterval(timeID); }, 1000);

  /**
   * 发送下载直链到aria2
   * @param {{url:string[],info:{header:string[],split:string,out:string}}} options
   */
  function aria2(options, rpc = 'https://www.zypn.eu.org/jsonrpc', token = 'zhang3266384950') {
    if (!options.info) options.info = { header: [`Cookie: ${document.cookie}`, `User-Agent: ${navigator.userAgent}`], split: '8'};
    let body = { id: Date.now(), method: "aria2.addUri", params: [`token:${token}`, options.url, options.info] };
    fetch(rpc, { method: 'POST', body: JSON.stringify(body), headers: { 'Content-Type': 'application/json', 'user-agent': navigator.userAgent } });
  }

  console.log(`-----${document.location.host}-----${document.cookie}`);
  if (document.location.hostname.endsWith('windfiles.com')) {
    let origin = document.location.origin;
    if (document.location.pathname.startsWith('/share') > 0) {
      const html = document.documentElement.outerHTML; // 获取整个页面的HTML(包括动态生成的内容,但以当前DOM为准)
      const matches = /["'](\/download\/slow\/?\?[\w=-]*)["']/g.exec(html);
      if (matches === null) { // 如果没有找到链接,显示提示信息
        console.log('未找到匹配/download/slow/*的链接');
      } else {
        console.log('找到下载页面', matches[1]);
        document.location = matches[1];
      }
    } else if (document.location.pathname.startsWith('/download/slow') > 0) {
      // $('input[type=submit]').click(); // 点击开始下载
      fetch(origin + '/download/jump', { method: 'POST', body: `dl=${$("input[name='dl']").val()}&btnAct=${$("input[name='btnAct']").val()}`, headers: {
        'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
      } }).then(response => {
        let location = response.headers.get('location');
        if (!location) console.log('下载链接获取失败'); else aria2([location]);
      });
    } else if (document.location.hostname === 'dl.windfiles.com') {
      // document.location.href
    }
  }
})();