Kick.com Unique Chatter Counter

Kick.com Unique Chatter Counter - Detect whos viewbotting

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

Bạn sẽ cần cài đặt một tiện ích mở rộng như Tampermonkey hoặc Violentmonkey để cài đặt kịch bản này.

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         Kick.com Unique Chatter Counter
// @version      0.4
// @description  Kick.com Unique Chatter Counter - Detect whos viewbotting
// @author       Rishi Sunak
// @match        https://kick.com/*
// @grant        none
// @namespace https://greasyfork.org/users/1235079
// ==/UserScript==

(function() {
    'use strict';

    let uniqueUserIds = {};
    let currentStreamSrc = null;

    function countUniqueUserIds() {
        const userIdElements = document.querySelectorAll('[data-chat-entry-user-id]');

        userIdElements.forEach(element => {
            const userId = element.getAttribute('data-chat-entry-user-id');
            uniqueUserIds[userId] = true;
        });

        const uniqueUserCount = Object.keys(uniqueUserIds).length;
        console.log(`Unique User IDs: ${uniqueUserCount}`);

        const chatHeaderElement = document.querySelector('.flex.flex-row.items-center.text-center .text-base.font-bold');
        if (chatHeaderElement) {
            chatHeaderElement.textContent = `Unique Chatters: ${uniqueUserCount}`;
        }
    }

    function checkStreamChange() {
        const videoElement = document.querySelector('video.vjs-tech');
        if (videoElement) {
            const newStreamSrc = videoElement.getAttribute('src');
            if (newStreamSrc !== currentStreamSrc) {
                uniqueUserIds = {};
                currentStreamSrc = newStreamSrc;
            }
        }
    }

    countUniqueUserIds();
    checkStreamChange();

    const observer = new MutationObserver(() => {
        countUniqueUserIds();
        checkStreamChange();
    });

    const targetNode = document.body;
    const config = { childList: true, subtree: true };

    observer.observe(targetNode, config);

})();