Automated Playwright + TypeScript script that logs into Facebook, lets you solve any checkpoint/captcha manually, and then walks your News Feed looking for posts whose author still shows a “Follow” button. Those authors/pages are automatically blocked so their content never shows up again.
⚠️ Disclaimer Automating Facebook almost certainly violates its Terms of Service. Run this tool at your own risk – preferably on a throw‑away or test account.
- Credential login via environment variables (.env) – email + password only.
- Manual checkpoint pause – the script waits until you press
ENTER
after solving any captcha/2‑FA. - Block loop
- Scans the visible feed for
Follow
buttons. - Opens the post’s action menu and chooses **Block ** (with confirm dialog handling when shown).
- Scrolls & repeats until it either:
- reaches
MAX_BLOCKS
, or - performs 10 consecutive scans without finding someone new to block.
- reaches
- Scans the visible feed for
- Self‑healing timeouts – if an element/action times out the page is reloaded and the scan resumes.
- Full‑screen UI – Chromium launches maximized (
--start-maximized
,viewport: null
) so the script can see as much of the feed as possible. - Verbose logging so you can watch progress in the terminal.
npm install
npm start
Variable | Description |
---|---|
FACEBOOK_EMAIL |
Facebook login email (required) |
FACEBOOK_PASSWORD |
Facebook login password (required) |
MAX_BLOCKS |
Stop after this many successful blocks (default 5) |
Feel free to hard‑code additional tweaks at the top of facebook_blocker.ts (timeouts, scan limits, etc.).
.
├── .env # your private credentials (never commit this!)
├── facebook_blocker.ts
├── package.json
└── tsconfig.json
- Lint / format however you like (ESLint, Prettier, etc.).
- Pull requests welcome. Please follow conventional‑commit messages and keep commits focused.
- Bug reports: open an issue with the full terminal log and, if possible, a screenshot / description of what was on‑screen when it failed.
- Optional headless mode
- Configurable scan depth (how far to scroll each iteration)
- Docker container for one‑command execution
- GitHub Action that runs on a schedule (again: risk‑y)
MIT © 2024 — Use at your own risk.