Skip to content

fazi-gondal/FastAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Social Media Downloader API

A powerful FastAPI-based video downloader supporting Instagram, TikTok, YouTube, and 1000+ platforms with real-time progress tracking.

✨ Features

  • πŸŽ₯ Multi-Platform Support: Download from Instagram, TikTok, YouTube, Facebook, Twitter, and 1000+ sites
  • 🚫 TikTok Without Watermark: Get clean TikTok videos
  • 🎬 Instagram HD Quality: Download Instagram Reels/Posts in 720p+
  • πŸ“Š Real-Time Progress: Live download progress with Server-Sent Events
  • πŸ“± Mobile Ready: Complete React Native/Expo integration
  • 🌐 CORS Enabled: Works with web and mobile apps
  • πŸͺ Cookie Support: Bypass YouTube bot detection
  • πŸ—‘οΈ Auto Cleanup: Automatic file cleanup after download
  • 🎨 Modern UI: Beautiful glassmorphism design

πŸš€ Quick Start

Installation

# Clone the repository
git clone https://github.com/fazi-gondal/FastAPI.git
cd FastAPI

# Install dependencies
pip install -r requirements.txt

# Run the server
python main.py

Server will start at http://localhost:8000

Requirements

  • Python 3.11+
  • FastAPI
  • yt-dlp (2025.12.8)
  • uvicorn
  • httpx
  • aiofiles

πŸ“‹ Usage

Web Interface

  1. Open http://localhost:8000 in your browser
  2. Paste a video URL (Instagram, TikTok, YouTube, etc.)
  3. Click "Get Video Info"
  4. Click "Download Video"
  5. Video downloads to your Downloads folder

API Integration

See API.md for complete API documentation with examples.

Quick Example:

// Fetch metadata
const response = await fetch('http://localhost:8000/api/metadata', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ url: 'https://www.instagram.com/reel/xxxxx/' })
});

const metadata = await response.json();

React Native Integration

Complete mobile app integration guide: REACT_NATIVE_INTEGRATION.md

# Install dependencies
npx expo install expo-file-system expo-media-library axios

🌐 Deployment

Deploy to Render

  1. Push code to GitHub
  2. Connect to Render
  3. Deploy with:
    • Build Command: pip install -r requirements.txt
    • Start Command: uvicorn main:app --host 0.0.0.0 --port $PORT

See DEPLOYMENT.md for detailed instructions.

Deploy to Koyeb

See DEPLOYMENT.md for Koyeb deployment guide.

πŸ“š Documentation

🎯 Supported Platforms

  • βœ… YouTube (with cookie support)
  • βœ… Instagram (Posts, Reels, IGTV in HD)
  • βœ… TikTok (watermark-free)
  • βœ… Facebook
  • βœ… Twitter/X
  • βœ… Vimeo
  • βœ… Reddit
  • βœ… And 1000+ more via yt-dlp

πŸ› οΈ Platform-Specific Features

TikTok

  • Downloads without watermark
  • Best available quality
  • Multiple URL format support

Instagram

  • HD quality (720p+)
  • Supports Reels, Posts, IGTV
  • Thumbnail CORS proxy included

YouTube

  • Best video + audio quality merged
  • Cookie support for bot detection
  • MP4 output format

πŸ”§ Configuration

YouTube Cookie Setup (Optional)

For YouTube downloads, you may need to add cookies:

  1. Install browser extension: Get cookies.txt
  2. Export cookies from YouTube.com
  3. Save as cookies.txt in project folder
  4. Restart server

See YOUTUBE_COOKIES.md for detailed instructions.

πŸ“Š API Endpoints

Endpoint Method Description
/api/metadata POST Get video metadata
/api/download/start POST Start download (returns ID)
/api/download/progress/{id} GET Track progress (SSE)
/api/download/file/{id} GET Download completed file
/api/thumbnail GET Proxy thumbnail (CORS bypass)

πŸ—οΈ Project Structure

FastAPI/
β”œβ”€β”€ main.py                 # FastAPI application
β”œβ”€β”€ downloader.py          # yt-dlp download logic
β”œβ”€β”€ requirements.txt       # Python dependencies
β”œβ”€β”€ runtime.txt           # Python version
β”œβ”€β”€ Procfile              # Deployment config
β”œβ”€β”€ static/               # Frontend files
β”‚   β”œβ”€β”€ index.html
β”‚   β”œβ”€β”€ style.css
β”‚   └── script.js
β”œβ”€β”€ temp_downloads/       # Temporary download storage
└── docs/                 # Documentation
    β”œβ”€β”€ API.md
    β”œβ”€β”€ DEPLOYMENT.md
    └── ...

πŸ”’ Security

  • βœ… CORS enabled for all origins (customize in production)
  • βœ… Cookie files gitignored
  • βœ… Automatic file cleanup
  • βœ… No sensitive data stored
  • βœ… Ephemeral storage on cloud platforms

πŸ› Troubleshooting

YouTube Bot Detection

See YOUTUBE_COOKIES.md for cookie setup.

Instagram Thumbnails Not Loading

App includes automatic CORS proxy for Instagram thumbnails.

Videos Not Downloading

  • Check internet connection
  • Verify URL is public and accessible
  • Check yt-dlp is latest version: pip install --upgrade yt-dlp

Progress Bar Not Moving

Restart server to enable new progress tracking system.

πŸ“ Changelog

v2.0.0 (2026-01-02)

  • βœ… Real-time progress tracking with SSE
  • βœ… Three-step download process
  • βœ… YouTube cookie support
  • βœ… Automatic file cleanup
  • βœ… Modern lifespan event handlers
  • βœ… Improved error handling

v1.0.0 (2025-12-30)

  • βœ… Initial release
  • βœ… Multi-platform support
  • βœ… FastAPI backend
  • βœ… Modern glassmorphism UI
  • βœ… React Native integration

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

πŸ“„ License

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

πŸ‘€ Author

Fazi Gondal

πŸ™ Acknowledgments

  • yt-dlp - The amazing video downloader
  • FastAPI - Modern Python web framework
  • Expo - React Native development platform

⭐ Show Your Support

Give a ⭐️ if this project helped you!


Made with ❀️ by Fazi Gondal


About

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published