UNPKG

rsshub

Version:
43 lines (41 loc) 1.56 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 "./cache-Bo__VnGm.mjs"; import { t as timezone } from "./timezone-D8cuwzTY.mjs"; import { t as fetchArticle } from "./utils-VUOg2IcK.mjs"; //#region lib/routes/bjnews/column.ts const route = { path: "/column/:column", categories: ["traditional-media"], example: "/bjnews/column/204", parameters: { column: "栏目ID, 可从手机版网页URL中找到" }, features: {}, radar: [{ source: ["m.bjnews.com.cn/column/:column.htm"] }], name: "分类", maintainers: ["dzx-dzx"], handler, url: "www.bjnews.com.cn" }; async function handler(ctx) { const columnID = ctx.req.param("column"); const res = await ofetch_default(`https://api.bjnews.com.cn/api/v101/news/column_news.php?column_id=${columnID}`); const list = res.data.slice(0, ctx.req.query("limit") ? Number.parseInt(ctx.req.query("limit")) : 15).map((e) => ({ title: e.row.title, guid: e.uuid, pubDate: timezone(parseDate(e.row.publish_time), 8), updated: timezone(parseDate(e.row.update_time), 8), link: `https://www.bjnews.com.cn/detail/${e.uuid}.html` })); const out = await Promise.all(list.map((item) => fetchArticle(item))); return { title: `新京报 - 栏目 - ${res.data[0].row.column_info[0].column_name}`, link: `https://m.bjnews.com.cn/column/${columnID}.html`, item: out }; } //#endregion export { route };