feat: convert on exit

This commit is contained in:
2025-11-18 11:03:05 +01:00
parent 3f46bcc1bd
commit 0c0b39728c
4 changed files with 476 additions and 19 deletions

View File

@@ -13,10 +13,10 @@ This installs the `sdl` binary into your `GOBIN` (defaults to `~/go/bin`). Ensur
## Usage
```bash
sdl https://example.com/path/to/playlist.m3u8
sdl https://example.com/page-with-video
```
The downloader automatically picks the highest-bandwidth variant when given a master playlist, downloads the segments, and transmuxes them into an `.mp4` container. You can override the output filename:
If the target URL is a webpage, `sdl` scans it for embedded HLS playlists (`.m3u8`) and downloads each one it finds. You can override the output filename (or prefix when multiple videos exist):
```bash
sdl -o myvideo.mp4 https://example.com/path/to/playlist.m3u8
@@ -25,6 +25,7 @@ sdl -o myvideo.mp4 https://example.com/path/to/playlist.m3u8
## Features
- Follows HTTP redirects (up to 5 hops)
- Scrapes webpages for embedded HLS playlists (`<video>`, `<source>`, data attributes, script references)
- Supports HLS master playlists (auto-select highest bandwidth variant)
- Produces `.mp4` output via `ffmpeg`
- Respects basic HTTP timeouts (30 seconds per request)
@@ -32,6 +33,7 @@ sdl -o myvideo.mp4 https://example.com/path/to/playlist.m3u8
## Limitations
- Requires `ffmpeg` in `PATH` for transmuxing
- Webpage scraping is best-effort; dynamic players that load playlists via JS APIs may not be detected
- No retry logic beyond standard HTTP redirects
## Development