UNPKG

rsshub

Version:
42 lines (41 loc) 1.13 kB
import { t as rofetch } from "./ofetch-U0CdpE2g.mjs"; import { t as cache_default } from "./cache-C1Y-9qDV.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 res = await rofetch(url); const $ = load(res); 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 response = await rofetch(itemUrl); const $d = load(response); return { title, link: itemUrl, description: $d(".col-sm-9 .news_page_content").html() }; }); })); return { title: $("title").text(), link: url, item: out }; } //#endregion export { route };