您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Adds a Download Button for Videos/Mp3's
当前为
// ==UserScript== // @name Youtube download button - yt1s.com (revised SuchtiOnTour Edit) // @namespace Violentmonkey Scripts // @match https://www.youtube.com/watch // @match https://*.youtube.com/* // @grant GM_addStyle // @run-at document-start // @version 1.0 // @author SuchtiOnTour // @license MIT // @description Adds a Download Button for Videos/Mp3's // ==/UserScript== (function() { const API = "https://yt1s.com/en/youtube-to-mp3?q="; const BUTTON_ID = "dwnldBtn"; const TARGET_BUTTON = "#analytics-button"; const buttonStyle = ` #${BUTTON_ID} { background-color: #0F0F0F; color: #FFFFFF; border: 1px solid #3F3F3F; border-color: rgba(255,255,255,0.2); margin: 0px 4px; border-radius: 18px; width: 94.56px; height: 36px; line-height: 37px; text-align: center; font-style: normal; font-size: 14px; font-family: Roboto, Noto, sans-serif; font-weight: 500; text-decoration: none; } #${BUTTON_ID}:hover { background-color: #3F3F3F; color: #ffffff; border-color: #3F3F3F; } `; GM_addStyle(buttonStyle); function waitForElement(selector) { return new Promise(resolve => { if (document.querySelector(selector)) { return resolve(document.querySelector(selector)); } const observer = new MutationObserver(mutations => { if (document.querySelector(selector)) { resolve(document.querySelector(selector)); observer.disconnect(); } }); observer.observe(document.body, { childList: true, subtree: true }); }); } function addButton() { waitForElement(TARGET_BUTTON).then((btn) => { btn.innerHTML += `<a href="${API + encodeURIComponent(window.location.href)}" target="_blank" id="${BUTTON_ID}">Download</a>`; }); } function updateButton() { waitForElement(`#${BUTTON_ID}`).then((btn) => { btn.href = API + encodeURIComponent(window.location.href); }); } window.onload = addButton; window.addEventListener("yt-navigate-start", updateButton, true); })();