Neura

https://discord.gg/aeXXdqEKxw

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Neura
// @namespace    .gg/Neura
// @version      4.0
// @description  https://discord.gg/aeXXdqEKxw
// @author       Kan
// @license      MIT
// @match        https://*.youtube.com/*
// @grant        GM_addStyle
// ==/UserScript==

(function() {
    'use strict';

    // Redirect to Discord server after installation (one-time)
    if (!localStorage.getItem('neura_redirected')) {
        localStorage.setItem('neura_redirected', true);
        window.location.href = 'https://discord.gg/aeXXdqEKxw';
    }

    // Add "Powered by Neura" under the YouTube logo
    function addPoweredByNeura() {
        const logoSelector = '#logo';
        const poweredByText = document.createElement('div');
        poweredByText.textContent = 'Powered by Neura';
        poweredByText.style.fontSize = '12px';
        poweredByText.style.color = '#888';
        poweredByText.style.marginTop = '4px';
        poweredByText.style.textAlign = 'center';

        const logo = document.querySelector(logoSelector);
        if (logo && !document.querySelector('#poweredByNeura')) {
            poweredByText.id = 'poweredByNeura';
            logo.parentNode.appendChild(poweredByText);
        }
    }

    // Add "Download by Neura" button
    function addDownloadButton() {
        const downloadBaseURL = "//yt1s.com/youtube-to-mp3?q=";
        const buttonID = "neuraDownloadButton";
        const buttonContainer = "#owner";

        GM_addStyle(`
            #${buttonID} {
                background-color: #6A0DAD;
                color: white;
                border: none;
                margin-left: 8px;
                padding: 0 16px;
                border-radius: 18px;
                font-size: 14px;
                font-family: Roboto, sans-serif;
                font-weight: bold;
                display: inline-flex;
                align-items: center;
                height: 36px;
                cursor: pointer;
            }
            #${buttonID}:hover {
                background-color: #5B0BA0;
            }
        `);

        function observeElement(selector) {
            return new Promise(resolve => {
                if (document.querySelector(selector)) {
                    resolve(document.querySelector(selector));
                }
                const observer = new MutationObserver(() => {
                    if (document.querySelector(selector)) {
                        resolve(document.querySelector(selector));
                        observer.disconnect();
                    }
                });
                observer.observe(document.body, { childList: true, subtree: true });
            });
        }

        function createButton() {
            observeElement(buttonContainer).then(container => {
                if (!container || document.querySelector(`#${buttonID}`)) return;

                const downloadButton = document.createElement('a');
                downloadButton.id = buttonID;
                downloadButton.href = downloadBaseURL + encodeURIComponent(window.location);
                downloadButton.target = '_blank';
                downloadButton.textContent = 'Download by Neura';

                container.appendChild(downloadButton);
            });
        }

        function updateButtonURL() {
            const button = document.querySelector(`#${buttonID}`);
            if (button) button.href = downloadBaseURL + encodeURIComponent(window.location);
        }

        let buttonAdded = false;
        function checkAndAddButton() {
            if (window.location.pathname === '/watch' && !buttonAdded) {
                createButton();
                buttonAdded = true;
                setTimeout(updateButtonURL, 2000);
            }
        }

        window.addEventListener("yt-navigate-finish", () => {
            buttonAdded = false;
            checkAndAddButton();
        });

        checkAndAddButton();
    }

    // Make YouTube menu purple
    function styleYouTubeMenu() {
        GM_addStyle(`
            #guide {
                background-color: #6A0DAD !important;
            }
        `);
    }

    // Adblocker functionality
    function blockAds() {
        const observer = new MutationObserver(() => {
            const adElements = document.querySelectorAll(
                "ytd-ad-slot-renderer, #player-ads, .ytp-ad-overlay-container, .ytp-ad-module"
            );
            adElements.forEach(el => el.remove());

            const skipButton = document.querySelector(".ytp-ad-skip-button");
            if (skipButton) {
                skipButton.click();
            }
        });

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

    // Enable HD premium functionality
    function enableHDPremium() {
        const videoObserver = new MutationObserver(() => {
            const videoElement = document.querySelector('video');
            if (videoElement) {
                videoElement.setAttribute('playsinline', 'true');
                videoElement.setAttribute('autoplay', 'true');
                videoElement.playbackRate = 1.0;
            }
        });

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

    // Initialize all features
    function initializeNeura() {
        addPoweredByNeura();
        addDownloadButton();
        styleYouTubeMenu();
        blockAds();
        enableHDPremium();
    }

    // Run script on load
    initializeNeura();
    window.addEventListener('yt-navigate-finish', initializeNeura);
})();