UNPKG

rsshub

Version:
40 lines (39 loc) 1.03 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/glo/index.ts const route = { path: "/", categories: ["other"], example: "/glo", name: "环球", maintainers: ["snipersteve"], handler }; async function handler() { const url = "https://www.glo.com.cn/insights/prespectives/"; const res = await rofetch(url); const $ = load(res); const list = $(".news_listul li").toArray(); const out = await Promise.all(list.map((item) => { const $item = $(item); const title = $item.find("a .newstit").text(); const itemUrl = "http://www.glo.com.cn/" + $item.find("a").attr("href"); return cache_default.tryGet(itemUrl, async () => { const response = await rofetch(itemUrl); const $d = load(response); return { title, link: itemUrl, description: $d(".editor_con").html() }; }); })); return { title: $("title").text(), link: url, item: out }; } //#endregion export { route };