仙家军成分查询Helper

用于标记仙家军和动态转发仙以及使用仙话术的b站用户。可能存在误伤,请注意辨别。脚本改自【糊狸-B站成分查询Helper】

目前为 2023-06-23 提交的版本。查看 最新版本

// ==UserScript==
// @name         仙家军成分查询Helper
// @namespace    www.bilibili.com
// @version      1.1.3
// @description  用于标记仙家军和动态转发仙以及使用仙话术的b站用户。可能存在误伤,请注意辨别。脚本改自【糊狸-B站成分查询Helper】
// @author       Darknights
// @match        https://*.bilibili.com/*
// @icon         https://static.hdslb.com/images/favicon.ico
// @connect      bilibili.com
// @grant        GM_xmlhttpRequest
// @license MIT
// @run-at document-end
// ==/UserScript==


(function () {
    'use strict';

    /* 配置区 */
    const config = {
        times: 2500, // 标签处理间隔时间 单位:ms
        testLog: false // 是否开启调试日志
    }
    // 显示标签配置在👇面

    const xianList = ['2626308','91294717','691660481','594265974','1399233488','201128149','492233743','1384853937','193242084','59212436','1547943832','355829734','439010078','3493110134868545','289739171','455857213','559989730','252864981','595397699','1825148722','300313419','2142529765','333755368','372672537','366752296','628918703','359762403','449254922','27748754','1397451482','435429250','293497224','87355702','1080954745','1005732624','353381701','3493146415598203','36832623','298253160','3493109944027757','1459252016','626718713','3493128606583732','1413259326','3493108211780104','288608355','398268451','527079387','1705910990','2072727585','19227977','8118856710','1986311121','273627979','322540587','3493264994863124','1436392582','3493122713586530','503354352','3493267740035490','3461576510147287','643362376','55417546','3493282594163167','20617055','3461564359248624','388317005','2029973237','543283877','599439268','937235','259851861','511355405','37660844','524480956','375074321','87296302','44952669','172725229','1369696284','389007','589755766','4947574','394067676','499866803','35612911','10453721','3493295195949740','1134025725','1350039692','442716028','1044725703','36579529','1677221329','5765492','1691881192','86520669','525706751','353839591','1113890768','3461574566086858','111339218','1531330351','662110818','3461574433966081','1770158437','646116461','2112612559','3494349983714230','3493080227383503','626139499','408443934','503777492','490811664','3493120108923438','1861056960','161537754','3493260081236751','3493123518892834','3493281459604332','1055982250','97156738','549164139','572103170','19767091','17426743','26144732','3493104510306572','20668227','310739216','38134752','2086415808','24370011','227711','341345864','131686171','1215911548','518890959','361110695','343483727','22356679','1500447686','382322597','1652444369','1379468139','700334419','1920077601','629636812','342625887','1999783629','1521899960','1250227139','1035834480','515953856','1269661366','1580057','342504730','492886360','322003546','402337847','509967955','545157646','46700199','393185198','330060938','1773068006','3493292132010608','2049417456','421415625','1901385718','1299712856','184834562','323316289','592098805','3493130307373585','3493283921660585','497749570','38669319','1886920878','3493128552057316','158409499','592716471','41500446','259073912','12763949','244195965','539194895','3493258432874938','185340617','3494352779217234','522203755','327726586','1727271882','36487502','338875111','3493257564654426','1920025624','2139759349','524487767','544543545','1924967026','179842197','1420029844','442412268','102046074','495136626','407011914','36451416','1790581737','1297044734','511375871','454444045','44118648','108124076','1025261779','238768745','454549461','188592371','495962652','396474607','89156315','11485934','1515887582','95185631','431370017','1590385783','107454145','36608252','406945605','3493261545048989','18207363','39146080','128154158','1980544130','676066921','3493272863377880','3493116193540136','227608286','516810524','406295394','513207733','397766990','365286131','385510829','474230029','1081849613','275361832','439632100','386219932','18736476','104186483','277899630','471878098','111381478','50736064','8666108','1362431770','26115845','32722773','13403990','84463540','350354084','405415031','1991965567','298351534','413328287','522577702','81621195','1095759525','503706427','292414916','669537029','2060377372','482356860','1590744061','1376192084','396361992','471334531','345588161','338768507','35153977'];

    const xianWordList = ['3412', '枘凿六合', '镀金旅团', /(手磨|手工|手调|买量)(咖啡|仙人)/, /(?=.*笑哭)(?=.*响指)/, '仙家军', '仙不灭', '散去吧', '(不是|是不)好惹的', /[周粥舟皱塞赛][处÷除畜批皮pP翁]/, '利刃', '原婴', '幻官', '孝战', '镍币人', '仙驱', /@(全自动|仙舟|欢愉|巡猎)/, /(百分百|100%)参团/, /(鹰|婴|ying?|舟|粥|周|皱|猴)(游社|ga|GA|站)/, /霜星(高尔夫|碎|尸|石|十)/, /[4四]字游戏/, '美洲大蠊', /(大蠊|蟑螂|高蛋白)(饼干|巧克力)/, '半壁江山', '硬核不媚宅', '龙门开盒', '烂穿地心', /([(\(][)\)]?){4}?/, /屠夫[钩勾√]子/, '裹尸袋', /(?=.*(海拉鲁|火把))(?=.*瘴气)/];

    const xianTag = ["<目标:仙>", "#11DD77"];

    const xianSmellTag = ["<环境:转发仙>", "#1E971E"];

    const xianWordTag = ["<环境:仙语>", "#04AEAB"];


    /* Functions */
    const getUid = function (htmlEntity) {
        if (isNew()) {
            return htmlEntity.dataset['userId'];
        } else {
            return htmlEntity.children[0]['href'].replace(/[^\d]/g, "");
        }
    }

    const getCommentList = function () {
        if (isNew()) {
            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 log = function (message) {
        return config.testLog ? console.log(message) : null;
    };

    const spawnHtml = function (data) {
        return `<b style='color: ${data[1]}' >${data[0]}</b>`
    }

    const smell = function (items) {
        for (var i = 0; i < items.length; i++) {
            var item = items[i];
            for (var key in item) {
                if (key == 'orig') {
                    var origId = String(item.orig.modules.module_author.mid);
                    if (xianList.indexOf(origId) > -1) {
                        return origId;
                    }
                }
            }
        }
        return null;
    }

    const hear = function (text) {
        for (var word of xianWordList) {
            var matchWord = text.match(word);
            if (matchWord != null) {
                return matchWord[0];
            }
        }
        return null;
    }

    const hearWord = function (items) {
        for (var i = 0; i < items.length; i++) {
            var item = items[i];
            if (item.modules.module_dynamic.desc != null) {
                var ownText = item.modules.module_dynamic.desc.text;
                var ownMatch = hear(ownText);
                if (ownMatch != null) {
                    return ownMatch;
                }
            }
            for (var key in item) {
                if (key == 'orig' && item.orig.modules.module_dynamic.desc != null) {
                    var origText = item.orig.modules.module_dynamic.desc.text;
                    var origMatch = hear(origText);
                    if (origMatch != null) {
                        return origMatch;
                    }
                }
            }
        }
        return null;
    }

    const blog = 'https://api.bilibili.com/x/polymer/web-dynamic/v1/feed/space?&host_mid=';
    // 检测是不是新版
    const isNew = function () {
        if (document.getElementsByClassName('item goback').length != 0) {
            return true;
        }
        if (document.getElementsByClassName('app-v1').length != 0) {
            return true;
        }
        if (document.getElementsByClassName('opus-detail').length != 0) {
            return true;
        }
        return false;
    };

    log('isNew:' + isNew());
    log("Loading...");

    setInterval(() => {
        const commentlist = getCommentList();
        if (commentlist.length != 0) {
            commentlist.forEach(htmlEntity => {
                if (htmlEntity.innerHTML.indexOf(`<span id="huli">`) == -1) {
                    htmlEntity.innerHTML += `<span id="huli">`;
                    const uid = getUid(htmlEntity);
                    // log('looking...' + uid);
                    if (xianList.indexOf(uid) > -1) {
                        log('>>target:' + uid);
                        htmlEntity.innerHTML += spawnHtml(xianTag);
                    } else {
                        GM_xmlhttpRequest({
                            method: "get",
                            url: blog + uid,
                            data: '',
                            headers: {
                                'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36'
                            },
                            onload: res => {
                                if (res.status === 200) {
                                    const dynamicJson = JSON.parse(res.response).data;
                                    if (dynamicJson.items != null) {
                                        var origId = smell(dynamicJson.items);
                                        if (origId != null) {
                                            log('>>smell:' + uid + '_repost:' + origId);
                                            htmlEntity.innerHTML += spawnHtml(xianSmellTag);
                                        }
                                        var hearMatch = hearWord(dynamicJson.items);
                                        if (hearMatch != null) {
                                            log('>>hear:' + uid + '_say:' + hearMatch);
                                            htmlEntity.innerHTML += spawnHtml(xianWordTag);
                                        }
                                    }
                                } else {
                                    log('Fail...');
                                    log(res);
                                }
                            },
                        });
                    }
                    htmlEntity.innerHTML += `</span>`;
                }
            });
        }
    }, config.times)
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址