Last active
February 17, 2023 03:28
-
-
Save Kamensky124/fda3910a596a55a79419de83f464c34e to your computer and use it in GitHub Desktop.
Youtube Delete liked videos (i=100)
This file contains hidden or 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
//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