您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
当弹幕发送失败(如被拦截)时在弹幕栏显示提示及原因
// ==UserScript== // @name Bilibili直播弹幕发送失败显示提示 // @namespace https://greasyfork.org/users/236434 // @version 0.0.1 // @description 当弹幕发送失败(如被拦截)时在弹幕栏显示提示及原因 // @author astrile // @match https://live.bilibili.com/* // @icon https://www.bilibili.com/favicon.ico // @license MIT // @run-at document-start // @grant none // ==/UserScript== (function() { 'use strict'; const checkCommentRsp = async (requestData, response) => { const rsp = await response.clone().json(); if (rsp.code === 0 && rsp.msg) { rsp.msg = { 'f': "弹幕含全局屏蔽词", 'fire': "弹幕含全局屏蔽词", 'k': "弹幕含房间屏蔽词", "max limit exceeded": "当前房间弹幕流量过大", }[rsp.msg] || rsp.msg; const e = document.createElement("div"); e.className = "chat-item convention-msg border-box"; e.innerText = '弹幕发送失败:' + rsp.msg; document.querySelector('#chat-items').appendChild(e); } } const origFetch = window.fetch; window.fetch = async function() { const url = arguments[0]; if (url.match('api.live.bilibili.com/msg/send')) { const data = arguments[1].data; const response = await origFetch.apply(this, arguments); checkCommentRsp(data, response.clone()); return response; } else { return origFetch.apply(this, arguments); } } })();