UNPKG

rsshub

Version:
54 lines (52 loc) 1.38 kB
import "./esm-shims-CzJ_djXG.mjs"; import "./config-C37vj7VH.mjs"; import "./dist-BInvbO1W.mjs"; import "./logger-Czu8UMNd.mjs"; import "./ofetch-BIyrKU3Y.mjs"; import { t as parseDate } from "./parse-date-BrP7mxXf.mjs"; import "./helpers-DxBp0Pty.mjs"; import { t as got_default } from "./got-KxxWdaxq.mjs"; //#region lib/routes/wfdf/news.ts const route = { path: "/news", categories: ["other"], example: "/wfdf/news", parameters: {}, features: { requireConfig: false, requirePuppeteer: false, antiCrawler: false, supportBT: false, supportPodcast: false, supportScihub: false }, radar: [{ source: ["wfdf.sport/news/", "wfdf.sport/"] }], name: "News", maintainers: ["HankChow"], handler, url: "wfdf.sport/news/" }; async function handler(ctx) { const baseUrl = "https://wfdf.sport"; const { data: response } = await got_default(`${baseUrl}/wp-json/wp/v2/posts`, { searchParams: { per_page: ctx.req.query("limit") ?? 100, _embed: 1 } }); const items = response.map((item) => ({ title: item.title.rendered, link: item.link, guid: item.guid.rendered, description: item.content.rendered, pubDate: parseDate(item.date_gmt), author: item._embedded.author[0].name })); return { title: "WFDF News", link: `${baseUrl}/news/`, image: `${baseUrl}/favicon.ico`, description: "WFDF 新闻", item: items }; } //#endregion export { route };