chrome + IDM + 油猴插件 实现百度网盘大文件的高速下载

chrome + IDM + 油猴插件 实现百度网盘大文件的高速下载;这是一项非常成熟的技术,下载速度快, 不用担心被封

1. 下载chrome 这个直接跳过 没有的话 就不用看了

2. 下载idm软件 , 百度搜索 , 第一条基本就是官网下载地址, 进去下载就行了, 然后傻瓜式安装

chrome + IDM + 油猴插件 实现百度网盘大文件的高速下载_第1张图片
安装好之后 如图所示: 按顺序来chrome + IDM + 油猴插件 实现百度网盘大文件的高速下载_第2张图片
chrome + IDM + 油猴插件 实现百度网盘大文件的高速下载_第3张图片
chrome + IDM + 油猴插件 实现百度网盘大文件的高速下载_第4张图片
chrome + IDM + 油猴插件 实现百度网盘大文件的高速下载_第5张图片
看清出来记得是https:, 连接数写2个就行了, 这个代表下载时候线程多少,带宽大的话,可以写多些, 小的话就不用了
至此,第二步完成

3. 浏览器配置

  1. 安装油猴插件
    链接:https://pan.baidu.com/s/1HG7humcx5c2zxTUdO9eoxg
    提取码:04sw
    别怕, 就1M大小
  2. 浏览器配置油猴插件
    浏览器打开 :

    点击设置
    chrome + IDM + 油猴插件 实现百度网盘大文件的高速下载_第6张图片
    然后把刚才百度网盘下载的文件拖进去就行了, 傻瓜式操作
    然后就有了这个
    chrome + IDM + 油猴插件 实现百度网盘大文件的高速下载_第7张图片
  3. 也是最后一步, 下载一个js文件, 专门提取百度网盘直链的, 算了不下载了 ,直接上代码:
// ==UserScript==
// @namespace https://dotennin.blogspot.com/
// @name 百度网盘直链提取(多选)
// @description 百度网盘直链提取(多选)配合IDM下载
// @version 0.3
// @author Dotennin
// @license MIT
// @compatible        chrome 测试通过
// @compatible        firefox 未测试
// @compatible        opera 未测试
// @compatible        safari 未测试
// @include https://pan.baidu.com/disk/*
// @connect baidu.com
// @grant GM_setClipboard
// @grant GM_xmlhttpRequest
// @run-at document-idle
// ==/UserScript==
!function() {
    appendModal()
    let task = setInterval(() => {
        let dom, t = document.querySelector("a.g-button[data-button-id][title=\u4e0b\u8f7d]")
        if (t) {
            clearInterval(task)
            dom = t.cloneNode(true)
            t.after(dom)
            dom.removeAttribute("style")
            t.remove()
            dom.addEventListener("click", () => {
                let dom = window.event.currentTarget, selectList = require("system-core:context/context.js").instanceForSystem.list.getSelected()
                dom.setAttribute("style", "background-color: #09e; color: #fff")

                const requestList = []
                let isDir = false
                selectList.filter((arr) => {
                    if (arr.isdir === 1) {
                        isDir = true
                        return false
                    }
                    return true
                }).forEach((arr) => {
                    requestList.push(getDownloadUrl(arr))
                })
                if (isDir) {
                    alert("\u4e0d\u80fd\u5305\u542b\u6587\u4ef6\u5939\u4e0b\u8f7d\uff0c\u0020\u5c06\u5ffd\u7565\u6587\u4ef6\u5939\u52fe\u9009\u7684\u4e0b\u8f7d\u5185\u5bb9\u3002")
                }
                openModal()
                Promise.all(requestList).then((urls) => {
                    dom.removeAttribute("style")
                    // document.querySelector('.code').insertAdjacentHTML('beforeend', urls.join('\n'))
                    document.querySelector('#copy-code').className = ''
                })
            })
        }
    }, 1e3)
}()

function getDownloadUrl(arr) {
    return new Promise((resolve, reject) => {
        GM_xmlhttpRequest({
            "url": "http://pcs.baidu.com/rest/2.0/pcs/file?app_id=778750&ver=2.0&method=locatedownload&path=" + encodeURIComponent(arr.path),
            "method": "GET",
            "responseType": "json",
            "headers": {
                "User-Agent": "netdisk;P2SP;2.2.60.26"
            },
            "onload": r => {
                if (r.response.hasOwnProperty("client_ip")) {
                    const url = r.response.urls[0].url + "&filename=" + encodeURIComponent(arr.server_filename)
                    document.querySelector('.code').insertAdjacentHTML('beforeend', url + '\n')
                    return resolve(url)
                } else {
                    // Todo return error message
                    return reject(r)
                }
            }
        })
    })
}

function openModal() {
    const modalWrapper = document.querySelector('.modal-wrapper')
    modalWrapper.className = modalWrapper.className + ' open'
}

function closeModal() {
    const modalWrapper = document.querySelector('.modal-wrapper')
    modalWrapper.className = 'modal-wrapper'
    const urlElements = document.querySelector('.code')
    document.querySelector('#copy-code').className = 'disable'
    urlElements.innerHTML = ''
}

function copyCode() {
    const urlElements = document.querySelector('.code')
    window.getSelection().selectAllChildren(urlElements)
    GM_setClipboard(urlElements.innerText, 'text')
}

function appendModal() {
    document.body.insertAdjacentHTML('beforeend', `
        
    
    `)

    document.querySelectorAll('.modal-overlay,.modal-close').forEach((e) => e.addEventListener('click', closeModal))
    document.getElementById('copy-code').addEventListener('click', copyCode)
}

将代码块的js代码复制下来:, 刚才已经开启了油猴插件,点击这个按钮:
chrome + IDM + 油猴插件 实现百度网盘大文件的高速下载_第8张图片
点击 添加新脚本, 将其原有的js代码删掉, 把我上面红字的代码复制进去,然后点击文件, 保存, 就OK了
chrome + IDM + 油猴插件 实现百度网盘大文件的高速下载_第9张图片
自动跳转至这个页面:
在这里插入图片描述
至此, 配置完成

4.问题来了, 怎么实现高速下载呢?

	1. 在浏览器上进入百度网盘, 软件不行, 不然前面那个浏览器配置干啥呢?

chrome + IDM + 油猴插件 实现百度网盘大文件的高速下载_第10张图片
2.55个G够大吧.
chrome + IDM + 油猴插件 实现百度网盘大文件的高速下载_第11张图片
然后把出现的链接复制下来, 我们这么多操作就是为了这个链接
2. 打开IDM软件, 点击新建任务, 将复制的链接,粘贴进去, 点击确定,就可以选择下载路径下载了, 下载速度还是不错的,
chrome + IDM + 油猴插件 实现百度网盘大文件的高速下载_第12张图片
注意 : 但是这个只支持文件下载, 不支持文件夹下载,这个也不怎么影响, 虽然不支持文件夹下载,但是支持多文件下载, 进入文件夹, 全选文件不就行了,附图一张,自己完成
chrome + IDM + 油猴插件 实现百度网盘大文件的高速下载_第13张图片
pass: IDM有效期一个月, 过了就要去找破解版

你可能感兴趣的:(大数据,下载)