Skip to content

Instantly share code, notes, and snippets.

@andreyvolokitin
Created February 23, 2020 15:44
Show Gist options
  • Save andreyvolokitin/a2ea6e8f2b6197bfdcdbba6a0340225a to your computer and use it in GitHub Desktop.
Save andreyvolokitin/a2ea6e8f2b6197bfdcdbba6a0340225a 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);
});
@dayadam
Copy link

dayadam commented Nov 20, 2022

updated css selector for live chat

'[aria-label="Card showing an activity from YouTube"] > div > div > div > div > button'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment