Official API-style unified interface for multi-platform social media
โจ One interface, 5 platforms - that's it.
| Feature | Official APIs | UniAPI |
|---|---|---|
| Approval | Days/Weeks waiting | โ Instant - use immediately |
| Cost | $$$-$$$$$ monthly | โ Free & Open Source |
| Rate Limits | Strict (often 100-500/day) | โ Flexible |
| Feature Access | Limited by API | โ Full platform features |
| Multi-platform Code | 5 different APIs to learn | โ 1 unified interface |
| Setup Time | Hours of reading docs | โ 5 minutes |
| Breaking Changes | Frequent API deprecations | โ Stable interface |
- ๐ฏ Unified Interface: All platforms use the same API interface with minimal learning curve
- ๐ Official-style Design: API design mimics official APIs for simplicity and elegance
- ๐ Cookie Authentication: Browser cookie-based auth, no developer approval needed
- ๐ค Browser Automation: Uses Playwright to bypass API limitations
- ๐ฆ One-Click Deployment: Automated installation and startup scripts
- ๐ Multi-Platform Support: Twitter, Instagram, TikTok, Facebook, LinkedIn
| Platform | Bridge Server | SDK | Status |
|---|---|---|---|
| Port 5001 | twitter_sdk.py |
โ 100% | |
| Port 5002 | instagram_sdk.py |
โ 100% | |
| TikTok | Port 5003 | tiktok_sdk.py |
โ 100% |
| Port 5004 | facebook_sdk.py |
โ 100% | |
| Port 5005 | linkedin_sdk.py |
โ 100% |
Perfect for:
- ๐ Marketing Automation - Schedule and distribute content across all platforms
- ๐ Lead Generation - Auto-reply to comments containing specific keywords
- ๐ Social Listening - Monitor brand mentions and competitor activity
- ๐ค Chatbot Development - Build automated response systems
- ๐ฑ Content Distribution - Publish once, reach 5 platforms instantly
- ๐ฏ Agency Tools - Manage multiple client accounts from one interface
- ๐ฌ Research Projects - Collect social media data for analysis
- ๐ Educational Projects - Learn API design and browser automation
Real-world example:
# Monitor competitor posts and auto-respond to their followers
from instagram_sdk import InstagramAPI
api = InstagramAPI()
competitors = ["competitor1", "competitor2"]
for competitor in competitors:
posts = api.get_user_posts(competitor, limit=5)
for post in posts:
comments = api.get_post_comments(post.url)
for comment in comments:
# Engage with their audience
api.send_dm(comment.username, "Check out our product!")User Code
โ
Python SDK (instagram_sdk.py, tiktok_sdk.py, etc.)
โ
FastAPI Main Server (Port 8000)
โ
Bridge Servers (Ports 5001-5005)
โ
Playwright Browser Automation
โ
Social Media Platforms
git clone https://github.com/LiuLucian/uniapi.git
cd uniapicd backend
./install.shThis will automatically install:
- Python dependencies (FastAPI, Playwright, etc.)
- Playwright browser drivers
- Create necessary directories and configuration files
Edit backend/platforms_auth.json and add your platform cookies:
{
"instagram": {
"cookies": {
"sessionid": "your_instagram_sessionid"
}
},
"twitter": {
"cookies": {
"auth_token": "your_twitter_auth_token",
"ct0": "your_twitter_ct0"
}
}
// ... other platforms
}๐ก How to get cookies? See QUICK_START.md
cd backend
./start_uniapi.shAfter startup, automatic health checks will run. All โ marks indicate success.
from instagram_sdk import InstagramAPI
from tiktok_sdk import TikTokAPI
# Instagram example
insta = InstagramAPI()
user = insta.get_user("instagram")
print(f"Username: {user['username']}, Followers: {user['followers']}")
insta.like_post("https://www.instagram.com/p/ABC123/")
insta.send_dm("username", "Hello from UniAPI!")
# TikTok example
tiktok = TikTokAPI()
user = tiktok.get_user("@username")
tiktok.like_video("https://www.tiktok.com/@user/video/123")# View API documentation
open http://localhost:8000/api/docs
# Test with curl
curl http://localhost:8000/api/v1/instagram/users/instagram
# Like a post
curl -X POST http://localhost:8000/api/v1/instagram/posts/like \
-H "Content-Type: application/json" \
-d '{"post_url": "https://www.instagram.com/p/ABC123/"}'All platform SDKs follow the same interface design:
# User operations
api.get_user(username) # Get user info
api.follow_user(username) # Follow user
# Content operations
api.like_post(url) # Like/favorite
api.comment(url, text) # Comment
api.send_dm(username, message) # Send DM
# Batch operations
api.batch_like(urls, delay=5) # Batch like with auto-delay# Start all services
cd backend && ./start_uniapi.sh
# Stop all services
cd backend && ./stop_uniapi.sh
# View logs
tail -f backend/logs/fastapi.log
tail -f backend/logs/instagram_bridge.log
# Check service status
curl http://localhost:8000/health
curl http://localhost:5002/health # Instagram bridgeuniapi/
โโโ backend/
โ โโโ main.py # FastAPI main server
โ โโโ platforms/ # Platform bridge servers
โ โ โโโ twitter/
โ โ โโโ instagram/
โ โ โโโ tiktok/
โ โ โโโ facebook/
โ โ โโโ linkedin/
โ โโโ api/v1/ # FastAPI routes
โ โโโ core/ # Core configuration
โ โโโ start_uniapi.sh # Startup script
โ โโโ stop_uniapi.sh # Stop script
โ โโโ install.sh # Installation script
โโโ instagram_sdk.py # Instagram Python SDK
โโโ tiktok_sdk.py # TikTok Python SDK
โโโ facebook_sdk.py # Facebook Python SDK
โโโ linkedin_sdk.py # LinkedIn Python SDK
โโโ twitter_sdk.py # Twitter Python SDK
โโโ demo.py # Example code
โโโ QUICK_START.md # Quick start guide
โโโ README.md # This file
- FastAPI - High-performance Python web framework
- Playwright - Cross-browser automation tool
- Flask - Bridge server framework
- Pydantic - Data validation and type hints
- Httpx - Async HTTP client
A: Most social media platforms' official APIs:
- Require developer approval (complex review process)
- Have limited functionality (e.g., Instagram doesn't support DM API)
- Have strict rate limits
- Require payment (e.g., LinkedIn API)
UniAPI bypasses these limitations through browser automation, providing a more flexible solution.
A: Yes. Cookie validity is typically 30-90 days. After expiration, you need to log in again and update platforms_auth.json.
A: Automated operations may violate platform terms of service. Please use only for personal learning and testing, not for commercial purposes or large-scale operations.
A:
- Use
auto_delay=Trueto enable random delays - Don't operate too frequently (recommended 5-10 seconds between operations)
- Use dedicated accounts, not your main account
This project is open-sourced under the MIT License.
Contributions are welcome! See CONTRIBUTING.md for guidelines.
- ๐ Found a bug? Open an issue
- ๐ก Have an idea? Start a discussion
- ๐ง Want to contribute code? Check out good first issues
- Unified API for 5 platforms (Instagram, Twitter, TikTok, Facebook, LinkedIn)
- FastAPI main server with Swagger docs
- Browser automation with Playwright
- Cookie-based authentication
- One-click installation and startup
- Webhook support for real-time events
- Scheduled posting with cron-like syntax
- Rate limiting and retry mechanisms
- Enhanced error logging
- Analytics dashboard (engagement metrics across platforms)
- Multi-account management per platform
- AI-powered content generation (GPT integration)
- Advanced search and filtering
- Export data to CSV/JSON
- YouTube support
- Reddit integration
- WhatsApp Business API
- Discord webhook support
- Telegram bot API
Vote for features: Open a discussion to suggest or vote on features!
Help us grow! Star the repo if you find it useful ๐
This project is for educational purposes only. Users are responsible for any consequences of using this project. The author assumes no liability.