Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ip2soldier/9093afb2fb782f41c08478074add909a to your computer and use it in GitHub Desktop.
Save ip2soldier/9093afb2fb782f41c08478074add909a to your computer and use it in GitHub Desktop.
YouTube delete all comments and chat history
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