Trying to decide the best way to delete all my YouTube comments. Not sure if I want to mess with api since it wants a credit card or if I should use beautifulsoup to “manually” delete the comments on the activity page…

Reply to this note

Please Login to reply.

Discussion

Not sayin you should but am saying you could:

If you scrub all ur personals you can prob sell to a bot kid and they will have that thing purged and obfuscated by bullshit in no time.

BTW: No I don't, no i wont and no you shouldnt lol

Haha i would want to learn how to do it myself 😂🙌 at the moment I’m manually tapping the x and waiting for the “comment deleted” notification to pop up while listening to a podcast 🤣🥲

Its an honest bit of self serving labor. No counterparty risk. Carry on ser

Load up https://myactivity.google.com/page?utm_source=my-activity&hl=en&page=youtube_comments and then run this in your browser console:

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);

Might need some tweaks since Google changes stuff all the time. Disclaimer: This isn’t my code.