Skip to content

feat(cli): accept YouTube URLs in addition to video IDs#586

Open
hr0dv1tn1r wants to merge 1 commit intojdepoix:masterfrom
hr0dv1tn1r:feat/accept-youtube-urls-in-cli
Open

feat(cli): accept YouTube URLs in addition to video IDs#586
hr0dv1tn1r wants to merge 1 commit intojdepoix:masterfrom
hr0dv1tn1r:feat/accept-youtube-urls-in-cli

Conversation

@hr0dv1tn1r
Copy link
Copy Markdown

Previously _sanitize_video_ids only stripped backslashes from raw video IDs. This change extends it to also detect and parse full YouTube URLs, automatically extracting the 11-character video ID.

Supported URL formats:

URLs with extra query parameters (e.g. &t=30s) are handled correctly. Bare video IDs continue to work unchanged. Multiple video arguments mixing IDs and URLs are fully supported.

Tests added for all supported URL formats and mixed inputs.

Previously _sanitize_video_ids only stripped backslashes from raw
video IDs. This change extends it to also detect and parse full
YouTube URLs, automatically extracting the 11-character video ID.

Supported URL formats:
- https://www.youtube.com/watch?v=VIDEO_ID
- https://youtu.be/VIDEO_ID
- https://www.youtube.com/embed/VIDEO_ID
- https://www.youtube.com/v/VIDEO_ID

URLs with extra query parameters (e.g. &t=30s) are handled correctly.
Bare video IDs continue to work unchanged. Multiple video arguments
mixing IDs and URLs are fully supported.

Tests added for all supported URL formats and mixed inputs.
@hr0dv1tn1r hr0dv1tn1r closed this Apr 4, 2026
@hr0dv1tn1r hr0dv1tn1r reopened this Apr 4, 2026
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