Remove internal jwt error retry

This commit is contained in:
bytedream 2024-05-22 16:54:58 +02:00
parent 5593046aae
commit 7d2ae719c8

View file

@ -166,8 +166,6 @@ impl SingleFormat {
}
pub async fn stream(&self) -> Result<Stream> {
let mut i = 0;
loop {
let stream = match &self.source {
MediaCollection::Episode(e) => e.stream_maybe_without_drm().await,
MediaCollection::Movie(m) => m.stream_maybe_without_drm().await,
@ -177,18 +175,11 @@ impl SingleFormat {
};
if let Err(crunchyroll_rs::error::Error::Request { message, .. }) = &stream {
// sometimes the request to get streams fails with an 403 and the message
// "JWT error", even if the jwt (i guess the auth bearer token is meant by that) is
// perfectly valid. it's retried the request 3 times if this specific error occurs
if message == "JWT error" && i < 3 {
i += 1;
continue;
} else if message.starts_with("TOO_MANY_ACTIVE_STREAMS") {
if message.starts_with("TOO_MANY_ACTIVE_STREAMS") {
bail!("Too many active/parallel streams. Please close at least one stream you're watching and try again")
}
};
return Ok(stream?);
}
Ok(stream?)
}
pub async fn skip_events(&self) -> Result<Option<SkipEvents>> {