Mithronn / rusty_ytdl

A Rust library for Youtube video searcher and downloader
https://docs.rs/rusty_ytdl
MIT License
107 stars 21 forks source link

Being able to iter through chunks while downloading #5

Closed Bowarc closed 1 year ago

Bowarc commented 1 year ago

Hi, im making a background manager, and i wanted to be able to download videos from yt, your crate seems rly cool but one catch. From what i see, the function rusty_ytdl::Video::download doesn't allow the thread to get/send status update. therefore, the user don't have any idea of the speed/time it's gonna take to download the whole video.

How about moving the get_next_chunk function in rusty_ytdl::Video::download directly in rusty_ytdl::Video so something like this could be possible:

While Ok(video.get_next_chunk(/* &client, &link, &content_length, ... */){
   // Send 'Hi, chunk {x}/{y}' to main thread
}

I belive it would be a great feature. i'd love to hear your opinion on this

Bowarc commented 1 year ago

Now that i think of it, it would also allow us to save the file while downloading, so you don't have to store a potentially large file in memory all at once (trying to download a 8h video leaves us with a 6Gb array of data that could have been written to disk wayyy earlyer)

Mithronn commented 1 year ago

Thank you for the feature idea. To be implemented with version 0.6.0.