ftde0 / yt2009

2009 youtube frontend.
Apache License 2.0
193 stars 119 forks source link

Refactor code to use streaming for downloading data #107

Closed gohoski closed 4 months ago

gohoski commented 4 months ago

The current code writes the video data to a Buffer variable and then writes its contents to disk. This causes problems while downloading a long video on small amounts of RAM, since everything is first being written on RAM, and on systems with slow drive speed.

My new proposed code uses streaming, which writes the data directly to disk. This reduces the amount of consumed RAM and CPU.

gohoski commented 4 months ago

Now it works much faster than the previous commit.

gohoski commented 4 months ago

Just wanted to ask — why the data is being downloaded by 9 MB chunks?

ftde0 commented 4 months ago

downloads that aren't chunked seem to be throttled serverside. also, did you set the thing as draft?

ftde0 commented 4 months ago

for future ref: this change was applied in https://github.com/ftde0/yt2009/commit/55faf2e1246f5716d5db3423ce45dbab124da3f8, albeit some other things had to be made, so the pull won't be marked as merged.