updates and new extensions

This commit is contained in:
2026-01-13 17:26:06 +01:00
parent 83c51a82da
commit e8d64174fd
15 changed files with 3516 additions and 468 deletions

View File

@@ -2,13 +2,50 @@ class asmhentai {
constructor() {
this.baseUrl = "https://asmhentai.com";
this.type = "book-board";
this.version = "1.1"
this.version = "1.2";
this.mediaType = "manga";
}
async search(queryObj) {
const q = (queryObj.query || "").trim().replace(/\s+/g, "+");
const html = await fetch(`${this.baseUrl}/search/?q=${q}&page=1`).then(r => r.text());
getFilters() {
return {
sort: {
label: "Order",
type: "select",
options: [
{ value: "latest", label: "Latest" },
{ value: "popular", label: "Popular" }
],
default: "latest"
}
};
}
async search({ query, page = 1, filters }) {
let url;
if (query && query.trim().length > 0) {
const q = query.trim().replace(/\s+/g, "+");
url = `${this.baseUrl}/search/?q=${q}&page=${page}`;
}
else {
const sort = filters?.sort || "latest";
if (sort === "popular") {
url = page === 1
? `${this.baseUrl}/popular/`
: `${this.baseUrl}/popular/pag/${page}/`;
} else {
url = page === 1
? `${this.baseUrl}/`
: `${this.baseUrl}/pag/${page}/`;
}
}
const html = await fetch(url).then(r => r.text());
const $ = this.cheerio.load(html);
const results = [];
@@ -16,6 +53,7 @@ class asmhentai {
$(".preview_item").each((_, el) => {
const href = $(el).find(".image a").attr("href");
const id = href?.match(/\/g\/(\d+)\//)?.[1];
if (!id) return;
let img = $(el).find(".image img").attr("data-src") || $(el).find(".image img").attr("src") || "";
@@ -49,7 +87,7 @@ class asmhentai {
const genres = $(".tags a.tag")
.map((_, el) => $(el).text().trim())
.get()
.get();
return {
id,
@@ -111,14 +149,10 @@ class asmhentai {
return url;
})
.filter(url => {
// Mantenemos el filtro que te funcionó
return url && url.includes("images.") && !url.includes("/images/");
})
.map((url, i) => {
// Reemplazamos "thumb" por el número del índice + 1
// Ejemplo: .../thumb.jpg -> .../1.jpg
const newUrl = url.replace("thumb", (i + 1).toString());
return {
index: i,
url: newUrl