updated extensions
This commit is contained in:
@@ -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());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user