Quark Download

点击鼠标中键直接下载夸克网盘内容,无需下载客户端

目前為 2022-07-28 提交的版本,檢視 最新版本

// ==UserScript==
// @name         Quark Download
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  点击鼠标中键直接下载夸克网盘内容,无需下载客户端
// @author       Xav1er
// @match        http*://pan.quark.cn/*
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant        none
// @license      MIT
// ==/UserScript==

async function genDownloadLink(fileid) {
    const rawData = await fetch("https://drive.quark.cn/1/clouddrive/file/download?pr=ucpro&fr=pc", {
        "headers": {
            "accept": "application/json, text/plain, */*",
            "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6",
            "content-type": "application/json;charset=UTF-8",
            "sec-ch-ua": "\" Not;A Brand\";v=\"99\", \"Microsoft Edge\";v=\"103\", \"Chromium\";v=\"103\"",
            "sec-ch-ua-mobile": "?0",
            "sec-ch-ua-platform": "\"Windows\"",
            "sec-fetch-dest": "empty",
            "sec-fetch-mode": "cors",
            "sec-fetch-site": "same-site"
        },
        "referrer": "https://pan.quark.cn/",
        "referrerPolicy": "strict-origin-when-cross-origin",
        "body": `{\"fids\":[\"${fileid}\"]}`,
        "method": "POST",
        "mode": "cors",
        "credentials": "include"
    });
    const data = await rawData.json();
    const link = data.data[0].download_url
    console.log(link)
    return link;
}

function listenMiddleClick(e) {
    if (e.button === 1) {
        // 如果点击鼠标中键
        const fileID = e.target.parentNode.parentNode.getAttribute('data-row-key')
        console.log(fileID)
        genDownloadLink(fileID).then(function (link) {
            window.open(link, '_blank');
        });
    }
}

function addListener() {
    const tagList = document.querySelectorAll('#ice-container > section > section > main > div > div.section-main > div.file-list > div.ant-table-wrapper.table-fixed-content > div > div > div > div > div > div.ant-table-body > table > tbody > tr')
    tagList.forEach(function (tag) {
        tag.addEventListener('mousedown', listenMiddleClick);
    })
}

(function () {
    'use strict';
    // 夸克网盘用react写的,需要等待网页内容加载完成再添加事件监听
    setTimeout(function () {
        addListener();
    }, 3000);
})();

QingJ © 2025

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