UNPKG

rsshub

Version:
51 lines (50 loc) 1.48 kB
import { t as parseDate } from "./parse-date-Cr0wQjV_.mjs"; import { t as got_default } from "./got-BTowW50G.mjs"; import { load } from "cheerio"; //#region lib/routes/cssn/iolaw.ts const route = { path: "/iolaw/:section?", categories: ["study"], example: "/cssn/iolaw/zxzp", parameters: { section: "Section ID, can be found in the URL. For example, the Section ID of URL `http://iolaw.cssn.cn/zxzp/` is `zxzp`. The default value is `zxzp`" }, features: { requireConfig: false, requirePuppeteer: false, antiCrawler: false, supportBT: false, supportPodcast: false, supportScihub: false }, name: "Institute of Law", maintainers: ["HankChow"], handler }; async function handler(ctx) { const section = ctx.req.param("section") ?? "zxzp"; const domain = "iolaw.cssn.cn"; const data = (await got_default(`http://${domain}/${section}/`)).data; const $ = load(data); const list = $("div.notice_right ul li").toArray().map((item) => { const $item = $(item); const url = `http://${domain}` + $item.find("a").attr("href").slice(1); return { title: $item.find("a div.title").text(), link: url, author: "中国法学网", pubtime: parseDate($item.find("a p").text()) }; }); return { title: "中国法学网", url: `http://${domain}/${section}/`, description: "中国法学网", item: list.map((item) => ({ title: item.title, pubDate: item.pubtime, link: item.link, author: item.author })) }; } //#endregion export { route };