UNPKG

rsshub

Version:
86 lines (84 loc) 2.8 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"; import { t as timezone } from "./timezone-D8cuwzTY.mjs"; import queryString from "query-string"; //#region lib/routes/nju/jw.ts const route = { path: "/jw/:type", categories: ["university"], example: "/nju/jw/ggtz", parameters: { type: "分类名" }, features: { requireConfig: false, requirePuppeteer: false, antiCrawler: false, supportBT: false, supportPodcast: false, supportScihub: false }, radar: [{ source: ["jw.nju.edu.cn/:type/list.htm"] }], name: "本科生院", maintainers: ["cqjjjzr"], handler, description: `| 公告通知 | 教学动态 | | -------- | -------- | | ggtz | jxdt |` }; async function handler(ctx) { const type = ctx.req.param("type"); const type_dict = { ggtz: [ 26263, "公告通知", "[{\"field\":\"top\",\"type\":\"desc\"},{\"field\":\"new\",\"type\":\"desc\"},{\"field\":\"publishTime\",\"type\":\"desc\"}]", "[{\"field\":\"title\",\"name\":\"title\"},{\"field\":\"f1\",\"name\":\"f1\"},{\"field\":\"publishTime\",\"pattern\":[{\"name\":\"d\",\"value\":\"yyyy-MM-dd HH:mm:ss\"}],\"name\":\"publishTime\"},{\"field\":\"link\",\"name\":\"link\"}]", "https://jw.nju.edu.cn/ggtz/list.htm" ], jxdt: [ 24774, "教学动态", "[{\"field\":\"top\",\"type\":\"desc\"},{\"field\":\"new\",\"type\":\"desc\"},{\"field\":\"publishTime\",\"type\":\"desc\"}]", "[{\"field\":\"title\",\"name\":\"title\"},{\"field\":\"publishTime\",\"pattern\":[{\"name\":\"d\",\"value\":\"yyyy-MM-dd HH:mm:ss\"}],\"name\":\"publishTime\"},{\"field\":\"link\",\"name\":\"link\"}]", "https://jw.nju.edu.cn/_s414/24774/list.psp" ] }; const { data } = await got_default({ method: "post", url: "https://jw.nju.edu.cn/_wp3services/generalQuery?queryObj=articles", body: queryString.stringify({ siteId: 414, columnId: type_dict[type][0], pageIndex: 1, rows: 24, orders: type_dict[type][2], returnInfos: type_dict[type][3] }), headers: { Origin: "https://jw.nju.edu.cn", Referer: "https://jw.nju.edu.cn/main.htm", "Content-Type": "application/x-www-form-urlencoded" } }); return { title: `本科生院-${type_dict[type][1]}`, link: type_dict[type][4], item: data && data.data && data.data.map((item) => { const ret = { title: item.title, author: item.publisher, pubDate: timezone(parseDate(item.publishTime, "YYYY-MM-DD HH:mm:ss"), 8), link: item.url }; if (type === "ggtz") ret.category = item.f1; return ret; }) }; } //#endregion export { route };