Full Changelog: https://github.com/SwarnenduG07/yt-snap/commits/v1
ytsnap
Fast, lightweight, and independent YouTube video downloader built from scratch
π Features
- β No yt-dlp dependency - Built completely from scratch
- β Fast downloads - Direct CDN access via YouTube's innertube API
- β Multiple formats - Support for various video qualities and formats
- β Progress tracking - Real-time download progress with speed indicators
- β CLI & Library - Use as command-line tool or Python library
- β
Lightweight - Only requires
requestslibrary - β Python 3.8+ - Wide compatibility
π¦ Installation
pip install ytsnapπ― Quick Start
Command Line
# Basic download
ytsnap "https://www.youtube.com/watch?v=VIDEO_ID"
# Custom output filename
ytsnap "https://www.youtube.com/watch?v=VIDEO_ID" my_video.mp4
# Download specific quality
ytsnap "https://www.youtube.com/watch?v=VIDEO_ID" video.mp4 --quality 720p
# Download by format itag
ytsnap "https://www.youtube.com/watch?v=VIDEO_ID" video.mp4 --itag 18Python Library
from youtube_downloader import YouTubeDownloader
# Initialize downloader
downloader = YouTubeDownloader("https://www.youtube.com/watch?v=VIDEO_ID")
# Get available formats
formats = downloader.get_formats()
for fmt in formats:
print(f"itag={fmt['itag']} quality={fmt['quality']} size={fmt['filesize']}")
# Download video (auto-selects best format with video+audio)
downloader.download("video.mp4")
# Download specific quality
downloader.download("video_720p.mp4", quality="720p")
# Download by itag
downloader.download("video.mp4", itag=18)π§ How It Works
ytsnap uses YouTube's official innertube API with Android client credentials to fetch direct CDN URLs. This approach:
- Bypasses complex signature decryption
- Provides stable and reliable downloads
- Works without reverse-engineering JavaScript
- Maintains compatibility with YouTube's infrastructure
π Format Information
The downloader shows available formats with:
- [V] - Video only
- [A] - Audio only
- [V+A] - Combined video and audio (preferred)
Common itags:
18- 360p MP4 (video + audio)22- 720p MP4 (video + audio)136- 720p MP4 (video only)140- Audio only (M4A)
π οΈ Development
# Clone repository
git clone https://github.com/yourusername/ytsnap.git
cd ytsnap
# Install in development mode
pip install -e .
# Run tests
python -m pytestπ Use Cases
- Download videos for offline viewing
- Archive educational content
- Create video processing pipelines
- Build custom download managers
- Integrate into automation scripts
β οΈ Legal Notice
This tool is for personal use only. Respect YouTube's Terms of Service and copyright laws. Only download content you have permission to download.
π€ Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
π License
MIT License - see LICENSE file for details
π Why ytsnap?
- Independent: No reliance on yt-dlp or other heavy dependencies
- Simple: Clean API, easy to use and integrate
- Reliable: Uses official YouTube API endpoints
- Maintained: Built with modern Python practices
- Fast: Direct downloads without unnecessary overhead
π Support
- π Report Issues
- π‘ Feature Requests
- π¦ PyPI Package
Made with β€οΈ for the Python community