rsshub
Version:
Make RSS Great Again!
44 lines (43 loc) • 1.34 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/allbrightlaw/index.ts
const route = {
path: "/",
categories: ["other"],
example: "/allbrightlaw",
name: "锦天城",
maintainers: ["snipersteve"],
handler
};
async function handler() {
const url = "https://www.allbrightlaw.com/CN/10475.aspx";
const oriUrl = "https://www.allbrightlaw.com";
const $ = load(await rofetch(url));
const list = $(".news_list_img ul li").toArray();
const out = await Promise.all(list.map((item) => {
const $item = $(item);
const title = $item.find(".news_txt h2").html() ?? "";
const subUrl = $item.find("a").attr("href");
const itemUrl = oriUrl + subUrl;
const pubDate = timezone(parseDate(`${$item.find(".news_data span").text()}-${$item.find(".news_data p").text()}`), 8);
return cache_default.tryGet(itemUrl, async () => {
const $d = load(await rofetch(itemUrl));
return {
title,
link: itemUrl,
description: $d(".news_content_box .news_content").html(),
pubDate
};
});
}));
return {
title: $("title").text(),
link: url,
item: out
};
}
//#endregion
export { route };