Mithronn / rusty_ytdl

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

Feature request: allow retries for chunks #32

Closed nick42d closed 3 months ago

nick42d commented 3 months ago

When looking to integrate the fix for the fix for #31 into my project, youtui, I noticed that even the individual chunks of a Stream can fail. To then retry streaming I need to start from the start again.

From what I can tell a simple way to resolve could be the addition of a new chunk_with_retries method on the Stream trait, since the requests inside NonLiveStream and LiveStream seem on first glance to be repeatable.

Let me know your thoughts and I'm happy to have a go with a PR.

Mithronn commented 3 months ago

This crate already uses the reqwest-retry crate but it only retries for 500..599, 408, and 429 status codes. I will publish a new commit with a new strategy which includes 400..499 and 500..599. But feel free to make new PR maybe your solution would be better