Skip to content

Instantly share code, notes, and snippets.

@Bakhtiyar-Garashov
Forked from iosifnicolae2/Readme.md
Created January 14, 2022 08:21
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 Bakhtiyar-Garashov/2d84220bd30ccd6d1ea4c8ee7f702cba to your computer and use it in GitHub Desktop.
Save Bakhtiyar-Garashov/2d84220bd30ccd6d1ea4c8ee7f702cba to your computer and use it in GitHub Desktop.
The Boring Youtube

How Make Youtube Less Boring

Mark as "Not interesting" all the videos.

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

await 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