吾爱破解 - LCG - LSG |安卓破解|病毒分析|www.52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 22416|回复: 101
收起左侧

[其他转载] 【油猴脚本】夸克网盘直链下载

     关闭 [复制链接]
JesseMccree 发表于 2022-8-22 18:27
本帖最后由 JesseMccree 于 2022-8-22 19:27 编辑

夸克网盘对较大文件需要安装客户端才能下载,分享一个油猴脚本,使夸克网盘大文件可直接通过浏览器或搭配IDM下载
脚本地址:https://greasyfork.org/zh-CN/scripts/448675   
注意:1.使用脚本需先保存到自己网盘内。2.无法直接下载整个文件夹。3.一次下载多个文件时浏览器可能会拦截弹窗,需要手动允许。

使用方法:
屏幕截图(6).png
屏幕截图(7).png
[Asm] 纯文本查看 复制代码
// ==UserScript==
// @name         夸克网盘直链下载
// @version      1.1
// @namespace    https://pan.quark.cn/list
// @description  解除夸克网盘下载限制,直接在浏览器中下载
// @author       Lingo Wang
// @license      MIT

// @match        https://pan.quark.cn/list*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=quark.cn
// @grant        GM_xmlhttpRequest
// @grant        GM_log
// @grant window.onurlchange
// ==/UserScript==

(function () {
    'use strict';
    GM_log('quark download is running.');

    setInterval(gmMain, 250);
    const fidAttrName = 'data-row-key';

    function gmMain() {
        const checkboxes = document.getElementsByClassName('ant-checkbox-input');
        if (checkboxes === undefined || checkboxes.length <= 1) {
            console.log('document element not loaded yet');
            return;
        }

        // checkboxes.length > 1
        console.log('document element loaded, start dealing download btn');
        for (let i = 0; i < checkboxes.length; i++) {
            checkboxes[i].addEventListener('change', (event) => {
                if (event.currentTarget.checked) {
                    addDownloadBtnListener();
                }
            })
        }

        // flow download btn
        addFlowDownloadBtnListener();
    }

    function addDownloadBtnListener() {
        let downloadBtn = getDownloadBtn();
        downloadBtn.replaceWith(downloadBtn.cloneNode(true));   // remove all event listener
        downloadBtn = getDownloadBtn();

        downloadBtn.addEventListener('click', () => {
            let fids = getSelectedFids();
            download(fids);
        })
    }

    function addFlowDownloadBtnListener() {
        for (const btn of getFlowDownloadBtns()) {
            btn.replaceWith(btn.cloneNode(true));   // remove all event listener
        }

        for (const btn of getFlowDownloadBtns()) {
            btn.addEventListener('click', () => {
                const fid = btn.parentElement.parentElement.parentElement.parentElement.parentElement.getAttribute(fidAttrName);
                download([fid]);
            })
        }
    }

    function download(fids) {
        GM_xmlhttpRequest({
            method: "POST",
            url: "https://drive.quark.cn/1/clouddrive/file/download?pr=ucpro&fr=pc&ve=2.1.5",
            headers: {
                "Content-Type": "application/json;charset=utf-8"
            },
            data: JSON.stringify({"fids": fids}),
            onload: function (res) {
                console.log('get real download url, fids: %o, res: ', fids, res.responseText);
                let resData = JSON.parse(res.responseText).data;
                if (resData === undefined || resData.length === 0) {
                    console.log('error!, data is empty. request fids: ', fids);
                    alert('获取直链失败, 请尝试刷新页面!注意,文件夹不支持直链下载!')
                    return;
                } else {
                    console.log('get real download url, size: ', resData.length)
                }

                resData.forEach(o => window.open(o.download_url));
            }
        });
    }

    function getDownloadBtn() {
        let btnGroup = document.getElementsByClassName('ant-btn btn-file');
        let downloadBtn;
        for (let i = 0; i < btnGroup.length; i++) {
            if ('下载' === btnGroup[i].firstElementChild.innerText) {
                downloadBtn = btnGroup[i];
            }
        }
        return downloadBtn;
    }

    function getFlowDownloadBtns() {
        return document.getElementsByClassName('hover-oper-item hoitem-down');
    }

    function getSelectedFids() {
        const checkboxes = document.getElementsByClassName('ant-checkbox-input');
        let fids = [];
        for (let i = 0; i < checkboxes.length; i++) {
            if (checkboxes[i].checked) {
                const fid = checkboxes[i].parentElement.parentElement.parentElement.parentElement.parentElement.getAttribute('data-row-key');
                if (fid !== undefined && fid !== '') {
                    fids.push(fid);
                }
            }
        }
        return fids;
    }
})();

免费评分

