T
SwapnoFlix Streaming Engine
API Documentation v3.0
Engine Active

High-Concurrency Movie Streaming Gateway

An enterprise-grade, zero-RAM chunked streaming proxy converting cloud-hosted files into permanent M3U8 adaptive HLS video streams for movie platforms.

⚡ FastAPI ASGI 🎬 HLS Adaptive (1080p -> 360p) 🚀 Zero-RAM Proxy 🔒 HMAC Anti-Hotlinking 📊 Prometheus Telemetry
⚡ Live API Tester Playground
Test live streaming & metadata endpoints
Click "Execute Test" above to query live gateway endpoints...

Core API Endpoints

Complete reference of operational gateway routes.

GET
/stream/{surl}/master.m3u8
Generates an HLS Master M3U8 Playlist containing adaptive bitrate streams (1080p, 720p, 480p, 360p).
GET http://localhost:5000/stream/1YSmvSVfANhdzR960XIeFfg/master.m3u8
GET
/stream/{surl}/{quality}.m3u8
Single resolution variant playlist (e.g. 1080.m3u8, 720.m3u8) with segment URLs rewritten to proxy.
GET http://localhost:5000/stream/1YSmvSVfANhdzR960XIeFfg/1080.m3u8
GET
/download/{surl}
Direct resumable file download endpoint supporting Range requests (HTTP 206 Partial Content).
GET http://localhost:5000/download/1YSmvSVfANhdzR960XIeFfg
GET
/api?url={share_link}
Fetches raw file metadata, file system ID, MD5 checksum, size, and thumbnails.
GET http://localhost:5000/api?url=https://link.domain/s/XXX&resolve=1
GET
/admin/stats
Real-time administrative JSON telemetry displaying active streams, cache hit rate, and cookie health scores.
GET http://localhost:5000/admin/stats
GET
/metrics
Prometheus scrapable metrics export endpoint for Grafana dashboards.
GET http://localhost:5000/metrics

Video Player Integration

Embed permanent HLS video streams into your movie platform player.

<script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script> <video id="moviePlayer" controls autoplay style="width:100%; max-width:800px;"></video> <script> const video = document.getElementById('moviePlayer'); const streamUrl = 'http://localhost:5000/stream/1YSmvSVfANhdzR960XIeFfg/master.m3u8'; if (Hls.isSupported()) { const hls = new Hls(); hls.loadSource(streamUrl); hls.attachMedia(video); } else if (video.canPlayType('application/vnd.apple.mpegurl')) { video.src = streamUrl; } </script>
<link href="https://vjs.zencdn.net/7.20.3/video-js.css" rel="stylesheet" /> <video id="my-video" class="video-js vjs-default-skin" controls preload="auto" width="800"> <source src="http://localhost:5000/stream/1YSmvSVfANhdzR960XIeFfg/master.m3u8" type="application/x-mpegURL"> </video>
<link rel="stylesheet" href="https://cdn.plyr.io/3.7.8/plyr.css" /> <video id="player" controls></video> <script src="https://cdn.plyr.io/3.7.8/plyr.js"></script> <script> const player = new Plyr('#player'); </script>
// Android ExoPlayer Kotlin Code val streamUrl = "http://localhost:5000/stream/1YSmvSVfANhdzR960XIeFfg/master.m3u8" val mediaItem = MediaItem.fromUri(Uri.parse(streamUrl)) player.setMediaItem(mediaItem) player.prepare() player.play()
# 1. Docker Compose VPS Deployment (Recommended) sudo apt update && sudo apt install -y docker.io docker-compose git git clone https://github.com/saahiyo/terabox-gateway.git cd terabox-gateway cp .env.example .env docker-compose up -d --build # 2. Telegram Bot Auto-Broadcasting (.env setup) TELEGRAM_BOT_TOKEN=123456789:ABCdefGhIJKlmNoPQRsTUVwxyZ TELEGRAM_CHAT_IDS=@MyMovieChannel1,@MyMovieChannel2,-100123456789 GATEWAY_PUBLIC_URL=https://yourdomain.com