Skip to content

Instantly share code, notes, and snippets.

@usmanakram232
Forked from iosifnicolae2/Readme.md
Created January 17, 2022 09:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save usmanakram232/0febf1d0ca30e5f305ee2c6ff739d6ee to your computer and use it in GitHub Desktop.
Save usmanakram232/0febf1d0ca30e5f305ee2c6ff739d6ee to your computer and use it in GitHub Desktop.
Youtube is Boring

How To Make Youtube Less Boring

Paste the below code in your browser console (F12 > Console):

(()=>{
    markAllVideosAsNotBeingInteresting({
        iterations: 1
    });
})();

async function markAllVideosAsNotBeingInteresting({iterations}) {
    for(let i=0; i<iterations; i++) {
        await markCurrentVideosAsNotBeingInteresting();
        console.log(`Iteration ${i} completed. Waiting 300ms`);
        await sleep(300);
    }
   if(confirm("I'm done! Do you want to reload the page", "Yes")) {
    location.reload();
   }
}

async function markCurrentVideosAsNotBeingInteresting() {
    const videoMenuButtons = document.querySelectorAll("yt-icon.ytd-menu-renderer");

    for(let i=0; i<videoMenuButtons.length; i++) {
        if(!videoMenuButtons[i]) {
            continue
        }
        videoMenuButtons[i].scrollIntoView();
        await sleep(10);

        // Open the video menu
        videoMenuButtons[i].click();


        await sleep(50);

        // Click on "Not interested" button
        var notInterestedButton = document.querySelector("#items > ytd-menu-service-item-renderer:nth-child(5) > tp-yt-paper-item");
        if(!notInterestedButton) {
            continue
        }
        notInterestedButton.click();

        console.log("One video has been marked. Waiting 100ms");
        window.scrollBy(0, 95);
        await sleep(100);
    }
}

// Utils
function sleep(ms) {
    return new Promise(resolve => setTimeout(resolve, ms));
}

PS. I'm not responsible if your accound get banned (Up until now, I wasn't banned) .

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment