Last active
February 8, 2018 20:52
-
-
Save rudolfbyker/59b889157a70d6355e3134fbfbef38af to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Go to https://www.youtube.com/playlist?list=WL&disable_polymer=true | |
// Open the javascript console (CTRL+SHIFT+K in Firefox) | |
// Run the following code: | |
function loadMore() { | |
// Click the "Load More" button | |
var el = document.getElementsByClassName('browse-items-load-more-button'); | |
if (el.length) { | |
el[0].click(); | |
return true; | |
} | |
return false; | |
} | |
function sleep(ms) { | |
// From https://stackoverflow.com/a/39914235/836995 | |
return new Promise(resolve => setTimeout(resolve, ms)); | |
} | |
async function removeVideos() { | |
while(true){ | |
var el = document.getElementsByClassName('pl-video-edit-remove'); // find the x | |
if (el.length) { | |
el[0].click(); // click the x to remove the video | |
await sleep(1000); // sleep, so as not to overload the connection | |
} else { | |
if (!loadMore()) { // try to load more videos | |
return; // stop if there is no load more button | |
} | |
} | |
} | |
} | |
removeVideos(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment