https://github.com/ptraced/youtube-deleteallcommunityposts
Youtube Delete All CommunityPosts
https://github.com/ptraced/youtube-deleteallcommunityposts
automation bulk-delete javascript scripts youtube
Last synced: about 2 months ago
JSON representation
Youtube Delete All CommunityPosts
- Host: GitHub
- URL: https://github.com/ptraced/youtube-deleteallcommunityposts
- Owner: ptraced
- License: gpl-3.0
- Created: 2025-02-01T22:37:34.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2025-02-02T01:05:05.000Z (4 months ago)
- Last Synced: 2025-03-27T04:42:33.508Z (about 2 months ago)
- Topics: automation, bulk-delete, javascript, scripts, youtube
- Homepage:
- Size: 20.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Youtube Delete All Community Posts
Paste in chrome console in https://www.youtube.com/@YourUsernameHere/community
```js
async function deleteAllCommunityPosts() {
async function scrollUntilNoNewPosts() {
let lastHeight = document.body.scrollHeight;
const maxScrollAttempts = 10; // Adjust if needed
for (let i = 0; i < maxScrollAttempts; i++) {
window.scrollTo(0, document.body.scrollHeight);
await new Promise(r => setTimeout(r, 2000));
const newHeight = document.body.scrollHeight;
if (newHeight === lastHeight) break;
lastHeight = newHeight;
}
}async function clickElement(element) {
element.scrollIntoView({ behavior: 'smooth', block: 'center' });
await new Promise(r => setTimeout(r, 500));
element.click();
await new Promise(r => setTimeout(r, 1000));
}while (true) {
await scrollUntilNoNewPosts();
const menuButtons = document.querySelectorAll('yt-icon-button.ytd-menu-renderer');
if (menuButtons.length === 0) {
console.log('No more posts found. All done!');
break;
}
console.log(`Found ${menuButtons.length} posts to delete`);for (const menuButton of Array.from(menuButtons)) {
try {
await clickElement(menuButton);
const deleteButton = Array.from(document.querySelectorAll('tp-yt-paper-item')).find(
item => item.textContent.includes('Delete')
);
if (!deleteButton) throw new Error('Delete button not found');
await clickElement(deleteButton);const confirmButton = document.querySelector('#confirm-button');
if (!confirmButton) throw new Error('Confirm button not found');
await clickElement(confirmButton);
} catch (error) {
console.error('Error deleting post:', error);
}
}// Wait for a bit before continuing to ensure all deletions are processed
await new Promise(r => setTimeout(r, 3000));
}
}deleteAllCommunityPosts();
```