您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
B站评论区自动标注a畜,依据是动态里是否有相应关键词
当前为
// ==UserScript== // @name a畜指示器 // @namespace acg // @version 0.2.4 // @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', icon:'https://i2.hdslb.com/bfs/face/26ad353c5dfa2319417e5bac84f876b9bd1b54a6.jpg' }, yichu:{ name:'纯种奕畜', keyword:/想到晚的瞬间|晚比|向晚大魔王|顶碗人/, color:'#9AC8E2', icon:'https://i0.hdslb.com/bfs/face/566078c52b408571d8ae5e3bcdf57b2283024c27.jpg' }, conjoined:{ name:'连体出生', keyword:/嘉晚饭|糖瓷碗|然比.*晚比|嘉然.*向晚|然然.*晚晚/, color:'#A35700', icon:'https://i0.hdslb.com/bfs/face/5c96482229770f811460462f875a7b0031dfc4c2.jpg' }, starturtle:{ name:'缩壳星龟', keyword:/贝极星空间站|拉姐|勇敢牛牛|贝极星/, color:'#DB7D74', icon:'https://i1.hdslb.com/bfs/face/668af440f8a8065743d3fa79cfa8f017905d0065.jpg' }, gonorrhea:{ name:'淋病晚期', keyword:/乃琳夸夸群|乃淇淋|乃宝/, color:'#576690', icon:'https://i0.hdslb.com/bfs/face/8895c87082beba1355ea4bc7f91f2786ef49e354.jpg' }, sugardaddy:{ name:'高雅糖爹', keyword:/嘉心糖的手帐本|嘉然今天吃什么/, color:'#E799B0', icon:'https://i2.hdslb.com/bfs/face/d399d6f5cf7943a996ae96999ba3e6ae2a2988de.jpg' } } const whiteList={ '672328094':{ name:'ご主人様', keyword:null, color:'#E799B0', icon:'https://i2.hdslb.com/bfs/face/d399d6f5cf7943a996ae96999ba3e6ae2a2988de.jpg' } } 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(t.name)===false){ let box=document.createElement('div') let tag=document.createElement('span') let icon=document.createElement('img') box.style.display='inline-block' box.style.backgroundColor=t.color box.style.marginLeft='0.3rem' icon.style.width='1.3rem' icon.style.height='1.3rem' icon.style.verticalAlign='middle' tag.innerText=t.name tag.style.color='white' tag.style.verticalAlign='middle' icon.src=t.icon c.append(box) box.append(icon) box.append(tag) } } var now=new Date().getTime() var lastCache=GM_getValue("AC_Last_Cache_Time",null) if(lastCache==null){GM_setValue("AC_Last_Cache_Time",now);lastCache=now} const clearCache=()=>{ GM_setValue("AC_Cache",{}) GM_setValue("AC_Last_Cache_Time",now) } if(now-lastCache>=600000)clearCache() var 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) if(whiteList[pid]!=null){ add_tag(c,whiteList[pid]) }else{ let x=cache[pid] if(x!=null&&(x instanceof Array)){ for(let i=0;i<x.length;i++){ add_tag(c,tags[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(i==='sugardaddy'&&cache[pid]!=null&&cache[pid].length>0)break if(cache[pid]==null||!(cache[pid] instanceof Array)){ cache[pid]=[] } cache[pid].push(i) add_tag(c,tags[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或关注我们的公众号极客氢云获取最新地址