UNPKG

rsshub

Version:
56 lines (54 loc) 1.39 kB
import "./esm-shims-CzJ_djXG.mjs"; import "./config-C37vj7VH.mjs"; import "./dist-BInvbO1W.mjs"; import "./logger-Czu8UMNd.mjs"; import "./ofetch-BIyrKU3Y.mjs"; import { t as parseDate } from "./parse-date-BrP7mxXf.mjs"; import "./helpers-DxBp0Pty.mjs"; import { t as got_default } from "./got-KxxWdaxq.mjs"; import { load } from "cheerio"; //#region lib/routes/guangzhoumetro/news.ts const route = { path: "/news", categories: ["travel"], example: "/guangzhoumetro/news", parameters: {}, features: { requireConfig: false, requirePuppeteer: false, antiCrawler: false, supportBT: false, supportPodcast: false, supportScihub: false }, name: "新闻", maintainers: ["HankChow"], handler }; async function handler() { const newsUrl = "https://www.gzmtr.com/ygwm/xwzx/gsxw/"; const data = (await got_default(newsUrl)).data; const $ = load(data); return { title: "广州地铁新闻", url: newsUrl, description: "广州地铁新闻", item: $("ul.ag_h_w li").toArray().map((item) => { item = $(item); const url = newsUrl + item.find("a").attr("href").slice(2); return { title: item.find("a").text(), link: url, author: "广州地铁", pubtime: parseDate(item.find("span").text()) }; }).map((item) => ({ title: item.title, pubDate: item.pubtime, link: item.link, author: item.author })) }; } //#endregion export { route };