Skip to content

Instantly share code, notes, and snippets.

@OzanKurt
Last active April 17, 2022 05:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save OzanKurt/00fd377638e45aca42297d314fbabf28 to your computer and use it in GitHub Desktop.
Save OzanKurt/00fd377638e45aca42297d314fbabf28 to your computer and use it in GitHub Desktop.
Clean Up your YouTube
// Delete All Comments
// 1- https://myactivity.google.com/page?page=youtube_comments
// 2- Run the script
let delay = ms => new Promise(res => setTimeout(res, ms));
let btns = document.querySelectorAll('.VfPpkd-Bz112c-LgbsSe.yHy1rc.eT1oJ')
for (let i = 0; i < btns.length; i++) {
console.log(i)
let btn = btns[i]
await delay(500)
btn.click()
}
// Delete All Subscriptions
// 1- https://www.youtube.com/feed/channels
// 2- Run the script
let delay = ms => new Promise(res => setTimeout(res, ms));
let btns = document.querySelectorAll('[aria-label^="Unsubscribe from"]')
for (let i = 0; i < btns.length; i++) {
console.log(i)
let btn = btns[i]
await delay(500)
btn.click()
await delay(500)
document.querySelector('[aria-label="Unsubscribe"]').click()
}
// Delete All Likes
// 1- https://www.youtube.com/playlist?list=LL
// 2- Run the script
let delay = ms => new Promise(res => setTimeout(res, ms));
let btns = document.querySelectorAll('[aria-label="Action menu"]')
for (let i = 102; i < btns.length; i++) {
console.log(i)
let btn = btns[i]
await delay(500)
btn.click()
await delay(500)
let items = document.querySelectorAll('ytd-menu-service-item-renderer.style-scope.ytd-menu-popup-renderer')
let index = items.length - 1
items[index].click()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment