rsshub
Version:
Make RSS Great Again!
45 lines (44 loc) • 1.33 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 { t as timezone } from "./timezone-DE--ze1V.mjs";
import { load } from "cheerio";
//#region lib/routes/grandwaylaw/index.ts
const route = {
path: "/",
categories: ["other"],
example: "/grandwaylaw",
radar: [{ source: ["www.grandwaylaw.com/guofengshijiao"] }],
name: "国枫视角",
maintainers: ["snipersteve"],
handler,
url: "www.grandwaylaw.com/guofengshijiao/"
};
async function handler() {
const baseUrl = "https://www.grandwaylaw.com";
const link = `${baseUrl}/guofengshijiao/`;
const $ = load(await rofetch(link));
const list = $("ul.hmNews li").toArray().map((item) => {
const a = $(item).find("a");
const date = a.find("span");
const pubDate = timezone(parseDate(date.text(), "YYYY.MM.DD"), 8);
date.remove();
return {
title: a.text(),
link: new URL(a.attr("href"), baseUrl).href,
pubDate
};
});
const out = await Promise.all(list.map((item) => cache_default.tryGet(item.link, async () => {
item.description = load(await rofetch(item.link))(".arCon").html()?.trim();
return item;
})));
return {
title: $("head title").text(),
link,
language: "zh",
item: out
};
}
//#endregion
export { route };