feat: YouTube/yt-dlp parallel streaming downloads#26
Open
siq0o wants to merge 2 commits intomasterking32:python_testingfrom
Open
feat: YouTube/yt-dlp parallel streaming downloads#26siq0o wants to merge 2 commits intomasterking32:python_testingfrom
siq0o wants to merge 2 commits intomasterking32:python_testingfrom
Conversation
Contributor
|
May not be fully related but why don't we always use 4 MiB chunks when we encounter googlevideo.com? It's incredibly unlikely for a file coming from there to be less than that. Or maybe I have no idea what I'm talking about. |
Collaborator
|
I'm not saying this is a bad idea. but code quality is not really good, I can clearly see some code duplication. the maybe double check it ? |
Author
|
Sorry for the low quality code 😬 feel free to take over, since this is all still vibe coded. |
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.
I have limited networking/Python knowledge so feel free to close this and implement your own version — but it's been working well in testing.
What this does:
Adds a YouTube fast path inside
stream_parallel_downloadthat activates when agooglevideo.comURL contains theclen=query parameter (total file size, always present in yt-dlp's direct video URLs). This allows:clen)Required yt-dlp flags:
--downloader native --http-chunk-size 0 --no-continue --socket-timeout 60--no-continueis needed because resume support conflicts with our buffered streaming model — yt-dlp's resume validation expects specificContent-Lengthsemantics we can't cleanly satisfy.What it doesn't affect:
The
is_ytguard ("googlevideo.com" in url+clen=in query string) means browser video playback and all other download types go through the original unmodified code path. Browser range requests use boundedbytes=X-Yheaders and don't carryclen, so they never trigger this path.Developed with Claude Sonnet as a collaborator.