UNPKG

rsshub

Version:
63 lines (61 loc) 1.81 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/zaozao/article.ts const route = { path: "/article/:type?", categories: ["programming"], example: "/zaozao/article/quality", parameters: { type: "文章分类" }, features: { requireConfig: false, requirePuppeteer: false, antiCrawler: false, supportBT: false, supportPodcast: false, supportScihub: false }, radar: [{ source: ["www.zaozao.run/article/:type"], target: "/article/:type" }], name: "文章", maintainers: ["shaomingbo"], handler, description: `| 精品推荐 | 技术干货 | 职场成长 | 社区动态 | 组件物料 | 行业动态 | | --------- | -------- | -------- | --------- | -------- | -------- | | recommend | quality | growth | community | material | industry |` }; async function handler(ctx) { const { type = "recommend" } = ctx.req.param(); const response = await got_default({ method: "put", url: `https://e.zaozao.run/article/page/${type}`, headers: { Referer: `https://www.zaozao.run/` }, body: JSON.stringify({ pageNo: 1, pageSize: 100 }) }); const { status, statusMessage } = response; if (status !== 200) throw new Error(statusMessage); const { data } = response.data; return { title: `前端早早聊 - 文章`, link: `https://www.zaozao.run/article/${type}`, description: `前端早早聊 - 文章`, item: data.map((item) => ({ title: item.title, link: item.url, author: item.recommenderName, pubDate: parseDate(item.updateAt) })) }; } //#endregion export { route };