-
Notifications
You must be signed in to change notification settings - Fork 10.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
certain lengthy youtube videos take a long time to initialise #32692
Comments
With this low-spec 2-CPU notebook, the extraction for A trivial trace of the n-sig processing seems to be showing an increasing delay between applying the cached n-sig to each format. We should unthrottle the DASH formats before |
* apply n-sig before chunked fragments, fixes ytdl-org#32692
* apply n-sig before chunked fragments, fixes ytdl-org#32692
With PR #32695, incorporating the above commit: |
Thanks for the test. Yes indeed, it's much faster when it doesn't actually calculate the n-sig. Now I'm getting something like these figures: I guess there is some shim/shims making 2.7 so much slower. |
* apply n-sig before chunked fragments, fixes ytdl-org#32692
* apply n-sig before chunked fragments, fixes ytdl-org#32692
* apply n-sig before chunked fragments, fixes ytdl-org#32692
* apply n-sig before chunked fragments, fixes ytdl-org#32692
You could test the fixed PR #32695. This version seems to extract from YT at least as fast as yt-dlp with Python 3.11 but a miniconda 2.7.15 is up to 3x slower. |
Similarly with a distro that provides 2.7.18 (but a beefier laptop): Now I would say that other factors than the extractor and |
does YouTube-DL have an option to change the client? using the ANDROID client, I am getting this: TotalMilliseconds : 227.3747 most of which is probably just spent on waiting for the JSON response from the server |
You can choose the client with yt-dlp using |
if you're using the ANDROID client, you dont need to check the |
That's right, but I only want to vary one parameter at a time. yt-dl will use a different client for age-gate bypass, but otherwise 'web' is hard-wired. |
not using ANDROID client, comes with an extremely significant drawback, as you well know. so by adding this arbitrary restriction on the client used by the tool, you are drawing yourself into a corner. As long as you understand that fact, nothing more I can add I suppose. |
The rationale for selecting the There's nothing to stop someone who cares from offering a PR/PR(s) to back-port (or reimplement) the |
* https://github.com/ytdl-org/youtube-dl: [YouTube] Fix `like_count` extraction using `likeButtonViewModel` * also fix various tests * TODO: check against yt-dlp tests [YouTube] Rework n-sig processing, realigning with yt-dlp * apply n-sig before chunked fragments, fixes ytdl-org#32692 [InfoExtractor] Support some warning and `._downloader` shortcut methods from yt-dlp [compat] Rework compat for `method` parameter of `compat_urllib_request.Request` constructor * fixes ytdl-org#32573 * does not break `utils.HEADrequest` (eg)
Appears to take 9-10 seconds regardless of video now, so that's a good improvement. |
LOL |
Checklist
Verbose log
Description
Most youtube videos take about 13 seconds of runtime for me, with --simulate. Some videos take 20 or 28 seconds. Other videos take 80 seconds. This depends on the video and is reproducible.
Sample video with such behaviour: 8SIiGo3TVKE
youtube-dl pauses for a looong time after:
[debug] [youtube] Decrypted nsig 45tbpgX-M8RD3WRrq => JiFeLd6kfppZFg
CPU is pegged during the pause and the total runtime is 80 seconds (!). Memory use is high as well: it rises slowly to ~218 MB (as opposed to ~50 MB normally)
The download works, of course, but this time it spends on initialisation is excessive. As far as I can tell, it is not caused by the n-sig decryption, but something that happens in between.
The only thing I've found in common with these videos is that they're long and have HD video (1080p or more).
Above verbose output was taken with PyPy 3.10, and it also happens with PyPy 2.7 as well as CPython 2.7.
So if somebody feels like profiling some code, there's something to profile here...
The text was updated successfully, but these errors were encountered: