fix(anime): repair genre & latest endpoints for the new otakudesu layout
Deploy Scraper / build-and-deploy (push) Canceled after 0s
Deploy Scraper / build-and-deploy (push) Canceled after 0s
The current otakudesu site changed paths and card layout, breaking two APIs:
1. genre pages: singular /genre/{slug}/page/{n}/ 301-redirects to a dead
otakudesu.io placeholder → 0 items. Fix: plural /genres/{slug}/page/{n}/.
Also re-target parse_genre_anime_document from the retired .venz ul li /
.thumbz h2.jdlflm layout to the new .col-anime card layout
(.col-anime-title a, .col-anime-eps, .col-anime-rating, .col-anime-cover img).
2. latest: /latest-anime/ was removed (301 → otakudesu.io). The homepage IS
the latest-episodes feed (.venz ul li with .thumbz h2.jdlflm/.epz), so
fetch_latest_anime_page now uses base_url() for page 1 and /page/N/ for
later pages instead of the dead path.
This commit is contained in:
1 parent
80af7b9460
commit
e6d75edf33
2 files changed
+30
-14
No files matched your search
@@ -56,7 +56,10 @@ impl OtakudesuRepository {
|
||||
}
|
||||
|
||||
pub fn genre_page_url(&self, genre_slug: &str, page: &str) -> String {
|
||||
format!("{}/genre/{}/page/{}/", self.base_url(), genre_slug, page)
|
||||
// Current otakudesu uses the plural `/genres/{slug}/` path (archive
|
||||
// layout). The singular `/genre/{slug}/page/{page}/` path 301-redirects
|
||||
// to otakudesu.io (a 404 placeholder), which made genre pages return 0.
|
||||
format!("{}/genres/{}/page/{}/", self.base_url(), genre_slug, page)
|
||||
}
|
||||
|
||||
pub fn full_episode_url(&self, slug: &str) -> String {
|
||||
@@ -144,7 +147,14 @@ impl OtakudesuRepository {
|
||||
&self,
|
||||
slug: &str,
|
||||
) -> Result<(Vec<LatestAnimeItem>, Pagination), ScrapingError> {
|
||||
let url = self.page_url("latest-anime", slug);
|
||||
// The site's `/latest-anime/` path was removed (301 → otakudesu.io
|
||||
// placeholder). The homepage IS the latest-episodes page (`.venz ul li`
|
||||
// with `.thumbz h2.jdlflm`, `.epz`), paginated via WordPress `/page/N/`.
|
||||
let url = if slug == "1" {
|
||||
format!("{}/", self.base_url())
|
||||
} else {
|
||||
format!("{}/page/{}/", self.base_url(), slug)
|
||||
};
|
||||
let html = self.fetch_html(&url).await?;
|
||||
let slug_owned = slug.to_string();
|
||||
tokio::task::spawn_blocking(move || {
|
||||
|
||||
Reference in new issue
Block a user