UNPKG

rsshub

Version:
43 lines (42 loc) 1.31 kB
import { t as rofetch } from "./ofetch-U0CdpE2g.mjs"; import { t as parseDate } from "./parse-date-3kcy2Eau.mjs"; import { t as cache_default } from "./cache-C1Y-9qDV.mjs"; import { t as timezone } from "./timezone-UiMFOuvL.mjs"; import { load } from "cheerio"; //#region lib/routes/noi/winners-list.ts const route = { path: "/winners-list", categories: ["other"], example: "/noi/winners-list", name: "获奖名单", maintainers: ["WenryXu"], handler }; async function handler() { const response = await rofetch("https://www.noi.cn/hjmd/mdgs/"); const $ = load(response); const postList = $(".news-all .news-item").toArray(); return { title: "获奖名单 - NOI 全国青少年信息学奥林匹克竞赛", link: "https://www.noi.cn/hjmd/mdgs/", item: await Promise.all(postList.map((item) => { const $item = $(item); const title = $item.find("a").text(); const link = "https://www.noi.cn" + $item.find("a").attr("href"); const pubDate = timezone(parseDate($item.find("small").text()), 8); return cache_default.tryGet(link, async () => { const detail = await rofetch(link); const $detail = load(detail); return { title, link, guid: link, pubDate, description: $detail(".news-cont").html() }; }); })) }; } //#endregion export { route };