rsshub
Version:
Make RSS Great Again!
59 lines (57 loc) • 1.65 kB
JavaScript
import "./esm-shims-CzJ_djXG.mjs";
import "./config-C37vj7VH.mjs";
import "./dist-BInvbO1W.mjs";
import "./logger-Czu8UMNd.mjs";
import "./ofetch-BIyrKU3Y.mjs";
import "./parse-date-BrP7mxXf.mjs";
import "./cache-Bo__VnGm.mjs";
import "./timezone-D8cuwzTY.mjs";
import { n as parseList, t as logo } from "./util-DeItiRMP.mjs";
//#region lib/routes/zaobao/realtime.ts
const baseUrl = "https://www.zaobao.com";
const route = {
path: "/realtime/:section?",
categories: ["traditional-media"],
example: "/zaobao/realtime/china",
parameters: { section: "分类,缺省为 china" },
name: "即时新闻",
maintainers: ["shunf4"],
handler,
description: `| 中国 | 新加坡 | 国际 | 财经 |
| ----- | --------- | ----- | -------- |
| china | singapore | world | zfinance |`
};
async function handler(ctx) {
const section = ctx.req.param("section") ?? "china";
let name;
let sectionLink;
switch (section) {
case "singapore":
name = "新加坡";
sectionLink = "/realtime/singapore";
break;
case "world":
name = "国际";
sectionLink = "/realtime/world";
break;
case "zfinance":
name = "财经";
sectionLink = "/finance/realtime";
break;
case "china":
default:
name = "中港台";
sectionLink = "/realtime/china";
break;
}
const { resultList } = await parseList(sectionLink);
return {
title: `《联合早报》-${name}-即时`,
link: baseUrl + sectionLink,
description: "新加坡、中国、亚洲和国际的即时、评论、商业、体育、生活、科技与多媒体新闻,尽在联合早报。",
image: logo,
item: resultList
};
}
//#endregion
export { route };