π€ Automate repetitive Facebook tasks with Python β bulk delete posts, manage groups, invite members, decline spam, and scrape data. Free & open-source.
π Get Started Β· β¨ Features Β· π Structure Β· π€ Contribute Β· π¬ Contact
All features below are based on files that actually exist in this repository.
| Script | What It Does |
|---|---|
ποΈ post_delete.py |
Bulk-delete posts from Facebook groups you manage |
πͺ group_leav.py |
Leave multiple Facebook groups automatically |
π¨ group_invite.py |
Auto-invite users to a Facebook group |
β spam_decline.py |
Auto-decline spam group join requests |
π¦ dump_fb.py |
Scrape and export Facebook data for analysis |
π mabsic group finder/ |
Search and discover Facebook groups by keyword |
| Tool | Purpose |
|---|---|
| Python 3.x | Core language β all scripts are 100% Python |
| Selenium | Controls Chrome to interact with Facebook like a human |
| BeautifulSoup4 | Parses HTML to find and extract page elements |
| Requests | Handles HTTP requests and responses |
| ChromeDriver | Bridges Selenium to your Chrome browser |
Facebook-automation/
β
βββ post_delete.py # Delete posts from groups you manage
βββ group_leav.py # Leave Facebook groups in bulk
βββ group_invite.py # Invite users to a group
βββ spam_decline.py # Decline spam join requests
βββ dump_fb.py # Scrape & export Facebook data
β
βββ mabsic group finder/ # Group search & discovery module
β βββ ...
β
βββ README.md
β οΈ Missing files: This repo does not yet have arequirements.txt,.envexample, orLICENSEfile. Adding these is a great first contribution β see Contributing.
- Python 3.7 or higher β Download
- Google Chrome (latest) β Download
- ChromeDriver matching your Chrome version β Download
Works on Windows, macOS, and Linux.
git clone https://github.com/Mahdi-hasan-shuvo/Facebook-automation.git
cd Facebook-automation# Create
python -m venv venv
# Activate β Windows:
venv\Scripts\activate
# Activate β macOS / Linux:
source venv/bin/activatepip install selenium beautifulsoup4 requestsOption A β Automatic (easiest):
pip install webdriver-managerThen in your script, replace the driver setup with:
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
driver = webdriver.Chrome(ChromeDriverManager().install())Option B β Manual:
- Check your Chrome version:
chrome://settings/help - Download the matching ChromeDriver from chromedriver.chromium.org
- Place it in your project folder or add it to your system PATH
Note: The repo does not yet include a
.envfile. Credentials are currently set directly inside each script.
Open any script and look for the config section near the top:
# ββ CONFIG ββββββββββββββββββββββββββββββββββ
EMAIL = "your_email@example.com"
PASSWORD = "your_password"
GROUP_URL = "https://www.facebook.com/groups/your-group-id"
# ββββββββββββββββββββββββββββββββββββββββββββReplace the values and save.
Create a .env file in the project root:
FB_EMAIL=your_email@example.com
FB_PASSWORD=your_password
TARGET_GROUP=https://www.facebook.com/groups/your-group-idInstall python-dotenv:
pip install python-dotenvLoad it in your script:
from dotenv import load_dotenv
import os
load_dotenv()
email = os.getenv("FB_EMAIL")
password = os.getenv("FB_PASSWORD")
group_url = os.getenv("TARGET_GROUP")π Always add
.envto.gitignoreβ never commit your password to GitHub.
Run any script individually from your terminal:
# Delete all posts in a group
python post_delete.py
# Leave groups in bulk
python group_leav.py
# Invite users to a group
python group_invite.py
# Decline spam join requests
python spam_decline.py
# Scrape and export Facebook data
python dump_fb.py
# Find Facebook groups by keyword
cd "mabsic group finder"
python main.py[INFO] Opening Chrome...
[INFO] Logging in to Facebook...
[INFO] Login successful β
[INFO] Found 52 posts in group.
[INFO] Deleted post 1 / 52 β
[INFO] Deleted post 2 / 52 β
...
[INFO] All done! 52 posts deleted.
π Scripts run continuously until the task is fully complete β perfect for large groups.
Please read before running any script.
- π Automating Facebook actions may violate Facebook's Terms of Service. Your account could be restricted or banned.
- π€ Only use these scripts on accounts you own.
- π Do not remove built-in delays β they reduce the risk of triggering bot detection.
- π Never commit your Facebook credentials to a public repository.
- βοΈ The author is not responsible for any account bans, data loss, or consequences of using this software.
Use it ethically, legally, and entirely at your own risk.
Contributions of all kinds are welcome β bug fixes, new scripts, documentation, tests.
# 1. Fork the repo (click Fork at the top of this page)
# 2. Clone your fork
git clone https://github.com/YOUR-USERNAME/Facebook-automation.git
cd Facebook-automation
# 3. Create a branch
git checkout -b feature/your-feature-name
# 4. Make your changes, then commit
git add .
git commit -m "feat: describe what you changed"
# 5. Push and open a Pull Request
git push origin feature/your-feature-name- Add a
requirements.txt - Add a
.gitignorefile - Add a
LICENSEfile (MIT recommended) - Add code comments or docstrings to existing scripts
- Write a new automation script
- Add screenshots to this README
β οΈ This repo does not currently include a LICENSE file.Without a license, all rights are legally reserved by the author by default. Adding an MIT License is strongly recommended β it's the most permissive and widely used open-source license.
Suggested action: Create a
LICENSEfile in the root of the repo with the MIT License text.
Have a question, found a bug, or want to collaborate on a paid project?
| π© Email | shuvobbhh@gmail.com |
| π¬ WhatsApp | +8801616397082 |
| π Portfolio / Website | mahdi-hasan-shuvo.github.io |
If this project saved you time or helped you learn, a star costs nothing and means a lot:
Made with β€οΈ | Please β Star & π΄ Fork this project!
Built by Mahdi Hasan Shuvo Β· Open Source from Bangladesh π§π©