Skip to content

Add --download-sections flag to dub command for partial video dubbing#140

Merged
alexkroman merged 1 commit into
mainfrom
claude/exciting-hamilton-hvcahq
Jun 13, 2026
Merged

Add --download-sections flag to dub command for partial video dubbing#140
alexkroman merged 1 commit into
mainfrom
claude/exciting-hamilton-hvcahq

Conversation

@alexkroman

Copy link
Copy Markdown
Collaborator

Adds support for the --download-sections flag to the dub command, enabling users to download and dub only specific time slices of YouTube/media-page URLs using yt-dlp's section syntax.

Changes

  • New CLI option: Added --download-sections flag to the dub command that accepts repeatable time-slice specifications (e.g., "*0:00-15:00" for the first 15 minutes)
  • Validation: Implemented validate_sections_flag() in youtube.py to ensure --download-sections is only used with downloadable URLs (YouTube, media pages, etc.), not local files or direct media URLs
  • Download integration: Updated download_media() call in dub_exec.py to pass download_sections to yt-dlp, which selectively fetches only the requested portions
  • Help text: Updated command documentation and added example showing how to dub only the first 15 minutes of a YouTube video
  • Tests: Added comprehensive test coverage including:
    • Validation that sections are passed through to yt-dlp verbatim
    • Validation that the flag is rejected for local files with a helpful error message suggesting assembly clip as an alternative
    • Snapshot tests for updated help text

Implementation Details

The feature integrates with the existing _ytdlp_options() helper which already supported download_sections parameter. The validation mirrors the existing validate_video_flag() pattern, ensuring consistent error handling and user guidance. When sections are specified for a downloadable URL, they are passed directly to yt-dlp's --download-sections option, allowing fine-grained control over what portions of media are fetched and dubbed.

https://claude.ai/code/session_01Uzv66SZ2xBW79wyMmgSDy7

Dub a slice of a YouTube/media-page source without fetching or dubbing
the whole thing, e.g.:

  assembly --sandbox dub "https://youtube.com/watch?v=ID" -l de --video \
    --download-sections "*0:00-15:00"

The specs reach yt-dlp verbatim (same flag and syntax as transcribe's
--download-sections); like --video, the flag is rejected for a local
file rather than silently dropped (youtube.validate_sections_flag).

https://claude.ai/code/session_01Uzv66SZ2xBW79wyMmgSDy7
@alexkroman alexkroman added this pull request to the merge queue Jun 13, 2026
Merged via the queue into main with commit 6f6b81c Jun 13, 2026
15 checks passed
@alexkroman alexkroman deleted the claude/exciting-hamilton-hvcahq branch June 13, 2026 00:10
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.

2 participants