Skip to content

feat: audio format picker, video codec chips, YouTube auth (Deno/EJS)#36

Open
LibreArbitre wants to merge 1 commit intoaverygan:mainfrom
LibreArbitre:pr/features
Open

feat: audio format picker, video codec chips, YouTube auth (Deno/EJS)#36
LibreArbitre wants to merge 1 commit intoaverygan:mainfrom
LibreArbitre:pr/features

Conversation

@LibreArbitre
Copy link
Copy Markdown

Summary

Three new features + critical bug fixes for YouTube compatibility:

Features

1. Audio Format Picker

  • Buttons for MP3/AAC/OPUS/FLAC/WAV/M4A (visible in audio mode only)
  • Default: MP3
  • New audio_format param in /api/download

2. Video Codec Chips

  • AVC1/VP9/AV01 chips shown per resolution when multiple codecs are available
  • Click a codec chip to select that specific format
  • Formats grouped by (height, codec) instead of just height

3. YouTube Auth (Cookie Upload)

  • Upload button appears automatically when a "Sign in to confirm you're not a bot" error is detected
  • Supports JSON (EditThisCookie) and Netscape formats — auto-converts JSON→Netscape
  • uBlock-safe class naming (auth instead of cookie) so ad blockers don't hide the UI
  • Cookies stored in sessionStorage only (RAM, never written to disk)
  • Auto-re-fetches after cookie upload
  • Cookie passed to both /api/info and /api/download

Critical Fix: Deno + EJS

YouTube now requires solving JavaScript challenges. Without a JS runtime, yt-dlp only sees storyboard images (no video/audio formats). This PR adds:

  • Deno installed in Docker image
  • --remote-components ejs:npm on all yt-dlp commands
  • Updated Dockerfile with ffmpeg + curl + unzip for Deno installation

Bug Fixes

  • Group formats by height+codec (was losing alternative codecs per resolution)
  • Add #HttpOnly_ prefix for httpOnly cookies in Netscape conversion
  • Pass cookie to download endpoint (was only sent to info endpoint)
  • Docker compose file for self-hosting
  • README updated with Deno requirement, cookie best practices, Docker instructions

Files Changed

File Changes
app.py +119/-4 — format grouping, cookie conversion, cookie in download
templates/index.html +249/-21 — audio picker, codec chips, auth banner, auto-re-fetch
Dockerfile +6/-2 — Deno, ffmpeg, curl
docker-compose.yml +12 new — self-hosting
README.md +57/-25 — Deno, cookies, Docker docs

…support

Features:
- Audio format picker: MP3/AAC/OPUS/FLAC/WAV/M4A buttons (audio mode only)
- Video codec chips: AVC1/VP9/AV01 per resolution (when multiple codecs available)
- Cookie-based auth for bot-protected YouTube videos (JSON + Netscape auto-conversion)
- uBlock-safe class naming (auth instead of cookie)
- Deno + EJS challenge solver for YouTube JS n-challenge
- Auto-re-fetch after cookie upload
- docker-compose.yml for self-hosting

Bug fixes:
- Group formats by height+codec (was losing alternative codecs per resolution)
- Add #HttpOnly_ prefix for httpOnly cookies in Netscape format conversion
- Pass cookie to download endpoint (was only passed to info)
- Add --remote-components ejs:npm to all yt-dlp commands

Dependencies:
- Dockerfile now includes Deno (JS runtime) and ffmpeg
- yt-dlp installed from GitHub master (more current than PyPI)

README updated with Deno requirement, cookie best practices, Docker instructions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant