Skip to content

Instantly share code, notes, and snippets.

@Kamensky124
Last active February 17, 2023 03:28
Show Gist options
  • Save Kamensky124/fda3910a596a55a79419de83f464c34e to your computer and use it in GitHub Desktop.
Save Kamensky124/fda3910a596a55a79419de83f464c34e to your computer and use it in GitHub Desktop.
Youtube Delete liked videos (i=100)
//By Rojo Reyes @rurxs
// Open: https://www.youtube.com/playlist?list=LL
// Open developer tools (chrome)
// Place the JS snippet in console
function sleep(ms) {
return new Promise((resolve) => setTimeout(resolve, ms));
}
async function deleteLikedVideos() {
`use strict`;
var items = document.querySelectorAll(
`#primary ytd-playlist-video-renderer yt-icon-button.dropdown-trigger > button[aria-label]`
);
var out;
for (var i = 0; i < items.length; i++) {
items[i].click();
out = setTimeout(function () {
if (
document.querySelector(
`tp-yt-paper-listbox.style-scope.ytd-menu-popup-renderer`
).lastElementChild
) {
document
.querySelector(
`tp-yt-paper-listbox.style-scope.ytd-menu-popup-renderer`
)
.lastElementChild.click();
}
}, 100);
await sleep(500); // sleep cause browser can not handle the process
clearTimeout(out);
}
}
deleteLikedVideos();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment