您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Добавляет кнопку для непосредственного удаления видеороликов из плейлиста "Смотреть позже" на YouTube
当前为
// ==UserScript== // @name Youtube button to delete a video from a playlist // @name:en Youtube button to delete a video from a playlist // @namespace http://tampermonkey.net/ // @version 1.43 // @description:en Adds a button to directly remove videos from the "Watch Later" playlist on YouTube // @description Добавляет кнопку для непосредственного удаления видеороликов из плейлиста "Смотреть позже" на YouTube // @author You // @match https://www.youtube.com/playlist?list=WL // @grant none // @license MIT // ==/UserScript== (function() { 'use strict'; // Добавляем стили для кнопки и её состояния при наведении const style = document.createElement('style'); style.textContent = ` .remove-button { display: flex; align-items: center; border: none; background: transparent; color: #909090; cursor: pointer; margin-top: 5px; padding: 0; transition: color 0.3s; } .remove-button:hover { color: #ffffff; } .remove-button svg { width: 30px; height: 30px; fill: currentColor; } `; document.head.append(style); function addRemoveButton(video) { if (!video.querySelector('.remove-button')) { const button = document.createElement('button'); button.classList.add('remove-button'); // Создание значка корзины const trashIcon = document.createElement('div'); trashIcon.innerHTML = ` <svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24" viewBox="0 0 24 24" width="24" focusable="false"> <path d="M11 17H9V8h2v9zm4-9h-2v9h2V8zm4-4v1h-1v16H6V5H5V4h4V3h6v1h4zm-2 1H7v15h10V5z"></path> </svg>`; button.appendChild(trashIcon); button.addEventListener('click', async () => { const menuButton = video.querySelector('#button'); menuButton.click(); await new Promise(resolve => setTimeout(resolve, 100)); // Ждем, пока меню откроется const menuItems = document.querySelectorAll('ytd-menu-service-item-renderer'); let removed = false; menuItems.forEach(item => { const textElement = item.querySelector('yt-formatted-string'); if (textElement && textElement.textContent.includes('Удалить из плейлиста "Смотреть позже"')) { textElement.click(); removed = true; } }); if (!removed) { alert('Не удалось удалить видео. Пожалуйста, попробуйте снова.'); } }); video.querySelector('#meta').appendChild(button); } } function init() { const videoContainers = document.querySelectorAll('ytd-playlist-video-renderer'); videoContainers.forEach(addRemoveButton); const observer = new MutationObserver(mutations => { mutations.forEach(mutation => { mutation.addedNodes.forEach(node => { if (node.nodeType === 1 && node.matches('ytd-playlist-video-renderer')) { addRemoveButton(node); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); } window.addEventListener('yt-page-data-updated', init); // инициализация при изменении страницы на YouTube init(); // начальная инициализация })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址