-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnuke-watchlater.user.js
More file actions
75 lines (63 loc) · 2.47 KB
/
nuke-watchlater.user.js
File metadata and controls
75 lines (63 loc) · 2.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// ==UserScript==
// @name Nuke Watch Later
// @namespace https://youtube.com
// @version 1.1
// @description yeet ur watch later into the void (vroom vroom edition)
// @match https://www.youtube.com/playlist?list=WL
// @updateURL https://raw.githubusercontent.com/vegcom/scripty-scripts/main/nuke-watchlater.user.js
// @downloadURL https://raw.githubusercontent.com/vegcom/scripty-scripts/main/nuke-watchlater.user.js
// @grant none
// ==/UserScript==
(function() {
'use strict';
// ⚡ SPEED CONFIG - lower = faster, higher = safer
const MENU_DELAY = 150; // was 300
const REMOVE_DELAY = 300; // was 500
const delay = ms => new Promise(r => setTimeout(r, ms));
async function nukeWatchLater() {
let count = 0;
while (true) {
const video = document.querySelector('ytd-playlist-video-renderer');
if (!video) {
console.log(`✨ done, removed ${count} videos`);
alert(`watch later is deceased (${count} videos removed)`);
break;
}
const title = video.querySelector('#video-title')?.textContent?.trim() || 'unknown';
console.log(`🗑️ [${++count}] removing: ${title}`);
video.querySelector('#button[aria-label="Action menu"]')?.click();
await delay(MENU_DELAY);
const menuItems = document.querySelectorAll('ytd-menu-service-item-renderer');
const removeBtn = [...menuItems].find(el => el.textContent.includes('Remove from'));
removeBtn?.click();
await delay(REMOVE_DELAY);
}
}
function addNukeButton() {
if (document.querySelector('#nuke-wl-btn')) return;
const btn = document.createElement('button');
btn.id = 'nuke-wl-btn';
btn.textContent = '☢️ Nuke Watch Later';
btn.style.cssText = `
position: fixed;
top: 70px;
right: 20px;
z-index: 9999;
padding: 10px 16px;
background: #cc0000;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
font-weight: bold;
`;
btn.onclick = () => {
if (confirm('u sure? this will delete EVERYTHING in watch later')) {
nukeWatchLater();
}
};
document.body.appendChild(btn);
}
window.addEventListener('yt-navigate-finish', addNukeButton);
if (document.querySelector('ytd-playlist-video-renderer')) addNukeButton();
})();