BiliBili稿件批量举报【可能存在封号,请勿在大号使用】
// ==UserScript==
// @name BiliBili稿件批量举报【可能存在封号,请勿在大号使用】
// @namespace https://bbs.tampermonkey.net.cn/
// @version 0.1.1
// @description try to take over the world!
// @author You
// @match https://space.bilibili.com/*
// @grant GM_setValue
// @grant GM_getValue
// @grant GM_xmlhttpRequest
// @grant GM_registerMenuCommand
// @grant GM_unregisterMenuCommand
// @connect api.bilibili.com
// @connect www.bilibili.com
// ==/UserScript==
const SubmitText = '涉嫌考试作弊,违法违规。'
GM_registerMenuCommand("自动举报所有稿件", fuckBilibiliShitVideo, "h");
let csrfText = ''
function getCsrf() {
if (csrfText === '') {
const cook = document.cookie.match(/bili_jct=(.*?);/) ?? []
if (cook.length === 2) {
csrfText = cook[1]
}
}
return csrfText
}
function fuckVideo(aid) {
var xhr = new XMLHttpRequest();
xhr.open("POST", 'https://api.bilibili.com/x/web-interface/appeal/v2/submit', true);
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhr.withCredentials = true; //支持跨域发送cookies
xhr.onload = function () {
console.log(this.response)
};
xhr.send("aid=" + aid + "&attach=&block_author=false&csrf=" + getCsrf() + "&desc=" + encodeURIComponent(SubmitText) + '&tid=2');
}
async function getVideoAid(id) {
return new Promise((resolve) => {
GM_xmlhttpRequest({
url: "https://www.bilibili.com/video/" + id + "/?spm_id_from=333.999.0.0",
method: "GET",
onload: function (xhr) {
const aid = xhr.responseText.match(/\"aid\":(\d{4,})/);
resolve(aid[1])
}
});
})
}
async function getPageAllVideoAid() {
const idList = [...document.querySelectorAll('.list-list .list-item')].map((dom) => dom.attributes['data-aid'].value)
for (let index = 0; index < idList.length; index++) {
const aid = await getVideoAid(idList[index])
fuckVideo(aid)
}
}
async function fuckBilibiliShitVideo() {
await getPageAllVideoAid()
alert('本页全部举报成功')
}