UNPKG

rsshub

Version:
37 lines (36 loc) 1.15 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 { load } from "cheerio"; //#region lib/routes/digitaling/index.ts const route = { path: "/index", categories: ["new-media"], example: "/digitaling/index", name: "数英网最新文章", maintainers: ["occupy5"], handler }; async function handler() { const link = "https://www.digitaling.com"; const res = await rofetch(link); const $ = load(res); const list = $("#home_latest li h3").find("a").toArray().map((e) => $(e).attr("href")); return { title: "数英网-最新文章", link, item: await Promise.all(list.map((itemUrl) => cache_default.tryGet(itemUrl, async () => { const res = await rofetch(itemUrl); const $ = load(res); return { title: $(".article_title h1, .project_title h1").text(), author: $("#avatar_by").parent().find("h3 a").text(), link: itemUrl, description: $("#article_con").html(), pubDate: parseDate($("#edit_url").parent().children().last().text()) }; }))) }; } //#endregion export { route };