Created
November 10, 2023 11:54
-
-
Save alqahtani/576277aee008f1049c17255cba335870 to your computer and use it in GitHub Desktop.
Remove Liked videos on youtube
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
| function sleep(ms) { | |
| return new Promise(resolve => setTimeout(resolve, ms)); | |
| } | |
| async function deleteNextVideo(id){ | |
| let menu = document.querySelectorAll("yt-icon-button[class='dropdown-trigger style-scope ytd-menu-renderer']")[id]; | |
| menu.click(); | |
| // Tiny delay to give the menu time to render | |
| await sleep(300); | |
| let menuItems = document.querySelector("tp-yt-paper-listbox[class='style-scope ytd-menu-popup-renderer']").children; | |
| // In case of unavailable videos, there's only the remove button | |
| let button = menuItems[5] ?? menuItems[0]; | |
| button.click(); | |
| } | |
| // Just check how much you have in the playlist | |
| let videos_count = 300; | |
| for (i=1; i <= videos_count ; i++){ | |
| deleteNextVideo(if); | |
| // 1500ms would get me 429 response after a couple of requests | |
| await sleep(1750); | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I used the code from this comment which works well for deleting videos on Watch Later Playlist