Twitch Turbo +

Block all Twitch ads, automatically claim bonus points, auto join raids, inject BTTV emotes, and promote Discord server

目前为 2024-09-17 提交的版本。查看 最新版本

// ==UserScript==
// @name         Twitch Turbo +
// @namespace    https://github.com/Brembo19
// @version      1.4
// @description  Block all Twitch ads, automatically claim bonus points, auto join raids, inject BTTV emotes, and promote Discord server
// @author       Brembo19
// @match        *://*.twitch.tv/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    const blockAdsInVideo = () => {
        const video = document.querySelector('video');
        if (video && video.src.includes('ad_')) {
            video.src = '';
            console.log('Ad blocked in video stream');
        }
    };

    const removeAdBanners = () => {
        const adSelectors = [
            '[aria-label="Advertisement"]',
            '.ad-banner',
            '.ad-slot',
            '.tw-ad-container',
            '[data-ad="true"]',
            'div[class*="ad-"]',
            'div[class*="sponsored"]'
        ];

        adSelectors.forEach(selector => {
            document.querySelectorAll(selector).forEach(ad => ad.remove());
        });
        console.log('Ad banners removed');
    };

    const observeDynamicContent = () => {
        const observer = new MutationObserver(mutations => {
            mutations.forEach(mutation => {
                if (mutation.type === 'childList') {
                    removeAdBanners();
                }
            });
        });

        observer.observe(document.body, { childList: true, subtree: true });
    };

    const autoClaimBonus = () => {
        let claiming = false;
        const observer = new MutationObserver(() => {
            const bonus = document.querySelector('.claimable-bonus__icon');
            if (bonus && !claiming) {
                bonus.click();
                claiming = true;
                console.log('Bonus claimed');
                setTimeout(() => { claiming = false; }, Math.random() * 1000 + 1000);
            }
        });

        observer.observe(document.body, { childList: true, subtree: true });
    };

    const autoJoinRaid = () => {
        const observer = new MutationObserver(() => {
            const raidButton = document.querySelector('button[data-test-selector="raid-banner__join-button"]');
            if (raidButton) {
                raidButton.click();
                console.log('Automatically joined the raid');
            }
        });

        observer.observe(document.body, { childList: true, subtree: true });
    };

    const injectBTTVEmotes = () => {
        const emoteURL = 'https://betterttv.com/emotes/popular';
        const emoteContainer = document.createElement('div');
        emoteContainer.id = 'bttv-emotes';
        emoteContainer.style.position = 'fixed';
        emoteContainer.style.bottom = '0';
        emoteContainer.style.right = '0';
        emoteContainer.style.backgroundColor = '#000';
        emoteContainer.style.color = '#fff';
        emoteContainer.style.padding = '10px';
        emoteContainer.style.zIndex = '9999';
        emoteContainer.style.maxHeight = '200px';
        emoteContainer.style.overflowY = 'scroll';
        emoteContainer.style.display = 'flex';
        emoteContainer.style.flexWrap = 'wrap';
        document.body.appendChild(emoteContainer);

        fetch(emoteURL)
            .then(response => response.json())
            .then(data => {
                const emotes = data.emotes;
                emotes.forEach(emote => {
                    const emoteImg = document.createElement('img');
                    emoteImg.src = `https://cdn.betterttv.net/emote/${emote.id}/1x`;
                    emoteImg.style.width = '32px';
                    emoteImg.style.height = '32px';
                    emoteImg.style.margin = '5px';
                    emoteImg.title = emote.code;
                    emoteContainer.appendChild(emoteImg);
                });
                console.log('BTTV emotes injected');
            })
            .catch(error => console.error('Error fetching BTTV emotes:', error));
    };

    const injectDiscordAd = () => {
        const adContainer = document.createElement('div');
        adContainer.id = 'discord-ad';
        adContainer.style.position = 'fixed';
        adContainer.style.top = '10px';
        adContainer.style.right = '10px';
        adContainer.style.backgroundColor = '#7289da';
        adContainer.style.color = '#fff';
        adContainer.style.padding = '10px';
        adContainer.style.zIndex = '9999';
        adContainer.style.borderRadius = '5px';
        adContainer.style.boxShadow = '0px 0px 10px rgba(0, 0, 0, 0.5)';
        adContainer.innerHTML = `
            <div style="text-align: center;">
                <p>Join our Discord Server!</p>
                <a href="https://discord.gg/Cwm8fwknKC" target="_blank" style="color: #fff; text-decoration: underline;">
                    Click here to join
                </a>
            </div>
        `;
        document.body.appendChild(adContainer);
    };

    blockAdsInVideo();
    removeAdBanners();
    observeDynamicContent();
    autoClaimBonus();
    injectBTTVEmotes();
    autoJoinRaid();
    injectDiscordAd();

    setInterval(blockAdsInVideo, 1000);
    setInterval(removeAdBanners, 2000);
})();
长期地址
遇到问题?请前往 GitHub 提 Issues,或加Q群1031348184

赞助商

Fishcpy

广告

Rainyun

注册一下就行

Rainyun

一年攒够 12 元