Twitch Hide Viewer Bots

Hide bots from viewers list in Twitch (bot data from twitchinsights.net)

Tính đến 04-06-2023. Xem phiên bản mới nhất.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(Tôi đã có Trình quản lý tập lệnh người dùng, hãy cài đặt nó!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name Twitch Hide Viewer Bots
// @description Hide bots from viewers list in Twitch (bot data from twitchinsights.net)
// @license MIT
// @author İsmail Karslı <[email protected]> (https://ismail.karsli.net)
// @namespace https://github.com/ismailkarsli
// @homepageURL https://github.com/ismailkarsli/userscripts
// @supportURL https://githubcom/ismailkarsli/userscripts/issues
// @version 1.0.0
// @match https://www.twitch.tv/*
// @grant none
// ==/UserScript==

const bots = new Set();
const MutationObserver =
	window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
const observer = new MutationObserver((e) => {
	let chatters = document.querySelectorAll(".chatter-list-item");
	chatters.forEach((chatter) => {
		const username = chatter.querySelector("button.tw-link")?.innerText;
		const isBot = bots.has(username);
		if (isBot) {
			chatter.style.display = "none";
		}
	});
});

fetch("https://api.twitchinsights.net/v1/bots/online")
	.then((res) => res.json())
	.then((data) => {
		data?.bots?.forEach((bot) => bot?.[0] && bots.add(bot[0]));
		if (bots.size) {
			observer.observe(document.body, {
				childList: true,
				subtree: true,
			});
		}
	})
	.catch((error) => console.warn("Twitch Hide Viewer Bots", "Bot list couldn't fetched", error));