Created
February 23, 2020 15:44
-
-
Save andreyvolokitin/a2ea6e8f2b6197bfdcdbba6a0340225a 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); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
updated css selector for live chat
'[aria-label="Card showing an activity from YouTube"] > div > div > div > div > button'