Created
June 1, 2026 21:21
-
-
Save charlesponti/29d116a655bad68ffa3ed44533f84978 to your computer and use it in GitHub Desktop.
youtube.clear-likes
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
| // Run on `https://www.youtube.com/playlist?list=LL` | |
| (() => { | |
| // Find all playlist video elements currently rendered on the page | |
| const videos = document.querySelectorAll('ytd-playlist-video-renderer, ytd-playlist-panel-video-renderer'); | |
| let index = 0; | |
| console.log(`Found ${videos.length} loaded videos. Starting the unlike process...`); | |
| function processNextVideo() { | |
| if (index >= videos.length) { | |
| console.log('Finished processing all currently loaded videos!'); | |
| return; | |
| } | |
| const currentVideo = videos[index]; | |
| // Find and click the three-dot action menu button for the current video | |
| const menuButton = currentVideo.querySelector('button[aria-label="Action menu"]'); | |
| if (menuButton) { | |
| menuButton.click(); | |
| // Wait a moment for the popup menu to render in the DOM | |
| setTimeout(() => { | |
| // Look for the menu item containing the removal text | |
| const menuItems = document.querySelectorAll('ytd-menu-service-item-renderer'); | |
| let removeButton = null; | |
| for (const item of menuItems) { | |
| if (item.innerText.includes('Remove from Liked videos')) { | |
| removeButton = item; | |
| break; | |
| } | |
| } | |
| if (removeButton) { | |
| removeButton.click(); | |
| console.log(`Unliked video #${index + 1}`); | |
| } else { | |
| console.log(`Could not find remove button for video #${index + 1} (it might be a deleted video entry)`); | |
| // Close the menu if open so it doesn't obstruct the view | |
| document.body.click(); | |
| } | |
| index++; | |
| // Introduce a 500ms delay between actions to protect against rate limits/UI lag | |
| setTimeout(processNextVideo, 500); | |
| }, 200); | |
| } else { | |
| index++; | |
| processNextVideo(); | |
| } | |
| } | |
| // Start the execution loop | |
| processNextVideo(); | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment