Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ PostPilot - Multi-Platform Social Media Automation Tool

Python Flask Playwright License

A powerful Flask-based social media automation tool that manages authentication cookies, generates dynamic post images, and schedules content across multiple platforms with human-like behavior to avoid detection.

✨ Features

πŸ” Smart Cookie Management

  • Secure cookie storage for each platform in separate .pkl files
  • Automatic cookie validation and refresh
  • Platform-specific authentication handling

🎨 Dynamic Image Generation

  • PIL-based image generation with custom templates
  • Dynamic text injection with website metrics
  • Professional post templates with branding

πŸ€– Human-like Automation

  • Randomized delays between actions
  • Real browser headers and user agents
  • WebDriver detection avoidance
  • Natural behavior simulation

πŸ“± Multi-Platform Support

  • LinkedIn - Professional networking posts
  • Facebook - Social media engagement
  • Twitter - Microblogging and updates
  • Instagram - Visual content sharing

⏰ Advanced Scheduling

  • Time-based post scheduling
  • Missed schedule recovery on restart
  • Multiple daily schedules support
  • Automatic Google Sheets integration

🎯 Template System

  • Multiple customizable post templates
  • Dynamic content insertion
  • Preview functionality
  • Brand-consistent styling

πŸ› οΈ Installation

Prerequisites

  • Python 3.8 or higher
  • Google Chrome/Chromium browser

Quick Start

  1. Clone the repository
git clone https://github.com/AliMurtazaAMJ/PostPilot.git
cd PostPilot
  1. Install dependencies
pip install -r requirements.txt
  1. Install Playwright browsers
playwright install chromium
  1. Create required directories
mkdir -p cookies posts/images templates
  1. Run the application
python main.py
  1. Open your browser
http://localhost:5000

πŸ“‹ Requirements

flask==2.3.3
html2image==2.0.4.3
playwright==1.40.0
requests==2.31.0
psutil==5.9.6
Pillow>=8.0.0

πŸš€ Usage

1. Account Setup

  1. Navigate to the web interface at http://localhost:5000
  2. Click "Accounts" in the top-right corner
  3. View all supported platforms with their login status
  4. Click "Login" for any platform to authenticate
  5. Complete the manual login process in the opened browser
  6. Cookies are automatically saved for future use

2. Post Configuration

  1. Select Template: Choose from available post templates
  2. Choose Platforms: Select target social media platforms
  3. Configure Data Source: Connect your Google Sheets data source

3. Scheduling Posts

  1. Click "Post Scheduler" to manage schedules
  2. Create new schedules with specific times
  3. System automatically posts at scheduled times using saved cookies
  4. Missed schedules are recovered on application restart

πŸ“ Project Structure

PostPilot/
β”œβ”€β”€ πŸ“„ main.py              # Main Flask application
β”œβ”€β”€ 🌐 index.html           # Web interface
β”œβ”€β”€ πŸ“‹ requirements.txt     # Python dependencies
β”œβ”€β”€ πŸ–ΌοΈ template.png         # Base image template
β”œβ”€β”€ πŸͺ cookies/             # Cookie storage
β”‚   β”œβ”€β”€ linkedin.pkl        # LinkedIn authentication
β”‚   β”œβ”€β”€ facebook.pkl        # Facebook authentication
β”‚   β”œβ”€β”€ twitter.pkl         # Twitter authentication
β”‚   └── instagram.pkl       # Instagram authentication
β”œβ”€β”€ πŸ“ posts/               # Generated content
β”‚   β”œβ”€β”€ πŸ–ΌοΈ images/          # Generated post images
β”‚   β”œβ”€β”€ βš™οΈ config.json      # Application configuration
β”‚   β”œβ”€β”€ πŸ“Š history.json     # Post history tracking
β”‚   β”œβ”€β”€ ⏰ schedules.json   # Scheduled posts
β”‚   └── πŸ• last_run.json    # Last execution tracking
└── πŸ“‹ templates/           # Post templates (future expansion)

πŸ”§ Configuration

Google Sheets Integration

Update the SHEET_URL in main.py with your Google Apps Script URL:

SHEET_URL = 'https://script.google.com/macros/s/YOUR_SCRIPT_ID/exec'

Template Customization

Modify template.png or add new templates in the templates/ directory. The system supports:

  • Dynamic text injection
  • Website metrics display (DA, DR, Traffic)
  • Brand-consistent styling

πŸ§ͺ Testing

Cookie Validation

Test your saved cookies for any platform:

# Test specific platform cookies
curl http://localhost:5000/test-login/linkedin
curl http://localhost:5000/test-login/facebook

Browser Testing

Verify browser automation:

curl http://localhost:5000/test-browser

πŸ”’ Security Features

  • Anti-Detection: Advanced techniques to avoid bot detection
  • Secure Storage: Encrypted cookie storage with platform isolation
  • Rate Limiting: Human-like delays between actions
  • User Agent Rotation: Dynamic browser fingerprinting
  • Headless Prevention: Runs in visible browser mode for authenticity

🎯 API Endpoints

Endpoint Method Description
/ GET Main web interface
/accounts GET Get platform login status
/login/<platform> GET Initiate platform login
/test-login/<platform> GET Test platform cookies
/schedules GET/POST Manage post schedules
/schedules/<time> DELETE Remove schedule
/history GET Get posting history
/config POST Save configuration

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“ License

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

⚠️ Disclaimer

This tool is for educational and legitimate business purposes only. Users are responsible for:

  • Complying with platform Terms of Service
  • Respecting rate limits and usage policies
  • Ensuring content authenticity and quality
  • Following applicable laws and regulations

πŸ› Troubleshooting

Common Issues

Browser not opening:

# Reinstall Playwright browsers
playwright install chromium --force

Cookie authentication fails:

  • Clear existing cookies and re-login
  • Check platform-specific login requirements
  • Verify 2FA settings

Image generation errors:

  • Ensure template.png exists in root directory
  • Check PIL/Pillow installation
  • Verify font paths for your OS

πŸ“ž Support

🌟 Acknowledgments


⭐ Star this repository if you find it helpful!

About

Multi-Platform Social Media Automation Tool

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages