diff --git a/src/providers/archivebate.rs b/src/providers/archivebate.rs index a5b5d1f..ffb0809 100644 --- a/src/providers/archivebate.rs +++ b/src/providers/archivebate.rs @@ -799,6 +799,22 @@ impl ArchivebateProvider { .map(|value| value.to_string()) } + /// The proxied format needs no network, so an item always plays through + /// it even when the best-effort header enrichment below times out. + fn with_default_format(item: VideoItem, options: &ServerOptions) -> VideoItem { + let format_url = Self::proxied_video(options, &item.url); + if format_url.is_empty() || item.formats.is_some() { + return item; + } + let mut item = item; + item.formats = Some(vec![VideoFormat::new( + format_url, + "source".to_string(), + "mp4".to_string(), + )]); + item + } + async fn enrich_video(&self, item: VideoItem, options: &ServerOptions) -> VideoItem { let page_url = item.url.clone(); let format_url = Self::proxied_video(options, &page_url); @@ -1148,11 +1164,15 @@ impl ArchivebateProvider { platform: candidate.platform.clone(), gender: candidate.gender.clone(), }; - let items = self + // A candidate whose profile page is gone (the search index lists + // deleted profiles) must not abort the whole search: try the next. + match self .fetch_items_for_target(cache.clone(), &target, 1, per_page, &options) - .await?; - if !items.is_empty() { - return Ok(items); + .await + { + Ok(items) if !items.is_empty() => return Ok(items), + Ok(_) => {} + Err(_) => {} } } @@ -1199,11 +1219,11 @@ impl Provider for ArchivebateProvider { .await; match timeout_result { Ok(enriched) => enriched, - Err(_) => video, + Err(_) => Self::with_default_format(video, &options), } } })) - .buffer_unordered(4) + .buffered(4) .collect::>() .await }