UNPKG

rsshub

Version:
46 lines (45 loc) 1.39 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/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 res = await rofetch(url); const $ = load(res); 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 response = await rofetch(itemUrl); const $d = load(response); return { title, link: itemUrl, description: $d(".news_content_box .news_content").html(), pubDate }; }); })); return { title: $("title").text(), link: url, item: out }; } //#endregion export { route };