UNPKG

rsshub

Version:
40 lines (39 loc) 1.08 kB
import { t as rofetch } from "./ofetch-W1aeTHCo.mjs"; import { t as cache_default } from "./cache-CiDoUSLo.mjs"; import { load } from "cheerio"; //#region lib/routes/jtn/index.ts const route = { path: "/", categories: ["other"], example: "/jtn", name: "金诚同达", maintainers: ["snipersteve"], handler }; async function handler() { const url = "https://jtn.com/CN/majorbook.aspx?Lan=CN&PageUrl=majorbook&MenuID=06001"; const oriUrl = "https://jtn.com/CN/"; const $ = load(await rofetch(url)); const list = $(".col-sm-9 .news_list").toArray(); const out = await Promise.all(list.map((item) => { const $item = $(item); const title = $item.find("a").html() ?? ""; const subUrl = $item.find("a").attr("href"); const itemUrl = oriUrl + subUrl; return cache_default.tryGet(itemUrl, async () => { const $d = load(await rofetch(itemUrl)); return { title, link: itemUrl, description: $d(".col-sm-9 .news_page_content").html() }; }); })); return { title: $("title").text(), link: url, item: out }; } //#endregion export { route };