YouTube Activity Cleaner

A Chrome console script that automatically deletes your YouTube activity. Choose between cleaning Comments, Posts, Live Chat, or removing Liked Videos. This script runs directly in your browser's developer console and automates the cleanup process.

Important Warning

This script performs irreversible actions. Once you delete an activity item or remove a liked video, it cannot be recovered. The script runs automatically and will delete ALL items from your selected activity history. Use with caution.

(async () => {
    const DELAY = 1000;
    let count = 0;

    const sleep = ms => new Promise(r => setTimeout(r, ms));

    console.log('Starting deletion... No confirmation needed!');

    window.scrollTo(0, 0);
    await sleep(500);

    while (true) {
        const buttons = document.querySelectorAll('button[aria-label^="Delete activity item"]');

        if (buttons.length === 0) {
            window.scrollBy(0, 1000);
            await sleep(1000);

            const scrollPosition = window.scrollY + window.innerHeight;
            const pageHeight = document.documentElement.scrollHeight;

            if (scrollPosition >= pageHeight - 100) {
                console.log(`🏁 Reached bottom! Deleted ${count} items total.`);
                break;
            }
            continue;
        }

        for (const button of buttons) {
            button.click();
            count++;
            console.log(`Deleted ${count}`);
            await sleep(DELAY);
        }

        window.scrollBy(0, 300);
        await sleep(300);
    }
})();

How to Use This Script (Comments/Posts/Live Chat)

  1. Navigate to YouTube Activity: Go to YouTube History (you must be signed in).
  2. Select Activity Type: Under "Manage all history" in the left sidebar, click on "Comments", "Posts", or "Live Chat" depending on what you want to delete.
  3. Open Developer Console: Press F12 or Ctrl+Shift+I (Windows/Linux) / Cmd+Option+I (Mac) to open Chrome Developer Tools.
  4. Switch to Console Tab: Click on the "Console" tab in the Developer Tools panel.
  5. Paste and Run: Copy the script above (click "Copy Script" button), paste it into the console, and press Enter to execute.
  6. Monitor Progress: Watch the console for deletion counts and watch the browser as it automatically removes items.
  7. Stop the Script: To pause execution, press Ctrl+Shift+P in Chrome console. To stop completely, refresh the page.

Usage Notes (Comments/Posts/Live Chat)

  • Keep the YouTube tab active and visible while the script runs
  • The script works on Comments, Posts, and Live Chat pages
  • It automatically scrolls and loads more items as needed
  • It stops when it reaches the bottom of the page
  • If Google changes their HTML, you might need to update the selector
  • For thousands of items, this will take time (e.g., 1000 items at 1000ms each = ~16.7 minutes)

Configuration Tips (Comments/Posts/Live Chat)

You can modify this variable in the script:

  • DELAY - Time between each deletion (in milliseconds). Default is 1000ms (1 second). You can reduce this to 200ms for faster deletion, but be aware:
    • Too fast may trigger YouTube's rate limiting
    • May cause the page to become unresponsive
    • Default 1000ms is safer for stability

Note: Making the script run too fast may cause YouTube to temporarily block actions or require CAPTCHA verification. The current delay is set conservatively to avoid issues.