Greasy Fork

Greasy Fork is available in English.

xxxxx520识别百度网盘链接并自动填写密码并自动点击提交

Everyday Is Precious.

当前为 2025-10-18 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         xxxxx520识别百度网盘链接并自动填写密码并自动点击提交
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Everyday Is Precious.
// @author       JewelShiny
// @match        https://pan.baidu.com/share/*
// @match        https://like.gamer520.com/*
// @license MIT
// ==/UserScript==

(function() {
    'use strict';
    console.log(document.domain)
    if(document.domain == 'like.gamer520.com'){
        var target = document.querySelector(".entry-content.u-text-format.u-clearfix");
        var allhtml = target.innerHTML;

        var ym = document.documentElement.innerText;
        ym = ym.replace(/\n/g," ");
        console.log(ym);

        var patt = /(https:\/\/pan\.baidu\.com\/s\/1([a-zA-Z0-9_-]+)).{1,10}([a-z0-9]{4})[^a-zA-Z0-9-_]/g;
        var res;
        console.log('aaa');

        while((res = patt.exec(ym)) !== null){
            console.log(res);
            if(res[2] && res[3]){
                var button = '<a style="color:red;border-color:red;border-style:solid;margin-left:6px;" href="https://pan.baidu.com/share/init?surl='
                + res[2] + '&pw=' + res[3] + '" target="_blank">打开链接</a>';

                var linkPattern = new RegExp(
                    '(<a[^>]*href=["\']https://pan\\.baidu\\.com/s/1' + res[2] + '["\'][^>]*>.*?<\\/a>)',
                    'g'
                );
                allhtml = allhtml.replace(linkPattern, '$1' + button);

                console.log('链接', res[2], '密码', res[3]);
                console.log('https://pan.baidu.com/share/init?surl=' + res[2] + '&pw=' + res[3]);
            }
        }

        target.innerHTML = allhtml;
    }else if(document.domain == 'pan.baidu.com'){
        var url = window.location.href
        console.log(url)
        var patt_pw = /pw=([a-z0-9]{4})/
        var res_pw = patt_pw.exec(url)
        //var patt = /([a-zA-Z0-9_]{10,})/
        //var res = patt.exec(url)
        console.log(res_pw)
        if(res_pw && res_pw[1]){
            document.getElementsByTagName('input')[0].value = res_pw[1]
            document.getElementById('submitBtn').click()
        }
    }

})();