32 lines
1.2 KiB
JavaScript
32 lines
1.2 KiB
JavaScript
|
// ==UserScript==
|
||
|
// @name 自动抓取用户信息
|
||
|
// @namespace https://miaowoo.cc/
|
||
|
// @version 0.1
|
||
|
// @description 自动抓取用户信息
|
||
|
// @author MiaoWoo
|
||
|
// @match https://www.mcbbs.net/forum.php?mod=viewthread&tid=**
|
||
|
// @match https://www.mcbbs.net/thread-**-*-*.html
|
||
|
// @grant none
|
||
|
// ==/UserScript==
|
||
|
|
||
|
(function() {
|
||
|
'use strict';
|
||
|
|
||
|
function readUserInfo(user){
|
||
|
var userline = user.querySelector('a.xw1');
|
||
|
if (!userline) return;
|
||
|
var uid = userline.href.split('uid=')[1];
|
||
|
var username = userline.innerText;
|
||
|
var glod = user.querySelectorAll('dl.pil')[0].children[1].innerText;
|
||
|
var emerald = user.querySelectorAll('dl.pil')[0].children[3].innerText;
|
||
|
fetch('https://reward.yumc.pw/mcbbs/update/uid/'+uid+'/username/'+username+'/glod/'+parseInt(glod)+'/emerald/'+parseInt(emerald)).then(function(response) {
|
||
|
return response.json();
|
||
|
}).then(function(result) {
|
||
|
console.log(result);
|
||
|
});
|
||
|
}
|
||
|
function readAllUserInfo(){
|
||
|
document.querySelectorAll('div.pls').forEach(readUserInfo);
|
||
|
}
|
||
|
setTimeout(readAllUserInfo, 200);
|
||
|
})();
|