A lightweight browser console automation tool that helps automate unfollowing accounts from your Twitter/X following list.
The script interacts directly with the page DOM, identifies "Following" buttons, triggers the Unfollow confirmation, and scrolls through the list to process multiple accounts automatically.
This project demonstrates practical concepts in browser automation, DOM manipulation, and asynchronous JavaScript control flow.
• Automated unfollow process • Human-like randomized delays • Scroll automation for loading additional accounts • ESC key emergency stop • Configurable automation parameters • Clean and modular JavaScript structure
The script performs the following sequence:
- Searches the page for "Following" buttons
- Clicks the Following button
- Waits briefly using randomized delays
- Clicks the Unfollow confirmation
- Scrolls periodically to load more accounts
- Repeats the process until the limit is reached
The implementation relies on DOM queries and text pattern matching to identify actionable elements.
Open Twitter/X and navigate to your following list:
https://twitter.com/yourusername/following
or
https://x.com/yourusername/following
Open Developer Tools
F12 → Console
Paste the contents of:
script.js
into the console.
Run the automation:
autoUnfollow()
Example configuration:
autoUnfollow({
maxActions: 500,
scrollEvery: 15,
delayFollowMin: 400,
delayFollowMax: 900,
delayUnfollowMin: 800,
delayUnfollowMax: 1400
})
| Parameter | Description |
|---|---|
| maxActions | Maximum unfollow attempts |
| scrollEvery | Scroll interval for loading more accounts |
| delayFollowMin | Minimum delay before confirmation |
| delayFollowMax | Maximum delay before confirmation |
| delayUnfollowMin | Minimum delay after unfollow |
| delayUnfollowMax | Maximum delay after unfollow |
Press:
ESC
at any time to immediately stop the automation.
twitter-auto-unfollow/
│
├── script.js
├── README.md
├── demo.gif
└── LICENSE
Automation may violate Twitter/X Terms of Service.
Use responsibly and avoid:
• Extremely high unfollow rates • Running automation continuously for extended periods • Triggering automated behavior detection
Recommended limit:
200 – 400 unfollows per session
This repository demonstrates:
• DOM manipulation • Regex-based text matching • Async/await automation loops • Human-like randomized timing • Browser console scripting
MIT License
You are free to use, modify, and distribute this project.
GitHub: MrMikeAde