A powerful, automated system to intercept secure HLS video streams (.m3u8), extract single-use tokens, and perform multi-threaded downloading and merging of .ts segments into a single video file.
- Secure Interception: Captures authenticated stream links directly from the browser's network traffic without "burning" one-time tokens.
- Smart Pattern Detection: Automatically handles various stream formats (
stream_0,720p,480p, etc.). - Multi-Threaded Downloader: Downloads segments in parallel for maximum speed using
cpd.py. - Auto-Merge: Verifies all segments and merges them into a final playable
.tsvideo file. - Interactive UI: Chrome Extension popup allows you to rename the file before downloading.
- Chrome Extension: Injects a script to spy on network requests. When a video stream is detected, it shows a popup.
- Python Bridge (
bridge.py): A local Flask server that listens for commands from the extension. - Downloader Core (
cpd.py): The engine that handles downloading, retrying, and merging chunks.
- Python 3.8+ installed on your system.
- Google Chrome (or any Chromium-based browser like Edge/Brave).
Open your terminal/command prompt in the project folder and run:
pip install requests flask flask-cors- Create a folder named
StreamAutoExtension. - Place the
manifest.json,content.js, andinjected.jsfiles inside it. - Open Chrome and navigate to
chrome://extensions/. - Toggle Developer mode (top right).
- Click Load unpacked and select the
StreamAutoExtensionfolder.
Ensure your project folder looks like this:
Project_Folder/
│
├── cpd.py # Core Downloader Logic
├── bridge.py # Local Server (The Bridge)
├── README.md # This file
│
└── StreamAutoExtension/ # Extension Folder
├── manifest.json
├── content.js
└── injected.js
Before opening your browser, start the local listener. This must be running to receive the download command.
python bridge.pyYou should see: [*] Bridge Server Running on http://localhost:5555
- Open your browser and log in to the website.
- Navigate to the course or video page.
- Click the video to start playing.
- A Dark Popup will automatically appear on the screen once the stream is detected.
- Edit Filename: You can rename the file (e.g.,
Biology_Lec_01.ts). - Click Download.
- Check your terminal window running
bridge.py. You will see the download progress bars.
Once finished, the merged video file will appear in the same folder as cpd.py.
| Issue | Solution |
|---|---|
| Popup doesn't appear | Refresh the page. Ensure the extension is enabled and you clicked the video to play. |
| "Error: bridge.py is not running" | Check your terminal. You must run python bridge.py before clicking download. |
| Permission Denied / OSError | Ensure your filename doesn't contain special characters like ?, :, or ` |
| Download Stuck at 0% | The token might have expired. Refresh the page and try again immediately. |
This tool is for educational purposes and personal archiving only. Please respect the copyright and terms of service of the content providers.