网盘自动填写提取密码

自动填写提取密码,失败不重试。

< Feedback on 网盘自动填写提取密码

Review: OK - script works, but has bugs

§
Posted: 26.06.2018
Edited: 14.02.2019

DOMContentLoaded。 userscript.html?id=ee85d713-0245-44fd-9b9c-888dcd0c052d:62 抓取到的提取码: 3131 baidu-tongji_57a0637.js:1 GET https://hm.baidu.com/h.js?0792b315e6af8db26f294e9421b66fc4 0 () (anonymous) @ baidu-tongji_57a0637.js:1 (anonymous) @ baidu-tongji_57a0637.js:1 VM162:1 https://eyun.baidu.com/enterprise/share/init?cid=8272057817616677234&uk=3328224443&sid=201702288350535643#3131

从log来看提取码是抓到了

企业云还可能是6码的提取码,可能是自己设的 https://eyun.baidu.com/enterprise/share/init?cid=8272057817616677234&uk=3328224443&sid=201610251675460517#repaik

§
Posted: 26.06.2018
Edited: 26.06.2018

改了下前部

// ==UserScript==
// @name        网盘自动填写提取密码
// @namespace   http://jixun.org/
// @description 自动填写提取密码,失败不重试。
// @include     https://pan.baidu.com/share/init?*
// @include     https://yun.baidu.com/share/init?*
// @include     https://eyun.baidu.com/enterprise/share/init?*

// @include     http://*.yunpan.360.cn/lk/*
// @include     https://*.yunpan.360.cn/lk/*
// @include     http://share.weiyun.com/*
// @version     1.0.3.9
// @grant       none
// @run-at      document-start
// ==/UserScript==

(function ($, waitDocReady) {
    var site = {
        'yunpan.360.cn': {
            chk:  /^[a-z0-9]{4}$/i,
            code: '.pwd-input',
            btn:  '.submit-btn'
        },
        'yun.baidu.com': {
            chk:  /^[a-z0-9]{4}$/i,
            code: '.verify-input .pickpw input',
            btn:  '.verify-input .pickpw a.g-button'
        },
        'pan.baidu.com': {
            chk:  /^[a-z0-9]{4}$/i,
            code: '.verify-input .pickpw input',
            btn:  '.verify-input .pickpw a.g-button'
        },
        'eyun.baidu.com': {
            chk:  /^[a-z0-9]{4,6}$/i,
            code: '.share-access-code',
            btn:  '.g-button.g-button-blue'
        },
        'share.weiyun.com': {
            chk: /^[a-z0-9]{4}$/i,
            code: '#outlink_pwd',
            btn:  '#outlink_pwd_ok'
        }
    };

    waitDocReady(function () {
        console.info("DOMContentLoaded。");
        // 抓取提取码
        var sCode = location.hash.slice(1).trim(),
            hostName = location.host.match(/\w+\.\w+\.\w+$/)[0].toLowerCase();

        if (sCode.length > 4 && sCode[4] == '?') {
            sCode = sCode.slice(0, 4);
        }

        var conf = site[hostName];

        // 检查是否为合法格式
        if (!conf || !conf.chk.test(sCode)) {
            // 没有 Key 或格式不对
            console.info("没有 Key 或格式不对");
            return ;
        }

        // 调试用
        console.log ('抓取到的提取码: %s', sCode);

        // 加个小延时
        setTimeout (function () {
            // 键入提取码并单击「提交」按钮,报错不用理。
            var codeBox = $(conf.code),
                btnOk = $(conf.btn);

            if (codeBox) codeBox.value = sCode;

            if (conf.preSubmit)
                if (conf.preSubmit (codeBox, btnOk, sCode))
                    return ;

            if (btnOk) btnOk.click();
        }, 10);
    }, false);
})(function ($) {
    return document.querySelector ($);
}, function (callback) {
    if (document.readyState === "complete" || document.readyState === "interactive") {
        setTimeout(callback, 1);
    } else {
        addEventListener('DOMContentLoaded', callback, false);
    }
});
§
Posted: 14.02.2019
Edited: 16.02.2019

重了

Post reply

Sign in to post a reply.