Skip to main content
Snippets

YouTube

Paste the entire script to the Chrome DevTool (F12) Console

deleteVideoFromWatchLater

  1. move to /playlist?list=WL
  2. Paste the code to the console
function deleteVideoFromWatchLater() {
    video = document.getElementsByTagName('ytd-playlist-video-renderer')[0];
    video.querySelector('#primary button[aria-label="Action menu"]').click();
    var things = document.evaluate(
        '//span[contains(text(),"Remove from")]',
        document,
        null,
        XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,
        null
    );
    for (var i = 0; i < things.snapshotLength; i++) {
        things.snapshotItem(i).click();
    }
}

async function deleteWatchLater() {
  // Fiddle with these if you'd like
  let batchSize = 200; // Number to delete at once before waiting
  let waitBetweenBatchesInMilliseconds = 1000 * 60 * 5; // 5 minutes
  let waitBetweenDeletionsInMilliseconds = 1000; // Half a second

  let totalWaitTime = ((5000 / batchSize) * (waitBetweenBatchesInMilliseconds / 1000 / 60)) + (5000 * (waitBetweenDeletionsInMilliseconds / 1000 / 60))
  console.log(`Deletion will take around ${totalWaitTime.toFixed(0)} minutes to run if the playlist is full.`);

  let count = 0;
  while (true) {
    await new Promise(resolve => setTimeout(resolve, waitBetweenDeletionsInMilliseconds));
    deleteVideoFromWatchLater();
    count++;

    if (count % batchSize === 0 && count !== 0) {
      console.log('Waiting for 5 minutes...');
      await new Promise(resolve => setTimeout(waitBetweenBatchesInMilliseconds));
    }
  }
}

deleteWatchLater();

About 2 minJavaScriptSnippetsjsjavascriptsnippets
Tips

One-liner


Number


Performance

console.time()

// Our test function runs a big for-loop
function test() {
    let number = 0;
    for (let i=0; i<999999; i++) 
      number += 5;
}


console.time("Test function");     // Start measuring time
test();                            // Call our test function
console.timeEnd("Test function");  // stop measuring time

/*
 default: 1.205810546875ms
 (value may vary depnding on browser, etc.)
 */

About 2 minNode.jsTipsjsnodenodejstipssnippets
Snippets

A Guided tour in your app with React Joyride


Less than 1 minuteReact.jsSnippetsjsnodenodejsreactreactjsreactnativefacebookmetasnippets
Snippets


Less than 1 minuteVue.jsSnippetsjsnodenodejsvuevuejssnippets
Snippets

AaBbcC=D \begin{CD} A @>a>> B \\ @VbVV @AAcA \\ C @= D \end{CD}


Less than 1 minuteLaTeXSnippetstexlatexkatexsnippets
Snippets

Maven



Less than 1 minuteMavenSnippetsmavenapache-mavensnippetsjdkjdk8jdk11mvnideaintellij-ideaintellijideeclipse
Youtube


Less than 1 minuteMavenYoutubemavenapache-mavensnippetsjdkjdk8jdk11mvnideaintellij-ideaintellijideeclipse
Snippets

💡How to

Each snippet is defined under a snippet name and has a prefix, body and description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are: $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.


About 2 minVSCodeSnippetsvscodevisual-studio-codeidesnippets
Snippets

  • https://freefrontend.com/css-hero-effects/

  • https://freefrontend.com/css-hover-effects/


About 4 minCSSSnippetscssscsssasssnippets