您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Ajoute un bouton pour télécharger des vidéos via Y2Mate sur YouTube avec une option pour le masquer via un raccourci clavier
当前为
// ==UserScript== // @name Bouton Téléchargement Multi-Sites (Y2Mate pour YouTube) // @namespace https://gf.qytechs.cn/ // @version 1.12 // @description Ajoute un bouton pour télécharger des vidéos via Y2Mate sur YouTube avec une option pour le masquer via un raccourci clavier // @author TonNom // @match *://*/* // @grant none // ==/UserScript== (function() { 'use strict'; let isButtonVisible = true; function addDownloadButtons() { const videos = document.querySelectorAll('video'); if (videos.length === 0) return; videos.forEach(video => { if (video.dataset.hasDownloadButtons) return; video.dataset.hasDownloadButtons = true; const container = document.createElement('div'); container.style.position = 'absolute'; container.style.top = '10px'; container.style.right = '10px'; container.style.zIndex = '1000'; container.style.display = 'flex'; container.style.flexDirection = 'column'; container.style.gap = '5px'; // Ajout du bouton uniquement pour YouTube (Y2Mate) if (window.location.hostname.includes('youtube.com')) { const y2mateButton = document.createElement('button'); y2mateButton.innerText = 'Télécharger via Y2Mate'; y2mateButton.style.backgroundColor = 'rgba(0, 0, 0, 0.7)'; y2mateButton.style.color = 'white'; y2mateButton.style.border = 'none'; y2mateButton.style.padding = '8px 12px'; y2mateButton.style.fontSize = '12px'; y2mateButton.style.cursor = 'pointer'; y2mateButton.style.borderRadius = '5px'; y2mateButton.style.opacity = '0.8'; y2mateButton.onmouseenter = () => { y2mateButton.style.opacity = '1'; }; y2mateButton.onmouseleave = () => { y2mateButton.style.opacity = '0.8'; }; y2mateButton.onclick = () => openY2Mate(video); container.appendChild(y2mateButton); } video.parentNode.style.position = 'relative'; video.parentNode.appendChild(container); }); } function openY2Mate(video) { let videoUrl = video.querySelector('source')?.src || video.src; if (!videoUrl) { alert('Impossible de détecter la vidéo'); return; } if (window.location.hostname.includes('youtube.com')) { const videoId = new URLSearchParams(window.location.search).get('v'); if (videoId) { window.open(`https://www.y2mate.com/fr/youtube/${videoId}`, '_blank'); return; } } alert("Ce site ne permet pas la récupération directe via Y2Mate."); } function observeDOMChanges() { const observer = new MutationObserver(addDownloadButtons); observer.observe(document.body, { childList: true, subtree: true }); } function toggleButtonsVisibility() { isButtonVisible = !isButtonVisible; document.querySelectorAll('div').forEach(container => { if (container.childNodes.length && container.childNodes[0].innerText.includes('Télécharger via')) { container.style.display = isButtonVisible ? 'block' : 'none'; } }); } // Gestion du raccourci "h" pour masquer/afficher les boutons document.addEventListener('keydown', (event) => { if (event.key === 'h') { // Appuyer sur 'h' pour masquer/afficher les boutons toggleButtonsVisibility(); } }); window.addEventListener('load', () => { addDownloadButtons(); observeDOMChanges(); }); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址