rsshub
Version:
Make RSS Great Again!
38 lines (37 loc) • 981 B
JavaScript
import { t as rofetch } from "./ofetch-W1aeTHCo.mjs";
import { t as cache_default } from "./cache-CiDoUSLo.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 $ = load(await rofetch(url));
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 $d = load(await rofetch(itemUrl));
return {
title,
link: itemUrl,
description: $d(".editor_con").html()
};
});
}));
return {
title: $("title").text(),
link: url,
item: out
};
}
//#endregion
export { route };