rsshub
Version:
Make RSS Great Again!
35 lines (34 loc) • 1.11 kB
JavaScript
import { t as rofetch } from "./ofetch-W1aeTHCo.mjs";
import { t as parseDate } from "./parse-date-CjhZE69i.mjs";
import { t as cache_default } from "./cache-CiDoUSLo.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 $ = load(await rofetch(link));
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 $ = load(await rofetch(itemUrl));
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 };