Skip to content

Instantly share code, notes, and snippets.

@motsmanish
Last active February 5, 2026 09:26
Show Gist options
  • Select an option

  • Save motsmanish/07dc85b844833658a80f5eb3cfb77dce to your computer and use it in GitHub Desktop.

Select an option

Save motsmanish/07dc85b844833658a80f5eb3cfb77dce to your computer and use it in GitHub Desktop.
youtube-watch-later-cleaner-bookmarklet

YouTube Watch Later Cleaner (Bookmarklet)

YouTube does not provide a bulk option to clear the Watch Later playlist. This bookmarklet automates the process by opening the 3-dot menu on each video and clicking Remove from Watch Later, one item at a time.

This version is Trusted Types–safe and includes:

A floating debug panel

Live logs

Visual highlights of clicked elements So you can see exactly what’s happening and where it stops.

✅ Features

Works on: https://www.youtube.com/playlist?list=WL

No extensions required

TrustedHTML / CSP safe

Visual debugging (logs + highlights)

Safe delays to avoid rate limiting

⚠️ Limitations

Desktop browser only (Chrome / Firefox / Edge)

You must scroll to load all videos (YouTube lazy-loads)

YouTube UI changes may break selectors

No undo — removed videos are gone

🛠️ Installation

Create a new browser bookmark

Name it: YouTube Watch Later Cleaner

Paste the JavaScript code into the URL / Location field

Save

▶️ Usage

Open https://www.youtube.com/playlist?list=WL

Scroll down once to load videos

Click the bookmarklet

Do not interact with the page while it runs

Watch progress in the floating debug panel

If it stops, the last log message explains why.

🔍 How It Works

Finds the first video’s ⋮ (menu) button

Opens the menu

Locates Remove from Watch Later

Clicks it

Repeats until no items remain

Delays are intentional to avoid YouTube throttling.

🧪 Debugging

If removal stops:

Reload the page

Scroll to load more videos

Re-run the bookmarklet

Check the floating log panel for the last message

🧠 Why This Exists

YouTube removed bulk management for Watch Later. This is a transparent, inspectable workaround — no extensions, no permissions.

📜 Disclaimer

This script interacts with YouTube’s UI via simulated clicks. Use at your own risk. YouTube may change UI or behavior at any time.

youtube bookmarklet watch-later automation javascript debug trusted-types

javascript:(async function () {
const sleep = ms => new Promise(r => setTimeout(r, ms));
/* ---------- SAFE LOGGER UI ---------- */
const panel = document.createElement("div");
Object.assign(panel.style, {
position: "fixed",
top: "10px",
right: "10px",
zIndex: 999999,
width: "380px",
maxHeight: "70vh",
overflow: "auto",
background: "#111",
color: "#0f0",
font: "12px monospace",
padding: "10px",
borderRadius: "6px",
boxShadow: "0 0 10px #000"
});
const title = document.createElement("div");
title.textContent = "YouTube Watch Later Debug";
title.style.fontWeight = "bold";
panel.appendChild(title);
document.body.appendChild(panel);
function log(msg) {
const d = document.createElement("div");
d.textContent = msg;
panel.appendChild(d);
panel.scrollTop = panel.scrollHeight;
}
function highlight(el, color = "red") {
const old = el.style.outline;
el.style.outline = `3px solid ${color}`;
setTimeout(() => (el.style.outline = old), 800);
}
log("Started");
/* ---------- CORE ---------- */
async function removeOne() {
const menuButtons = document.querySelectorAll(
"ytd-playlist-video-renderer ytd-menu-renderer yt-icon-button"
);
log(`Menu buttons found: ${menuButtons.length}`);
if (!menuButtons.length) return false;
const btn = menuButtons[0];
highlight(btn, "orange");
btn.click();
log("Clicked 3-dot menu");
await sleep(800);
const menuItems = [...document.querySelectorAll("ytd-menu-service-item-renderer")];
log(`Menu items visible: ${menuItems.length}`);
const removeItem = menuItems.find(el =>
el.textContent.includes("Remove from Watch Later")
);
if (!removeItem) {
log("❌ Remove option NOT found");
return false;
}
highlight(removeItem, "lime");
removeItem.click();
log("✅ Removed one video");
await sleep(1000);
return true;
}
/* ---------- LOOP ---------- */
let count = 0;
while (await removeOne()) {
count++;
log(`Total removed: ${count}`);
}
log("DONE");
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment