Skip to content

MatiFalsetta/Clean-Twitter-X

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ Twitter/X Unfollow Bot

An automatic script to unfollow everyone on Twitter/X quickly and efficiently.

Twitter JavaScript License

✨ Features

  • βœ… Fully automatic - Automatically confirms each unfollow
  • ⚑ Ultra fast - Up to 300 unfollows per minute
  • πŸ›‘οΈ Safe - Smart pauses to avoid rate limiting
  • πŸ“Š Real-time counter - See your progress as it works
  • πŸ”„ Auto-continues - Searches for more accounts if needed
  • 🚫 Easy to stop - Just refresh the page

🎯 How to Use

Step 1: Go to your Following page

  1. Log in to Twitter/X
  2. Go to your profile
  3. Click on "Following"

Step 2: Open browser console

  • Chrome/Edge: F12 or Ctrl+Shift+I
  • Firefox: F12 or Ctrl+Shift+K
  • Safari: Cmd+Opt+I

Step 3: Run the script

  1. Go to "Console" tab
  2. Copy and paste the complete script
  3. Press Enter
  4. Sit back and relax! 🍿

πŸ’Ύ The Script

// Script to automatically unfollow on Twitter/X
var count = 0;

function nextUnfollow() {
    return document.querySelector('[data-testid*="unfollow"]');
}

function nextUnfollowConfirm() {
    return document.querySelector('[data-testid="confirmationSheetConfirm"]');
}

function wait(ms) {
    return new Promise(resolve => setTimeout(resolve, ms));
}

async function removeAll() {
    let unfollowButton = nextUnfollow();
    
    while (unfollowButton) {
        try {
            // Click on the unfollow button
            unfollowButton.focus();
            unfollowButton.click();
            console.log(`Clicking unfollow button for account ${count + 1}...`);
            
            // Wait for the confirmation dialog to appear
            await wait(200);
            
            // Find and click the confirmation button
            let confirmButton = nextUnfollowConfirm();
            let attempts = 0;
            
            // Try to find the confirmation button up to 5 times
            while (!confirmButton && attempts < 5) {
                await wait(100);
                confirmButton = nextUnfollowConfirm();
                attempts++;
            }
            
            if (confirmButton) {
                confirmButton.focus();
                confirmButton.click();
                count++;
                console.log(`βœ… Unfollowed account ${count}`);
            } else {
                console.log("❌ Could not find confirmation button, skipping...");
            }
            
            // Longer pause every 100 unfollows to avoid rate limiting
            if (count % 100 === 0) {
                console.log(`⏸️ Taking a longer break after ${count} unfollows (10 seconds)...`);
                await wait(10000);
            } else {
                await wait(100); // Pausa de 2 segundos entre cada unfollow
            }
            
        } catch (error) {
            console.error("Error during unfollow process:", error);
            await wait(3000);
        }
        
        // Find the next unfollow button
        unfollowButton = nextUnfollow();
    }
    
    // Check if there are more accounts to unfollow
    check();
}

function check() {
    const remainingUnfollowButtons = document.querySelector('[data-testid*="unfollow"]');
    
    if (!remainingUnfollowButtons) {
        console.log(`πŸŽ‰ Finished! Total unfollowed accounts: ${count}`);
        console.log("No more accounts to unfollow found.");
    } else {
        console.log("πŸ” Found more accounts to unfollow, continuing...");
        // Esperar un poco antes de continuar
        setTimeout(() => {
            removeAll();
        }, 500);
    }
}

// Start the process
console.log("πŸš€ Starting Twitter/X unfollow automation...");
console.log("⚠️ Make sure you're on your 'Following' page");
console.log("⏹️ To stop the script at any time, refresh the page");

removeAll();

πŸ”§ Advanced Configuration

If Twitter rate limits you (very rare):

Change these values in the script:

// Wait for the confirmation dialog to appear (line ~26)
await wait(1000); // Instead of 200

// Longer pause every 100 unfollows to avoid rate limiting (line ~49)
if (count % 10 === 0) { // Instead of 100

For maximum speed:

// Wait for the confirmation dialog to appear (line ~26)
await wait(100); // Instead of 200

// Longer pause every 100 unfollows to avoid rate limiting (line ~49)
if (count % 1000 === 0) { // Instead of 100

⚠️ Important Warnings

  • πŸ” Make sure you're on the right page (Following)
  • πŸ–±οΈ Don't click anything while the script is running
  • πŸ“± Keep the tab active (don't minimize it)
  • ⏹️ To stop: simply refresh the page
  • πŸ”„ If it stops: refresh and run again

πŸ€” Frequently Asked Questions

Is it safe?

Yes, it only automates clicks you would do manually. It doesn't modify Twitter's code.

Can Twitter ban me?

Very unlikely. The script uses pauses to mimic human behavior.

Does it work on mobile?

No, only on desktop browsers with developer console.

What if it stops?

Simply refresh the page and run the script again. It will continue from where it left off.

Can I keep using Twitter while it runs?

It's better to let it finish first to avoid interference.

πŸ†˜ Troubleshooting

Problem Solution
"Can't find buttons" Make sure you're on the Following page
"Stops by itself" Refresh the page and run again
"Too slow" Use aggressive configuration
"Console error" Refresh and try again

πŸ“ˆ Versions

v2.0 (Current)

  • ⚑ Ultra fast (300ms between unfollows)
  • πŸ”„ Better button detection
  • πŸ“Š Improved counter

v1.0

  • βœ… Basic working version
  • 🐌 Slower (2s between unfollows)

🀝 Contributing

Found a bug or want to improve the script?

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Open a Pull Request

πŸ“œ License

This project is licensed under the MIT License - see the LICENSE file for details.

⭐ Like it?

If this script saved you time, give the repo a star! ⭐


Disclaimer: This script is for educational purposes only. Use at your own risk. I am not responsible for any issues with your Twitter/X account.

About

Twitter/X clean automation scripts

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published