Skip to content

Mahdi-hasan-shuvo/facebook-automation-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

13 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation


Stars Forks Issues PRs Welcome Python License Open Source


πŸ€– 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



✨ Features

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

🧰 Tech Stack

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

πŸ“‚ Project Structure

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 a requirements.txt, .env example, or LICENSE file. Adding these is a great first contribution β€” see Contributing.


βš™οΈ Requirements

  • Python 3.7 or higher β†’ Download
  • Google Chrome (latest) β†’ Download
  • ChromeDriver matching your Chrome version β†’ Download

πŸ› οΈ Installation

Works on Windows, macOS, and Linux.

1. Clone the repo

git clone https://github.com/Mahdi-hasan-shuvo/Facebook-automation.git
cd Facebook-automation

2. Create a virtual environment (recommended)

# Create
python -m venv venv

# Activate β€” Windows:
venv\Scripts\activate

# Activate β€” macOS / Linux:
source venv/bin/activate

3. Install dependencies

pip install selenium beautifulsoup4 requests

4. Set up ChromeDriver

Option A β€” Automatic (easiest):

pip install webdriver-manager

Then 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:

  1. Check your Chrome version: chrome://settings/help
  2. Download the matching ChromeDriver from chromedriver.chromium.org
  3. Place it in your project folder or add it to your system PATH

βš™οΈ Configuration

Note: The repo does not yet include a .env file. Credentials are currently set directly inside each script.

Option A β€” Edit the script directly

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.

Option B β€” Use a .env file (recommended)

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-id

Install python-dotenv:

pip install python-dotenv

Load 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 .env to .gitignore β€” never commit your password to GitHub.


▢️ Usage

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

Example output

[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.


⚠️ Safety & Responsible Use

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.


🀝 Contributing

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

Good first contributions for beginners

  • Add a requirements.txt
  • Add a .gitignore file
  • Add a LICENSE file (MIT recommended)
  • Add code comments or docstrings to existing scripts
  • Write a new automation script
  • Add screenshots to this README

πŸ“„ License

⚠️ 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 LICENSE file in the root of the repo with the MIT License text.


Damo

image

πŸ“¬ Contact

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

⭐ Support This Project

If this project saved you time or helped you learn, a star costs nothing and means a lot:

Star this repo Β  Fork this repo Β  Watch for updates

πŸ“’ New automation scripts are added regularly β€” Watch the repo so you don't miss them!


Made with ❀️ | Please ⭐ Star & 🍴 Fork this project!

Built by Mahdi Hasan Shuvo Β· Open Source from Bangladesh πŸ‡§πŸ‡©

About

βœ… Python-powered open-source Facebook automation toolkit. Auto-delete posts, manage groups, invite users, decline spam & scrape data. Built with requests & BeautifulSoup. Beginner-friendly. πŸ€–

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages