fix(youtube): recognise youtu.be / shorts / embed / live URL shapes#1782
Open
MukundaKatta wants to merge 1 commit intomicrosoft:mainfrom
Open
fix(youtube): recognise youtu.be / shorts / embed / live URL shapes#1782MukundaKatta wants to merge 1 commit intomicrosoft:mainfrom
MukundaKatta wants to merge 1 commit intomicrosoft:mainfrom
Conversation
The YouTube converter only accepted canonical watch URLs (https://www.youtube.com/watch?v=...). Short links (youtu.be/<id>), Shorts (/shorts/<id>), embeds, live streams, and m./music. hosts silently fell through to the generic HTML converter, so the caller missed the YouTube-specific title / description / transcript path. Centralise the URL → video_id mapping in a single helper (_extract_video_id) used by both accepts() and convert(). That also removes the brittle urlparse+parse_qs duplication in convert(). Fixes microsoft#1775. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@MukundaKatta please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
_extract_video_idhelperyoutu.be/<id>short links,/shorts/<id>,/embed/<id>,/live/<id>in addition to the canonical/watch?v=...m.youtube.comandmusic.youtube.comhostsconvert()reuse the same helper so it no longer silently skips the transcript path for valid non-canonical URLsPreviously
YouTubeConverter.accepts()only matchedhttps://www.youtube.com/watch?, so any other valid YouTube URL shape fell through to the generic HTML converter and lost the YouTube-specific title / description / transcript handling.convert()duplicated the?v=parsing and had the same blind spot.Fixes #1775.
Test plan
tests/test_youtube_url_shapes.pycovers all accepted shapes plus negative cases (vimeo, bare/watchwith nov, channel URL, empty string, unknown host) — 14/14 passwww.youtube.com/watch?v=...unchanged🤖 Generated with Claude Code