Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mal1k-me/bunny-cdn-drm-video-dl
A simple Python class to download Bunny CDN's "DRM" videos using yt-dlp
https://github.com/mal1k-me/bunny-cdn-drm-video-dl
bunnycdn hls iframe-embeds m3u8 video-downloader yt-dlp
Last synced: 3 days ago
JSON representation
A simple Python class to download Bunny CDN's "DRM" videos using yt-dlp
- Host: GitHub
- URL: https://github.com/mal1k-me/bunny-cdn-drm-video-dl
- Owner: mal1k-me
- Created: 2023-01-28T23:33:55.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2025-01-18T14:06:54.000Z (21 days ago)
- Last Synced: 2025-01-27T03:29:31.510Z (12 days ago)
- Topics: bunnycdn, hls, iframe-embeds, m3u8, video-downloader, yt-dlp
- Language: Python
- Homepage:
- Size: 41 KB
- Stars: 107
- Watchers: 5
- Forks: 29
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Bunny CDN "DRM" Video Downloader
A Python class for downloading Bunny
CDN's "[DRM](https://bunny.net/stream/media-cage-video-content-protection/)" videos
using [yt-dlp](https://github.com/yt-dlp/yt-dlp).## Requirements
You'll need to install `yt-dlp` and `requests` modules in your Python environment.
```bash
pip install -r requirements.txt
```> It is also better to have [FFmpeg](https://ffmpeg.org) installed on your system and its executable added to the PATH
> environment variable.## Usage
To try the script for testing and demonstration, simply paste the iframe embed page URL at the bottom, where indicated
between the quotes, as well as the webpage referer, and run the script.```bash
python3 b-cdn-drm-vod-dl.py
```> Embed link structure: [
`https://iframe.mediadelivery.net/embed/{video_library_id}/{video_id}`](https://docs.bunny.net/docs/stream-embedding-videos)## Expected Result
By default:
* the highest resolution video is to be downloaded. You can change this behavior in the `main_playlist` function located
under the `prepare_dl` method.
* The video will be downloaded in the `~/Videos/Bunny CDN/` directory. This configuration can be changed by providing
the `path` argument when instantiating a new `BunnyVideoDRM` object.
* The video file name will be extracted from the embed page. This can be overridden by providing the `name` argument .> Please note that the video format will be always `mp4`.
## Explanation
The idea is all about simulating what's happening in a browser.
The program runs a sequence of requests tied to
a [session](https://requests.readthedocs.io/en/latest/user/advanced/#session-objects) object (for cookie persistence and
connection pooling) first of which is the embed page request, from which information are extracted such as the video
name.After that, the download link (an HLS/M3U8 URL) is ready to be fed to `yt-dlp` to download the video segments, decrypt
them (as Bunny CDN's "DRM" videos are encrypted with the AES-128 algorithm), and merge them into a single playable video
file.