UNPKG

rsshub

Version:
58 lines (56 loc) 2.3 kB
import { n as init_esm_shims, t as __dirname } from "./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 { t as cache_default } from "./cache-Bo__VnGm.mjs"; import "./helpers-DxBp0Pty.mjs"; import { t as art } from "./render-BQo6B4tL.mjs"; import { t as got_default } from "./got-KxxWdaxq.mjs"; import { t as timezone } from "./timezone-D8cuwzTY.mjs"; import { t as parseArticle } from "./utils-Cbanztfr.mjs"; import path from "node:path"; //#region lib/routes/southcn/nfapp/reporter.ts init_esm_shims(); const route = { path: "/nfapp/reporter/:reporter", categories: ["traditional-media"], example: "/southcn/nfapp/reporter/969927791", parameters: { reporter: "作者 UUID" }, features: { requireConfig: false, requirePuppeteer: false, antiCrawler: false, supportBT: false, supportPodcast: false, supportScihub: false }, name: "南方 +(按作者)", maintainers: ["TimWu007"], handler, description: `作者的 UUID 只可通过 \`static.nfapp.southcn.com\` 下的文章页面获取。点击文章下方的作者介绍,进入该作者的个人主页,即可从 url 中获取。` }; async function handler(ctx) { const reporterId = ctx.req.param("reporter"); const { data: response } = await got_default(`https://api.nfapp.southcn.com/nanfang_if/reporter/list?reporterUuid=${reporterId}&pageSize=20&pageNo=1&origin=0`); const list = response.data.reportInfo.articleInfo.map((item) => ({ title: "【" + item.releaseColName + "】" + item.title, description: art(path.join(__dirname, "templates/description-1db04849.art"), { thumb: item.picMiddle, description: item.attAbstract }), pubDate: timezone(parseDate(item.publishtime), 8), link: `http://pc.nfapp.southcn.com/${item.colID}/${item.fileId}.html`, articleId: item.fileId, shareUrl: item.shareUrl })); const items = await Promise.all(list.map((item) => parseArticle(item, cache_default.tryGet))); return { title: `南方+ - ${response.data.reportInfo.reporterName}`, link: `https://static.nfapp.southcn.com/apptpl/reporterWorksList/index.html?reporterUuid=${reporterId}`, item: items }; } //#endregion export { route };