您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Greasy Fork is available in English.
配合纸鸢油猴子脚本,获取注册 pikpak 时的验证码。20241012更新:由于微软邮箱新机制,短效邮箱的登录需要搭配Oauth2协议,所以新加了 oauth2 取件接口。
当前为
// ==UserScript== // @name Pikpak验证码获取工具[AAA] // @namespace https://home.bilivo.top/ // @version 1.1 // @license MIT // @description 配合纸鸢油猴子脚本,获取注册 pikpak 时的验证码。20241012更新:由于微软邮箱新机制,短效邮箱的登录需要搭配Oauth2协议,所以新加了 oauth2 取件接口。 // @author AAA // @icon https://image.211678.top/file/AgACAgUAAyEGAASIgfLNAAMEZt1G7t_dD1e01O-7w-xW3MQGbUcAAqvEMRtEPPBWNntf0QmNWM4BAAMCAAN4AAM2BA // @match *://mypikpak.com/* // @match *://pikpak.me/* // @match *://mypikpak.net/* // @grant GM_xmlhttpRequest // @grant GM_addStyle // ==/UserScript== (function() { 'use strict'; GM_addStyle(` @import url('https://unpkg.com/element-ui/lib/theme-chalk/index.css'); #toggleButton{position:fixed;top:7%;right:20px;z-index:9999;background-color:#409EFF;color:white;padding:10px 20px;border:none;border-radius:5px;cursor:pointer;font-size:16px;line-height:20px;}#formContainer{position:fixed;top:100px;right:20px;z-index:9998;background:white;padding:20px;box-shadow:0px 0px 15px rgba(0,0,0,0.1);border-radius:10px;width:300px;display:none;}.el-form-item{margin-bottom:20px;}.el-button{width:100%;padding:10px 0;}#modeSwitch{display:flex;justify-content:space-around;margin-bottom:20px;}#pop3Section,#oauth2Section{display:none;}#oauthCode{height:130px;line-height:20px;}.el-form-item {margin-bottom: 10px;} `); const toggleButton = document.createElement('button'); toggleButton.id = 'toggleButton'; toggleButton.innerText = '显/隐获取验证码'; document.body.appendChild(toggleButton); const formContainer = document.createElement('div'); formContainer.id = 'formContainer'; formContainer.innerHTML = ` <div id="modeSwitch"> <button id="pop3Mode" class="el-button el-button--primary">POP3</button> <button id="oauth2Mode" class="el-button">OAuth2</button> </div> <form id="emailForm" class="el-form" label-position="top"> <div id="pop3Section"> <div class="el-form-item"> <label class="el-form-item__label">邮箱</label> <div class="el-input"> <input id="userName" type="text" autocomplete="off" placeholder="请输入邮箱" class="el-input__inner"> </div> </div> <div class="el-form-item"> <label class="el-form-item__label">POP3 授权码</label> <div class="el-input"> <input id="passWord" type="password" autocomplete="off" placeholder="请输入POP3授权码" class="el-input__inner"> </div> </div> </div> <div id="oauth2Section"> <div class="el-form-item"> <label class="el-form-item__label">oauth2形式邮箱数据</label> <div class="el-input"> <textarea id="oauthCode" placeholder="以闪邮箱提取示例:[email protected]_BAY.0.U.-Cxxxx$----8b4ba9dd-3ea5-4e5f-86f1-xxxx" class="el-input__inner" rows="20"></textarea> </div> </div> </div> <div class="el-form-item"> <label class="el-form-item__label">验证码</label> <div class="el-input"> <input id="verificationCode" type="text" autocomplete="off" placeholder="验证码将显示在此处" class="el-input__inner" readonly> </div> </div> <div class="el-form-item"> <button id="getCodeBtn" class="el-button el-button--primary" type="button">获取验证码</button> </div> </form> `; document.body.appendChild(formContainer); const pop3Section = document.getElementById('pop3Section'); const oauth2Section = document.getElementById('oauth2Section'); const pop3ModeBtn = document.getElementById('pop3Mode'); const oauth2ModeBtn = document.getElementById('oauth2Mode'); let currentMode = 'pop3'; pop3Section.style.display = 'block'; toggleButton.addEventListener('click', function() { const appElement = document.getElementById('formContainer'); if (appElement.style.display === 'none' || appElement.style.display === '') { appElement.style.display = 'block'; } else { appElement.style.display = 'none'; } }); pop3ModeBtn.addEventListener('click', function() { currentMode = 'pop3'; pop3Section.style.display = 'block'; oauth2Section.style.display = 'none'; pop3ModeBtn.classList.add('el-button--primary'); oauth2ModeBtn.classList.remove('el-button--primary'); }); oauth2ModeBtn.addEventListener('click', function() { currentMode = 'oauth2'; pop3Section.style.display = 'none'; oauth2Section.style.display = 'block'; oauth2ModeBtn.classList.add('el-button--primary'); pop3ModeBtn.classList.remove('el-button--primary'); }); const getCodeBtn = document.getElementById('getCodeBtn'); getCodeBtn.addEventListener('click', function() { const verificationCodeInput = document.getElementById('verificationCode'); let url, requestData; if (currentMode === 'pop3') { const userName = document.getElementById('userName').value; const passWord = document.getElementById('passWord').value; if (!userName || !passWord) { alert('请输入邮箱和POP3授权码!'); return; } url = 'https://ppcode.bilivo.top/get_code'; requestData = { userName: userName, passWord: passWord, recipientEmail: userName }; } else if (currentMode === 'oauth2') { const oauthCode = document.getElementById('oauthCode').value.trim(); if (!oauthCode) { alert('请输入oauth2形式邮箱数据!以闪邮箱提取示例:[email protected]_BAY.0.U.-Cxxxx$----8b4ba9dd-3ea5-4e5f-86f1-xxxx'); return; } const oauthData = oauthCode.split('----'); if (oauthData.length !== 4) { alert('oauth2形式邮箱数据格式错误,请检查输入!'); return; } const [userName, passWord, refreshToken, clientId] = oauthData; url = 'https://ppcode.bilivo.top/oauth2'; requestData = { userName: userName, passWord: passWord, refreshToken: refreshToken, clientId: clientId }; } getCodeBtn.innerText = '加载中...'; getCodeBtn.disabled = true; GM_xmlhttpRequest({ method: 'POST', url: url, headers: { 'Content-Type': 'application/json' }, data: JSON.stringify(requestData), onload: function(response) { console.log("开始获取验证码..."); if (response.status === 200) { const data = JSON.parse(response.responseText); if (data.code === 200) { const verificationCode = data.verification_code; verificationCodeInput.value = verificationCode; navigator.clipboard.writeText(verificationCode).then(function() { alert('验证码已自动复制到剪切板:' + verificationCode); }, function(err) { alert('复制验证码到剪切板失败:' + err); }); } else { alert('未能获取到验证码,请重试或确保信息正确!'); } } else { const data = JSON.parse(response.responseText); alert(data.msg || '服务出错了...'); } getCodeBtn.innerText = '获取验证码'; getCodeBtn.disabled = false; }, onerror: function() { alert('无法连接到服务器'); getCodeBtn.innerText = '获取验证码'; getCodeBtn.disabled = false; } }); }); })();