diff options
author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2025-06-16 13:59:45 +0200 |
---|---|---|
committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2025-06-16 13:59:45 +0200 |
commit | a7e1a2d7475fc1304ef7b33aa2f170f8232bd1d8 (patch) | |
tree | cadacf9413b722b9b07099c9bb761a8f8d3acfe2 /crates | |
parent | feat(yt_dlp): Support a DeArrow post processor (diff) | |
download | yt-a7e1a2d7475fc1304ef7b33aa2f170f8232bd1d8.zip |
fix(yt/update): Also handle the newly introduced error conditions
Diffstat (limited to 'crates')
-rw-r--r-- | crates/yt/src/update/updater.rs | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/crates/yt/src/update/updater.rs b/crates/yt/src/update/updater.rs index 04bcaa1..60e9855 100644 --- a/crates/yt/src/update/updater.rs +++ b/crates/yt/src/update/updater.rs @@ -19,7 +19,7 @@ use futures::{StreamExt, future::join_all, stream}; use log::{Level, debug, error, log_enabled}; use serde_json::json; use tokio_util::task::LocalPoolHandle; -use yt_dlp::{InfoJson, YoutubeDLOptions, json_cast, json_get, process_ie_result}; +use yt_dlp::{InfoJson, PythonError, YoutubeDLOptions, json_cast, json_get, process_ie_result}; use crate::{ ansi_escape_codes::{clear_whole_line, move_to_col}, @@ -160,24 +160,28 @@ impl Updater { } }) // Don't fail the whole update, if one of the entries fails to fetch. - .filter_map(|base| match base { + .filter_map(move |base| match base { Ok(ok) => Some(ok), Err(err) => { - let process_ie_result::Error::Python(err) = &err; - - if err.contains( - "Join this channel to get access to members-only content ", - ) { - // Hide this error - } else { - // Show the error, but don't fail. - let error = err - .strip_prefix("DownloadError: \u{1b}[0;31mERROR:\u{1b}[0m ") - .unwrap_or(err); - error!("{error}"); + match err { + process_ie_result::Error::Python(PythonError(err)) => { + if err.contains( "Join this channel to get access to members-only content ",) { + // Hide this error + } else { + // Show the error, but don't fail. + let error = err + .strip_prefix("DownloadError: \u{1b}[0;31mERROR:\u{1b}[0m ") + .unwrap_or(&err); + error!("While fetching {:#?}: {error}", sub.name); + } + + None + } + process_ie_result::Error::InfoJsonPrepare(error) => { + error!("While fetching {:#?}: Failed to prepare info json: {error}", sub.name); + None + }, } - - None } })) } |