updated extensions

This commit is contained in:
2026-01-02 01:51:02 +01:00
parent ff24046f61
commit 209026936d
2 changed files with 49 additions and 11 deletions

View File

@@ -1,7 +1,7 @@
class Anizone { class Anizone {
constructor() { constructor() {
this.type = "anime-board"; this.type = "anime-board";
this.version = "1.0"; this.version = "1.1";
this.api = "https://anizone.to"; this.api = "https://anizone.to";
} }
@@ -78,21 +78,59 @@ class Anizone {
} }
async getMetadata(id) { 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 { return {
id, id,
title: "Unknown", title: title || "Unknown",
summary: "", summary: summary || "",
episodes: 0, episodes,
status: "unknown", status,
season: null, season: null,
year: null, year,
genres: [], genres,
score: 0, score: 0,
image: null, image,
}; };
} }
async findEpisodes(id) { async findEpisodes(id) {
const html = await fetch(`${this.api}/anime/${id}/1`).then(r => r.text()); const html = await fetch(`${this.api}/anime/${id}/1`).then(r => r.text());

View File

@@ -2,7 +2,7 @@ class AnimeAV1 {
constructor() { constructor() {
this.type = "anime-board"; this.type = "anime-board";
this.version = "1.0" this.version = "1.1"
this.api = "https://animeav1.com"; this.api = "https://animeav1.com";
} }
@@ -25,7 +25,7 @@ class AnimeAV1 {
const data = await res.json(); const data = await res.json();
return data.map(anime => ({ return data.map(anime => ({
id: anime.title.toLowerCase().replace(/\s+/g, '-'), id: anime.slug,
title: anime.title, title: anime.title,
url: `${this.api}/anime/${anime.slug}`, url: `${this.api}/anime/${anime.slug}`,
subOrDub: "both", subOrDub: "both",