UNPKG

rsshub

Version:
53 lines (51 loc) 1.47 kB
import "./esm-shims-CzJ_djXG.mjs"; import "./config-C37vj7VH.mjs"; import "./dist-BInvbO1W.mjs"; import "./logger-Czu8UMNd.mjs"; import { t as ofetch_default } from "./ofetch-BIyrKU3Y.mjs"; import { t as parseDate } from "./parse-date-BrP7mxXf.mjs"; import { load } from "cheerio"; //#region lib/routes/anime1/search.ts const route = { path: "search/:keyword", name: "Search", url: "anime1.me", maintainers: ["cxheng315"], example: "/anime1/search/神之塔", categories: ["anime"], parameters: { keyword: "Anime1 Search Keyword" }, features: { requireConfig: false, requirePuppeteer: false, antiCrawler: false, supportBT: false, supportPodcast: false, supportScihub: false }, handler }; async function handler(ctx) { const { keyword } = ctx.req.param(); const $ = load(await ofetch_default(`https://anime1.me/?s=${keyword}`)); const title = $("page-title").text().trim(); const items = $("article.type-post").toArray().map((el) => { const $el = $(el); const title$1 = $el.find(".entry-title a").text().trim(); return { title: title$1, link: $el.find(".entry-title a").attr("href"), description: title$1, pubDate: parseDate($el.find("time").attr("datetime") || "") }; }); return { title, link: `https://anime1.me/?s=${keyword}`, description: title, itunes_author: "Anime1", itunes_image: "https://anime1.me/wp-content/uploads/2021/02/cropped-1-180x180.png", item: items }; } //#endregion export { route };