From ef0c1c813d2bb8211441668ecd54648ecdee153f Mon Sep 17 00:00:00 2001 From: 502647092 Date: Mon, 17 Aug 2020 16:35:48 +0000 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20'mcbbs/fetch-emerald.user.?= =?UTF-8?q?js'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mcbbs/fetch-emerald.user.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 mcbbs/fetch-emerald.user.js diff --git a/mcbbs/fetch-emerald.user.js b/mcbbs/fetch-emerald.user.js new file mode 100644 index 0000000..4d6a5c1 --- /dev/null +++ b/mcbbs/fetch-emerald.user.js @@ -0,0 +1,32 @@ +// ==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); +})(); \ No newline at end of file