diff --git a/anime/AniZone.js b/anime/AniZone.js index 7aed675..673e98d 100644 --- a/anime/AniZone.js +++ b/anime/AniZone.js @@ -1,7 +1,7 @@ class Anizone { constructor() { this.type = "anime-board"; - this.version = "1.0"; + this.version = "1.1"; this.api = "https://anizone.to"; } @@ -78,21 +78,59 @@ class Anizone { } async getMetadata(id) { - // HARDCODED de momento + const url = `https://anizone.to/anime/${id}`; + const res = await fetch(url); + const html = await res.text(); + const $ = this.cheerio.load(html); + + const title = $('div.flex.flex-col.items-center.lg\\:items-start h1').first().text().trim(); + + const summary = $('div.text-slate-100.text-center.lg\\:text-start.text-sm.md\\:text-base.xl\\:text-lg div').text().trim(); + + // Episodios + let episodes = 0; + $('span.flex.items-center.gap-1').each((i, el) => { + const text = $(el).text().trim(); + const match = text.match(/(\d+)\s+Episodes?/i); + if (match) { + episodes = parseInt(match[1], 10); + return false; // rompe el each cuando lo encuentra + } + }); + + let status = "unknown"; + $('span.flex.items-center.gap-1.5').each((i, el) => { + const text = $(el).text().trim().toLowerCase(); + if (text.includes("completed")) status = "completed"; + else if (text.includes("ongoing")) status = "ongoing"; + }); + + const yearText = $('span.flex.items-center.gap-1 span.inline-block').text().trim(); + const year = yearText ? parseInt(yearText, 10) : null; + + const genres = []; + $('div.flex.flex-wrap.gap-2.justify-center.lg\\:justify-start a').each((i, el) => { + const genre = $(el).attr('title')?.trim(); + if (genre) genres.push(genre); + }); + + const image = $('div.mx-auto.lg\\:mx-0 img').attr('src') || null; + return { id, - title: "Unknown", - summary: "", - episodes: 0, - status: "unknown", + title: title || "Unknown", + summary: summary || "", + episodes, + status, season: null, - year: null, - genres: [], + year, + genres, score: 0, - image: null, + image, }; } + async findEpisodes(id) { const html = await fetch(`${this.api}/anime/${id}/1`).then(r => r.text()); diff --git a/anime/AnimeAV1.js b/anime/AnimeAV1.js index 8b4551c..1c6ef49 100644 --- a/anime/AnimeAV1.js +++ b/anime/AnimeAV1.js @@ -2,7 +2,7 @@ class AnimeAV1 { constructor() { this.type = "anime-board"; - this.version = "1.0" + this.version = "1.1" this.api = "https://animeav1.com"; } @@ -25,7 +25,7 @@ class AnimeAV1 { const data = await res.json(); return data.map(anime => ({ - id: anime.title.toLowerCase().replace(/\s+/g, '-'), + id: anime.slug, title: anime.title, url: `${this.api}/anime/${anime.slug}`, subOrDub: "both",