Last active
February 16, 2021 04:21
-
-
Save cjybyjk/575accb2cc1339f5be6b039ee22793e8 to your computer and use it in GitHub Desktop.
检查在 豆瓣《2015年中央电视台春节联欢晚会》 的短评中有多少打一星的用户被封号
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name New Userscript | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author You | |
// @match https://movie.douban.com/subject/26323782/* | |
// @grant GM_xmlhttpRequest | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
function checkBanned() { | |
var eles = document.getElementsByClassName("comment-item"); | |
for (var i = 0; i < eles.length; i++) { | |
let ele = eles[i]; | |
let isOneStar = ele.getElementsByClassName("allstar10").length != 0; | |
if (!isOneStar) continue; | |
let avatar = ele.getElementsByClassName("avatar")[0].getElementsByTagName("a")[0]; | |
let userURL = avatar.href; | |
let userName = avatar.title; | |
/*请求调用*/ | |
GM_xmlhttpRequest({ | |
method: "GET", | |
url: userURL, | |
onload: function(res) { | |
if (res.responseText.indexOf("永久停用") != -1) { | |
console.log("user " + userName + " was banned!"); | |
} else { | |
console.log("user " + userName + " OK!"); | |
} | |
} | |
}); | |
} | |
} | |
var button = document.createElement("button"); | |
button.textContent = "check!"; | |
button.style.width = "60px"; | |
button.style.height = "20px"; | |
button.style.align = "center"; | |
button.onclick = function(){ | |
checkBanned(); | |
}; | |
document.body.appendChild(button); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment