UNPKG

rsshub

Version:
60 lines (58 loc) 1.95 kB
import "./dist-Bog6z_OM.mjs"; import "./config-MQ-7ebJ_.mjs"; import "./logger-C4avouvV.mjs"; import "./ofetch-DKl_Ma9g.mjs"; import "./parse-date-r5WDWHno.mjs"; import "./is-worker-DESPicPc.mjs"; import { t as cache_default } from "./cache-SV6W5EPy.mjs"; import "./helpers-Bo4JQYdN.mjs"; import { t as got_default } from "./got-CO-ndVl2.mjs"; import { n as parseArticle, t as baseUrl } from "./utils-BIwoRlYx.mjs"; import { load } from "cheerio"; //#region lib/routes/agirls/z-index.ts const route = { path: "/:category?", categories: ["new-media"], example: "/agirls/app", parameters: { category: "分类,默认为最新文章,可在对应主题页的 URL 中找到,下表仅列出部分" }, features: { requireConfig: false, requirePuppeteer: false, antiCrawler: false, supportBT: false, supportPodcast: false, supportScihub: false }, radar: [{ source: ["agirls.aotter.net/posts/:category"], target: "/:category" }], name: "分类", maintainers: ["TonyRL"], handler, description: `| App 评测 | 手机开箱 | 笔电开箱 | 3C 周边 | 教学小技巧 | 科技情报 | | -------- | -------- | -------- | ----------- | ---------- | -------- | | app | phone | computer | accessories | tutorial | techlife |` }; async function handler(ctx) { const { category = "" } = ctx.req.param(); const link = `${baseUrl}/posts${category ? `/${category}` : ""}`; const $ = load((await got_default(link)).data); const list = $(".ag-post-item__link").toArray().map((item) => { item = $(item); return { title: item.text().trim(), link: `${baseUrl}${item.attr("href")}` }; }); const items = await Promise.all(list.map((item) => cache_default.tryGet(item.link, () => parseArticle(item)))); return { title: $("head title").text().trim(), link, description: $("head meta[name=description]").attr("content"), item: items, language: $("html").attr("lang") }; } //#endregion export { route };