class lightnovelworld { constructor() { this.baseUrl = "https://lightnovelworld.org/api"; this.type = "book-board"; this.mediaType = "ln"; this.version = "1.0" } async search(queryObj) { const query = queryObj.query?.trim() || ""; if (query !== "") { const res = await fetch( `${this.baseUrl}/search/?q=${encodeURIComponent(query)}&search_type=title` ); const data = await res.json(); if (!data.novels) return []; return data.novels.map(n => ({ id: n.slug, title: n.title, image: `https://lightnovelworld.org/${n.cover_path}`, rating: `Rank ${n.rank}`, format: "Light Novel" })); } const res = await fetch("https://lightnovelworld.org/"); const html = await res.text(); const cards = html.split('class="recommendation-card"').slice(1); const results = []; for (const block of cards) { const link = block.match(/href="([^"]+)"/)?.[1] || ""; const id = link.replace(/^\/novel\//, "").replace(/\/$/, ""); const title = block.match(/class="card-title"[^>]*>([^<]+)/)?.[1]?.trim() || null; let img = block.match(/]+src="([^"]+)"/)?.[1] || ""; if (img && !img.startsWith("http")) img = `https://lightnovelworld.org${img}`; if (id && title) { results.push({ id, title, image: img, rating: null, format: "Light Novel" }); } } return results; } async getMetadata(id){ const res = await fetch(`https://lightnovelworld.org/novel/${id}`); const html = await res.text(); const match = html.match( /