Open richiedevs opened 3 years ago
I benchmarked this on my Ryzen 7 3700X @ 4.2 GHz processor using Wi-Fi 6 @ 600mbps
Most of this time is waiting on requests from YouTube, afaik there's hardly anything that can be done to speed up the process. If you do find a timesave, please open a PR with it.
if that's the case, how is basicInfo faster than info?
Seems more like a processing-delay than request-delay
if that's the case, how is basicInfo faster than info?
iirc getInfo()
actually makes more requests, in order to download and decipher format/streaming information.
Seems more like a processing-delay than request-delay
I'll try to benchmark request time vs total processing time and have some more specific statistics on this.
Using the innertube api with data compression is far more efficient. Especially, if you maintain a session, then each video info call is only a +-20kb zipped json transfer vs upwards of 3mb for watch page html, player js and json info page. For once-off download requests it wont make much difference. But if you are harvesting lots of video info for possible downloading/playing later, it makes a world of difference.
if we can verify what you claim, using innertube could be a worthwhile time investment. I will look into it, and if any other maintainers could look into it that would be amazing
@redbrain I think you can verify quite easily using https://github.com/gatecrasher777/ytcog, and you should be able to extract the structure of the innertube post requests from the code. I really think the innertube api is where all YouTube OS projects are heading, as more and more legacy resources fall by the wayside. Of course, YouTube isn't going to make it easy for us...
@gatecrasher777 nice project, will sure check it out!
Before creating an issue, please try the following
I've noticed that getInfo uses ~850ms on average, and getBasicInfo uses ~500ms, the code i've used to test this is:
and
I believe and hope that the performance of ytdl's getBasicInfo could get further optimized, or add some array-like options to choose what kind of information i want to extract, and not get the entire gigantic object which is quite slow