YouTube MP3 Button (Simple & Working)

Simple MP3 download button (redirect-based, works)

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği indirebilmeniz için ayrıca Tampermonkey gibi bir eklenti kurmanız gerekmektedir.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

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.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name         YouTube MP3 Button (Simple & Working)
// @namespace    simple-mp3
// @version      1.0
// @description  Simple MP3 download button (redirect-based, works)
// @match        https://www.youtube.com/*
// @grant        none
// ==/UserScript==

(function () {
    'use strict';

    function addButton() {
        if (!location.pathname.startsWith('/watch')) return;
        if (document.querySelector('#simple-mp3-btn')) return;

        const target = document.querySelector('ytd-subscribe-button-renderer');
        if (!target) return;

        const btn = document.createElement('button');
        btn.id = 'simple-mp3-btn';
        btn.textContent = 'MP3';
        btn.style.cssText = `
            margin-left:8px;
            padding:6px 12px;
            background:#ff0000;
            color:#fff;
            border:none;
            border-radius:2px;
            cursor:pointer;
            font-size:12px;
        `;

        btn.onclick = () => {
            const url = encodeURIComponent(location.href);

            // любой рабочий онлайн-конвертер
            window.open(
                `https://y2mate.is/youtube-mp3/${url}`,
                '_blank'
            );
        };

        target.after(btn);
    }

    new MutationObserver(addButton)
        .observe(document.body, { childList: true, subtree: true });
})();