获取阿里云盘refresh_token
// ==UserScript==
// @name 获取阿里云盘refresh_token
// @namespace http://tampermonkey.net/
// @version 0.1.3
// @description 获取阿里云盘的refresh_token
// @author You
// @match https://www.aliyundrive.com/drive/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=aliyundrive.com
// @grant none
// @run-at document-end
// ==/UserScript==
(function() {
'use strict';
let token = localStorage.getItem("token");
token = JSON.parse(token);
let refresh_token = token["refresh_token"];
console.log(token["refresh_token"]);
let bt = document.createElement("div");
bt.style=`padding: 2px 4px;
color: var(--context_primary);
border-radius: 5px;
background-color: var(--divider_secondary);
cursor: pointer;
font-size: 12px;`
bt.textContent="获取";
/*
let dd = document.body.getElementsByClassName("top-wrapper--d-YJl")[0];
dd.appendChild(bt);
*/
var myVar = setInterval(function(){ myTimer() }, 1000);
function myTimer() {
if(document.querySelector('[class^="nav-menu--"]')!=null){
let bt = document.createElement("div");
bt.style=`padding: 2px 4px;
color: var(--context_primary);
border-radius: 5px;
background-color: var(--divider_secondary);
cursor: pointer;
font-size: 12px;`
bt.textContent="获取refresh_token";
bt.onclick = function () {
var aux = document.createElement("input");
aux.setAttribute("value", refresh_token);
document.body.appendChild(aux);
aux.select();
document.execCommand("copy");
document.body.removeChild(aux);
alert(refresh_token+"复制成功");
//window.location.href = "http://localhost:9798/";
};
document.querySelector('[class^="nav-menu--"]').appendChild(bt);
myStopFunction();
}
}
function myStopFunction() {
clearInterval(myVar);
}
})();