A Python web application that provides a YouTube video streaming proxy with a built-in web player. Designed to work seamlessly in Google Colab environments while also supporting local development and deployment.
Project description
YouTube Colab Proxy
A feature-rich YouTube streaming proxy with a built-in web player. Watch videos, browse channels, explore playlists, and read comments — all through a clean, YouTube-inspired dark UI. Designed for Google Colab but works anywhere Python runs.
✨ Features
Search & Discovery
- YouTube search with paginated results
- Channel pages — Videos tab, Playlists tab, and in-channel search
- Channel banners & avatars proxied for privacy
- Playlist viewer with numbered tracks and channel links
- Recommended videos sidebar on the watch page
- Watch history persisted in the browser
Comments
- Top-level comments with sort (Top / Newest) and adjustable limit
- Lazy-loaded replies — click to expand, no upfront cost
- Pinned & hearted badges, relative timestamps, avatars
Infrastructure
- FastAPI + Uvicorn — async, fast, production-ready
- In-memory TTL caching — streams (20 min), comments (10 min), streamlink (5 min)
- Image proxy — thumbnails and avatars routed through the server (no CORS, no tracking)
- Cookie support — file, raw string, or browser import for age-restricted / private content
- Password protection via SHA256 gate
- Google Colab integration — auto-detects Colab, generates public proxy URL
📦 Installation
From PyPI
pip install youtube-colab-proxy
From Source
git clone https://github.com/DAN3002/Youtube-Colab-Proxy.git
cd Youtube-Colab-Proxy
pip install -e .
Requirement: A JavaScript runtime (
node,deno, orbun) is needed by yt-dlp for full YouTube extraction. Install one before running.
🚀 Quick Start
CLI
# Start the server
ycp --serve
# Custom host and port
ycp --serve --host 0.0.0.0 --port 8080
# With password protection
ycp --serve --password my_secret
# With cookies (age-restricted / private videos)
ycp --serve --cookies /path/to/cookies.txt
ycp --serve --cookies-str "SID=abc; HSID=xyz"
ycp --serve --cookies-from-browser chrome
Google Colab
Cell 1 — Install:
!pip install youtube-colab-proxy
!apt-get update -qq && apt-get install -y -qq nodejs
Cell 2 — Run:
import youtube_colab_proxy
url = youtube_colab_proxy.start()
# → Opens a clickable public URL in the output
With cookies:
url = youtube_colab_proxy.start(cookies_str="YOUR_COOKIE_STRING")
Note:
apt-get install nodejsprovides the JS runtime that yt-dlp needs. Without it, some video formats may be missing.
⚙️ Configuration
Edit youtube_colab_proxy/const.py:
PL_PAGE_SIZE = 8 # Items per page
ADMIN_PASSWORD_SHA256 = "..." # SHA256 hash (empty = no password)
YT_LANG = "en-US" # Accept-Language for yt-dlp
YT_GEO_BYPASS_COUNTRY = "US" # Geo-bypass country code
OUTBOUND_PROXY = "" # Optional HTTP/SOCKS proxy
Password Protection
import youtube_colab_proxy
print(youtube_colab_proxy.hash_pass("my_password"))
# → paste the hash into const.py as ADMIN_PASSWORD_SHA256
Then start with:
ycp --serve --password my_password
🛠️ Development
# Clone & setup
git clone https://github.com/DAN3002/Youtube-Colab-Proxy.git
cd Youtube-Colab-Proxy
python3 -m venv .venv && source .venv/bin/activate
pip install -e .
# Run (auto-creates venv if needed)
./run_ycp.sh
Tech Stack
| Layer | Technology |
|---|---|
| Backend | FastAPI + Uvicorn |
| Extraction | yt-dlp + yt-dlp-ejs |
| Live Streams | Streamlink |
| Frontend | Tailwind CSS (CDN) + Vanilla JS |
| Templating | Jinja2 |
| Video Playback | hls.js |
| Icons | Font Awesome 6 |
📄 License
🤝 Contributing
- Fork the repo
- Create a feature branch (
git checkout -b feature/my-feature) - Commit your changes (
git commit -m 'Add my feature') - Push (
git push origin feature/my-feature) - Open a Pull Request
⚠️ Disclaimer
This project is for educational and community purposes only. It is not intended to violate any company's policies or applicable laws. Users are responsible for ensuring their usage complies with YouTube's Terms of Service and local regulations.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file youtube_colab_proxy-2.0.0.tar.gz.
File metadata
- Download URL: youtube_colab_proxy-2.0.0.tar.gz
- Upload date:
- Size: 61.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
864fc2ddff11a6af643c7dc21edb62a7e0b8e3e0ce6e5399657c0ca2efb31030
|
|
| MD5 |
73507641c6f3c860f200f4c56585eb0a
|
|
| BLAKE2b-256 |
3543da3c7911caa23c7c88f789f8c4205186e6daecfcb0a022af89bf507a87dc
|
File details
Details for the file youtube_colab_proxy-2.0.0-py3-none-any.whl.
File metadata
- Download URL: youtube_colab_proxy-2.0.0-py3-none-any.whl
- Upload date:
- Size: 74.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ae020ef9c5f850a4cc04891750602480e1a3a2312d418d8ede8f15e579de7f15
|
|
| MD5 |
68b4ffc3de8bd39a4a54269c7f3370ce
|
|
| BLAKE2b-256 |
185b09cd89b210b0cb22ef5478858d8c7b15f042a841ce75694a682564544506
|