diff --git a/src/application/anime2/use_cases.rs b/src/application/anime2/use_cases.rs index 83e5832..c7f6a86 100644 --- a/src/application/anime2/use_cases.rs +++ b/src/application/anime2/use_cases.rs @@ -330,29 +330,14 @@ impl Anime2UseCases { self.cache() .get_or_set(&cache_key, DETAIL_CACHE_TTL, || async { let detail_url = self.repository.detail_url(&slug); - let image_url = self.repository.detail_image_url(&slug); - let (detail_html, image_html) = tokio::join!( - self.repository.fetch_html(&detail_url), - self.repository.fetch_html(&image_url) - ); - let detail_html = detail_html.map_err(|e| e.to_string())?; - let image_html = image_html.ok(); + let detail_html = self + .repository + .fetch_html(&detail_url) + .await + .map_err(|e| e.to_string())?; let mut data = tokio::task::spawn_blocking(move || { - let mut data = - parser::parse_anime_detail(&detail_html).map_err(|e| e.to_string())?; - if let Some(image_html) = image_html { - if let Ok(image_data) = parser::parse_anime_detail(&image_html) { - if !image_data.poster.is_empty() { - data.poster = image_data.poster; - } - if !image_data.poster2.is_empty() { - data.poster2 = image_data.poster2; - } - data.recommendations = image_data.recommendations; - } - } - Ok::<_, String>(data) + parser::parse_anime_detail(&detail_html).map_err(|e| e.to_string()) }) .await .map_err(|e| e.to_string())??; @@ -372,7 +357,6 @@ impl Anime2UseCases { ) .await; - // Recommendation in modules::anime2::types implements HasPoster apply_cached_posters( &mut data.recommendations, self.db.clone(), diff --git a/src/infrastructure/repository/alqanime.rs b/src/infrastructure/repository/alqanime.rs index 030cd95..8627ad8 100644 --- a/src/infrastructure/repository/alqanime.rs +++ b/src/infrastructure/repository/alqanime.rs @@ -7,8 +7,7 @@ use crate::domain::error::ScrapingError; use crate::domain::repository::ScrapingRepository; use crate::infrastructure::scraping::proxy_fetch::fetch_with_proxy_only; -const BASE_URL: &str = "https://alqanime.si"; -const BASE_DETAIL_URL: &str = "https://alqanime.net"; +const BASE_URL: &str = "https://alqanime.net"; pub struct AlqanimeRepository; @@ -38,11 +37,7 @@ impl AlqanimeRepository { } pub fn detail_url(&self, slug: &str) -> String { - format!("{}/{}/", BASE_DETAIL_URL, slug) - } - - pub fn detail_image_url(&self, slug: &str) -> String { - format!("{}/anime/{}/", BASE_URL, slug) + format!("{}/{}/", BASE_URL, slug) } pub fn genre_page_url(&self, genre_slug: &str, page: u32) -> String {