A little late to the party but this is my solution for 2022:
function scrollDown(i) {
try {
window.scrollTo(0, document.body.scrollHeight);
}
catch (e) {
scrollDown();
}
setTimeout(function(){
var i = i - '20'; // just to make sure we dont skip any comments while scrolling
deleteComment(i);
}, 1000);
}
function deleteComment(i) {
var xPathRes = document.evaluate ('/html/body/c-wiz/div/div[2]/c-wiz/c-wiz/div/div[2]/div[1]/div', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
if (xPathRes) {
if (xPathRes.textContent == "Looks like you've reached the end") {
console.log("All done! Keep the page open until everything is gone including the grey date bubbles");
return;
}
}
console.log('Deleting comment: ' + i);
var xPathRes = document.evaluate ('/html/body/c-wiz/div/div[2]/c-wiz/c-wiz/div/div[1]/c-wiz[' + i + ']/div/div/div[1]/div[2]/div/button', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
var i = i + 1;
if (i > 500) {
return;
}
try {
xPathRes.singleNodeValue.click();
}
catch (e) {
scrollDown(i);
return;
}
deleteComment(i);
}
deleteComment(1);
!! Be aware that this script is not perfect. I coded it in a hurry. If the script didn't delete everything, just paste it again and keep the page open untill everything is gone (it takes a while to process all the requests)
The script will halt after it sees the "looks like you've reached the end".
This script works on: https://myactivity.google.com/page?utm_source=my-activity&hl=en&page=youtube_comments