YouSnatch - YouTube Video Downloader

Adds a download button next to YouTube's volume control

目前為 2025-05-03 提交的版本,檢視 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         YouSnatch - YouTube Video Downloader
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Adds a download button next to YouTube's volume control
// @author       JourneysFootpath
// @match        https://www.youtube.com/*
// @grant        GM_addStyle
// @license MIT
// ==/UserScript==

(function() {
    'use strict';

    // Function to create the download button
    function createDownloadButton() {
        const button = document.createElement('button');
        button.textContent = 'YouSnatch';
        button.style.backgroundColor = '#FF5C00';  // Color
        button.style.color = 'white';
        button.style.border = 'none';
        button.style.padding = '5px 10px';
        button.style.fontSize = '14px';
        button.style.cursor = 'pointer';
        button.style.marginLeft = '10px';
        button.style.borderRadius = '4px';
        button.setAttribute('title', 'Download Video');

        // Add functionality for video download (stub)
        button.addEventListener('click', () => {
            alert("Downloading the highest quality video...");
            // Video download logic will go here
        });

        return button;
    }

    // Function to insert the button next to the volume control
    function insertButtonNextToVolume() {
        const volumePanel = document.querySelector('.ytp-volume-panel');

        if (volumePanel) {
            const button = createDownloadButton();
            volumePanel.appendChild(button);  // Append the button next to the volume
        } else {
            // If volume panel is not found, wait a little and try again
            setTimeout(insertButtonNextToVolume, 1000);
        }
    }

    // Insert button after the page is fully loaded
    window.addEventListener('load', () => {
        insertButtonNextToVolume();
    });
})();