Forked from andreyvolokitin/delete-youtube-comments.js
Last active
January 27, 2023 19:46
-
-
Save ip2soldier/9093afb2fb782f41c08478074add909a to your computer and use it in GitHub Desktop.
YouTube delete all comments and chat history
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
let __timeout = 200; | |
/** | |
* Delete comments: https://www.youtube.com/feed/history/comment_history | |
*/ | |
document | |
.querySelectorAll( | |
'.ytd-comment-history-entry-renderer [aria-label="Action menu"]' | |
) | |
.forEach((el, i) => { | |
setTimeout(() => { | |
el.click(); | |
setTimeout(() => { | |
let options = document.querySelectorAll("#contentWrapper a"); | |
(options[1] || options[0]).click(); | |
setTimeout(() => { | |
document.querySelector("#confirm-button").click(); | |
}, 0); | |
}, 0); | |
}, __timeout * i); | |
}); | |
/** | |
* Delete chat history: https://www.youtube.com/feed/history/live_chat_history | |
document | |
.querySelectorAll('[aria-label="Remove live chat message"]') | |
.forEach((el, i) => { | |
setTimeout(() => { | |
el.click(); | |
setTimeout(() => { | |
document.querySelector("#confirm-button").click(); | |
}, 0); | |
}, __timeout * i); | |
}); | |
*/ | |
/* 2022 - working */ | |
var items = document.querySelectorAll('[aria-label~="Delete"]'); | |
for( var x = 0; x < items.length; x++ ){ | |
var evObj = document.createEvent('Events'); | |
evObj.initEvent('click', true, false); | |
items[x].dispatchEvent(evObj); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment