您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Make blacklist of bilibili a deque
当前为
// ==UserScript== // @name Bilibili Black Deque // @version 0.0.4 // @namespace http://tampermonkey.net/ // @description Make blacklist of bilibili a deque // @author Zxilly // @source https://github.com/Zxilly/bili-black-deque // @license https://opensource.org/licenses/MIT // @match *://www.bilibili.com/* // @require https://cdn.jsdelivr.net/npm/[email protected] // ==/UserScript== /******/(()=>{/******/"use strict";/******/var t={/***/397:/***/function(t,e,n){var i=this&&this.__awaiter||function(t,e,n,i){function o(t){return t instanceof n?t:new n(function(e){e(t)})}return new(n||(n=Promise))(function(n,r){function a(t){try{l(i.next(t))}catch(t){r(t)}}function c(t){try{l(i["throw"](t))}catch(t){r(t)}}function l(t){t.done?n(t.value):o(t.value).then(a,c)}l((i=i.apply(t,e||[])).next())})};var o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(e,"__esModule",{value:true});e.getBlackListCnt=void 0;const r=o(n(467));function a(){return i(this,void 0,void 0,function*(){const t=(yield r.default.get("https://api.bilibili.com/x/relation/blacks",{withCredentials:true})).data;return t.data.total})}e.getBlackListCnt=a;/***/},/***/213:/***/function(t,e,n){var i=this&&this.__awaiter||function(t,e,n,i){function o(t){return t instanceof n?t:new n(function(e){e(t)})}return new(n||(n=Promise))(function(n,r){function a(t){try{l(i.next(t))}catch(t){r(t)}}function c(t){try{l(i["throw"](t))}catch(t){r(t)}}function l(t){t.done?n(t.value):o(t.value).then(a,c)}l((i=i.apply(t,e||[])).next())})};Object.defineProperty(e,"__esModule",{value:true});const o=n(285);const r=n(397);function a(){return i(this,void 0,void 0,function*(){let t=yield(0,r.getBlackListCnt)();const e=window.prompt(`现在黑名单有 ${t} 人,想移除:`);if(e===null){alert("必须输入一个整数");return}const n=Number.parseInt(e);if(Number.isNaN(n)){alert(`${e} 不能被解释为合法整数`);return}if(n<=0){alert("数字必须大于 0")}if(t<n){alert(`当前黑名单中的人数 ${t} 少于 ${n}`);return}yield(0,o.popBlack)(n,t);const i=yield(0,r.getBlackListCnt)();alert(`处理完成,当前黑名单有 ${i} 人`)})}function c(){return i(this,void 0,void 0,function*(){let t=yield(0,r.getBlackListCnt)();const e=window.prompt(`当前黑名单有 ${t} 人,想保持在:`);if(e===null){alert("必须输入一个整数");return}const n=Number.parseInt(e);if(Number.isNaN(n)){alert(`${e} 不能被解释为合法整数`);return}if(n<=0){alert("数字必须大于 0")}if(n>t){console.warn(`当前黑名单中的人数 ${t} 少于 ${n}`)}localStorage.setItem(s,n.toString());localStorage.removeItem(u);yield l()})}function l(){return i(this,void 0,void 0,function*(){const t=localStorage.getItem(s);if(t===null){return}const e=Number.parseInt(t);if(Number.isNaN(e)){console.error(`target ${t} is not a number`);return}const n=localStorage.getItem(u);const i=new Date().toDateString();if(n===i){return}let a=yield(0,r.getBlackListCnt)();if(a>e){yield(0,o.popBlack)(a-e,a)}localStorage.setItem(u,i)})}document.addEventListener("keydown",t=>i(void 0,void 0,void 0,function*(){if(t.altKey&&t.key==="b"){yield a()}if(t.altKey&&t.key==="c"){yield c()}}));const s="keep-target";const u="last-task-date";(()=>i(void 0,void 0,void 0,function*(){yield l()}))();/***/},/***/285:/***/function(t,e,n){var i=this&&this.__awaiter||function(t,e,n,i){function o(t){return t instanceof n?t:new n(function(e){e(t)})}return new(n||(n=Promise))(function(n,r){function a(t){try{l(i.next(t))}catch(t){r(t)}}function c(t){try{l(i["throw"](t))}catch(t){r(t)}}function l(t){t.done?n(t.value):o(t.value).then(a,c)}l((i=i.apply(t,e||[])).next())})};var o=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{"default":t}};Object.defineProperty(e,"__esModule",{value:true});e.popBlack=void 0;const r=o(n(467));const a=document.cookie.split("; ").find(t=>t.startsWith("bili_jct")).split("=")[1];function c(t,e){return i(this,void 0,void 0,function*(){const n=Math.ceil(e/50);const i=[];for(let e=n;e>0;e--){const n=(yield r.default.get("https://api.bilibili.com/x/relation/blacks",{params:{ps:20,pn:e},withCredentials:true})).data;const o=n.data.list;o.reverse();for(const e of o){const n=e["mid"];i.push(n);if(i.length>=t){break}}if(i.length>=t){break}}console.log(JSON.stringify(i));console.log("收集完成,准备解除");console.groupCollapsed("解除请求细节");for(let t of i){const e=new URLSearchParams;e.append("fid",t);e.append("csrf",a);e.append("act","6");e.append("re_src","116");let n=3;while(n>0){const t=(yield r.default.post("https://api.bilibili.com/x/relation/modify",e,{withCredentials:true})).data;console.debug(JSON.stringify(t));if(t.code===0){break}n--}}console.groupEnd()})}e.popBlack=c;/***/},/***/467:/***/t=>{t.exports=axios;/***/}};/************************************************************************//******/// The module cache /******/var e={};/******//******/// The require function /******/function n(i){/******/// Check if module is in cache /******/var o=e[i];/******/if(o!==undefined){/******/return o.exports;/******/}/******/// Create a new module (and put it into the cache) /******/var r=e[i]={/******/// no module.id needed /******/// no module.loaded needed /******/exports:{}};/******//******/// Execute the module function /******/t[i].call(r.exports,r,r.exports,n);/******//******/// Return the exports of the module /******/return r.exports;/******/}/******//************************************************************************//******//******/// startup /******/// Load entry module and return exports /******/// This entry module is referenced by other modules so it can't be inlined /******/var i=n(213);/******//******/})();