您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
B站评论区自动标注a畜,依据是动态里是否有相应关键词
当前为
// ==UserScript== // @name a畜指示器 // @namespace acg // @version 0.2 // @description B站评论区自动标注a畜,依据是动态里是否有相应关键词 // @author a畜野爹 // @match https://*.bilibili.com/* // @icon https://static.hdslb.com/images/favicon.ico // @connect bilibili.com // @grant GM_getValue // @grant GM_setValue // @license MIT // @run-at document-end // ==/UserScript== (function() { 'use strict'; const tags={ del:{name:'<三畜>',keyword:/小狗说/,color:'#B8A6D9'}, yichu:{name:'<奕畜>',keyword:/想到晚的瞬间/,color:'#9AC8E2'}, conjoined:{name:'<司马连体人>',keyword:/嘉晚饭|糖瓷碗/,color:'#A35700'}, starturtle:{name:'<星龟>',keyword:/贝极星空间站/,color:'#DB7D74'}, gonorrhea:{name:'<淋病>',keyword:/乃琳夸夸群/,color:'#576690'} } var cache={} const blog = 'https://api.bilibili.com/x/polymer/web-dynamic/v1/feed/space?&host_mid=' const is_new = document.getElementsByClassName('item goback').length != 0 // 检测是不是新版 const get_pid = (c) => { if (is_new) { return c.dataset['userId'] } else { return c.children[0]['href'].replace(/[^\d]/g, "") } } const get_comment_list = () => { if (is_new) { let lst = new Set() for (let c of document.getElementsByClassName('user-name')) { lst.add(c) } for (let c of document.getElementsByClassName('sub-user-name')) { lst.add(c) } return lst } else { return document.getElementsByClassName('user') } } const add_tag=(c,t)=>{ if(c.textContent.includes(tags[t].name)===false){ let tag=document.createElement('span') tag.innerText=tags[t].name tag.style.color=tags[t].color c.append(tag) } } cache=GM_getValue("AC_Cache",{}) let scan = setInterval(()=>{ let commentlist = get_comment_list() if (commentlist.length != 0){ commentlist.forEach(c => { let pid = get_pid(c) let x=cache[pid] if(x!=null&&(x instanceof Array)){ for(let i=0;i<x.length;i++){ add_tag(c,x[i]) } }else{ let xhr=new XMLHttpRequest() xhr.open('GET',`${blog}${pid}`) xhr.onreadystatechange=()=>{ if(xhr.readyState==4){ if(xhr.status==200){ let res=JSON.parse(xhr.response) if(res.code==0){ for(let i in tags){ if(JSON.stringify(res.data).match(tags[i].keyword)){ if(cache[pid]==null||!(cache[pid] instanceof Array)){ cache[pid]=[] } cache[pid].push(i) add_tag(c,i) GM_setValue("AC_Cache",cache); } } }else{ console.error(`${xhr.response}`) } }else{ console.error(`${xhr.status}:${xhr.response}`); } } } xhr.send() } }); } }, 4000) })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址