参与人数 50吾爱币 +46 热心值 +45 收起 理由
“Style﹏暮枫 + 1 + 1 谢谢@Thanks!
toxyf + 1 + 1 谢谢@Thanks!
竹轩 + 1 + 1 鼓励转贴优秀软件安全工具和文档!
ls880321 + 1 + 1 谢谢@Thanks!
MZ20888 + 1 谢谢@Thanks!
Amazingfee + 1 我很赞同!
没吃饱的熊 + 1 + 1 好用,可用!
linfafa2 + 1 + 1 用心讨论,共获提升!
yuit3 + 1 + 1 欢迎分析讨论交流,吾爱破解论坛有你更精彩!
ZforCoding329 + 1 + 1 热心回复!
jingjing111 + 1 谢谢@Thanks!
jackie102 + 1 + 1 谢谢@Thanks!
Yingz520 + 1 + 1 谢谢@Thanks!
kanglong + 1 + 1 谢谢@Thanks!
zjangla + 1 + 1 谢谢@Thanks!
666emmm + 1 我很赞同!
chenyizhan + 1 + 1 谢谢@Thanks!真心不错
eCAN + 1 + 1 热心回复!
小虾米在此 + 1 + 1 谢谢@Thanks!不跳IDM的可以试一下改文件后缀为7z
noloudelou + 1 + 1 谢谢@Thanks!
null001 + 1 + 1 谢谢@Thanks!
lsz2253551761 + 1 + 1 我很赞同!
菊花里的小忧伤 + 1 + 1 热心回复!
zeroy0011 + 1 谢谢@Thanks!
13388157215 + 1 + 1 谢谢@Thanks!
实天1996 + 1 + 1 谢谢@Thanks!
Supermexyh + 1 + 1 感谢发布原创作品,吾爱破解论坛因你更精彩!
tingyun7 + 1 + 1 我很赞同!
shenyun919 + 1 送你一个币
romdone + 1 + 1 感谢您的宝贵建议,我们会努力争取做得更好!
鑫星星 + 1 + 1 我很赞同!
蓝董浩 + 1 + 1 谢谢@Thanks!
restart19 + 1 + 1 谢谢@Thanks!
zhaonan007007 + 1 + 1 热心回复!
483202569 + 1 + 1 非常感谢,配合迅雷下载飞快
xgzzzzz + 1 + 1 谢谢@Thanks!
wlkj888 + 1 + 1 失效了
tail88 + 1 + 1 谢谢@Thanks!
Romend2077 + 1 我很赞同!
春又来人已去 + 1 + 1 谢谢@Thanks!
啊常用户 + 1 + 1 非常感谢啊 直接速度起飞啊,下载客户端太麻烦了 感谢
月生之神 + 1 谢谢@Thanks!
ganlna + 1 + 1 谢谢@Thanks!
kk1212 + 1 + 1 谢谢@Thanks!
门外雪、屋中炉 + 1 + 1 欢迎分析讨论交流,吾爱破解论坛有你更精彩!
christ36 + 1 + 1 我很赞同!
水上凌波 + 1 搞好百度与蓝奏就解绝大问题了
WANGCONG52 + 1 我很赞同!
rong78 + 1 + 1 用心讨论,共获提升!
clockworklun + 2 + 1 感谢发布原创作品,吾爱破解论坛因你更精彩!

查看全部评分

本帖被以下淘专辑推荐:

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

 楼主| JesseMccree 发表于 2022-9-3 23:11
有坛友反馈失效,但是我自己是使用的是IDM,依然能用,浏览器下载不知道是否能用
lxl217114 发表于 2022-8-22 20:21
本帖最后由 lxl217114 于 2022-8-22 20:27 编辑

这个必须赞,给力

-----------------------2022.08.22  20:27-------------------------------------

安装测试后,发现无法正常弹出下载

也没有弹出需要安装pc端的页面
cnljm 发表于 2022-8-22 20:35
xynm 发表于 2022-8-22 20:47
想起了以前用百度网盘的脚本,老快乐了
sxh3344520 发表于 2022-8-22 20:48
感谢分享,支持
白狐 发表于 2022-8-22 20:48
百度网盘脚本有没有
mokleolee 发表于 2022-8-22 21:01
感谢大佬分享!!!
love08sky 发表于 2022-8-22 21:06
感谢大佬分享,这个比打开软件快多了
wuaidh 发表于 2022-8-22 21:09
感谢大佬分享
zjb0923 发表于 2022-8-22 21:11
感谢 很好用
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则 警告:本版块禁止灌水或回复与主题无关内容,违者重罚!

快速回复 收藏帖子 返回列表 搜索

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-3-29 07:40

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表