// ==UserScript==
// @name BlackList_Sniffer
// @namespace https://space.bilibili.com/
// @version 1.0.0
// @description 自动拉黑B站机器人卡房号
// @grant GM_cookie
// @grant GM_xmlhttpRequest
// @grant GM_addStyle
// @run-at document-end
// @connect bilibili.com
// @author 熊璜Ailurus
// @match https://space.bilibili.com/*
// ==/UserScript==
function get_csrf(){
GM_cookie('list', {
domain: ".bilibili.com",
name:"bili_jct"
}, (item) => {
if(item)
{
console.log(item[0].value);
document.getElementById('inp_csrf').value =item[0].value;
}
});
}
function start_blocking(uid,index,total) {
let fd = new FormData();
fd.append('fid',uid);
fd.append('act',5);
fd.append('re_src',11);
fd.append('gaia_source','web_main');
fd.append('spmid','333.999.0.0');
fd.append('extend_content',`{"entity":"user","entity_id":3546776046930594,"fp":"0\u00012560,,1440\u0001Win32\u000124\u00018\u000124\u00011\u0001zh-CN\u00010\u00010,,0,,0\u0001Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 Edg/131.0.0.0"}`);
fd.append('csrf',document.getElementById('inp_csrf').value);
let _url = `https://api.bilibili.com/x/relation/modify`;
GM_xmlhttpRequest({
method: "POST",
url: _url,
headers: {
"content-type:": "application/x-www-form-urlencoded",
"Accept": "*/*"
},
data: fd,
onload: function (response) {
let code=JSON.parse(response.responseText)?.code;
let message=JSON.parse(response.responseText)?.message;
let element=document.getElementById('log');
if(code==0)
{
console.log(`拉黑成功!uid:${uid}`);
element.innerHTML+=`[${index+1}/${total}]拉黑成功!uid:${uid}
`;
element.scrollTop = element.scrollHeight;
}
else
{
console.log(`拉黑失败!uid:${uid}.原因:${message}`);
element.innerHTML+=`[${index+1}/${total}]拉黑失败!uid:${uid}.原因:${message}
`;
element.scrollTop = element.scrollHeight;
}
},
onerror: function (response) {
console.log(`拉黑失败!uid:${uid}.原因:${response.responseText}`);
element.innerHTML+=`[${index+1}/${total}]拉黑失败!uid:${uid}.原因:${response.responseText}
`;
element.scrollTop = element.scrollHeight;
}
});
}
let div = document.createElement("div");
div.innerHTML =
`