diff --git a/lib/routes/zaobao/interactive.ts b/lib/routes/zaobao/interactive.ts index 2cc01cd62..e2b3a624c 100644 --- a/lib/routes/zaobao/interactive.ts +++ b/lib/routes/zaobao/interactive.ts @@ -6,27 +6,18 @@ export const route: Route = { path: '/interactive-graphics', categories: ['traditional-media'], example: '/zaobao/interactive-graphics', - parameters: {}, - features: { - requireConfig: false, - requirePuppeteer: false, - antiCrawler: false, - supportBT: false, - supportPodcast: false, - supportScihub: false, - }, name: '互动新闻', maintainers: ['shunf4'], handler, }; async function handler(ctx) { - const sectionLink = `/interactive-graphics`; + const sectionLink = '/interactive-graphics'; const { resultList } = await parseList(ctx, sectionLink); return { - title: `《联合早报》互动新闻`, + title: '《联合早报》互动新闻', link: baseUrl + sectionLink, description: '新加坡、中国、亚洲和国际的即时、评论、商业、体育、生活、科技与多媒体新闻,尽在联合早报。', item: resultList, diff --git a/lib/routes/zaobao/index.ts b/lib/routes/zaobao/other.ts similarity index 82% rename from lib/routes/zaobao/index.ts rename to lib/routes/zaobao/other.ts index e7a7bc6d6..5bd482d43 100644 --- a/lib/routes/zaobao/index.ts +++ b/lib/routes/zaobao/other.ts @@ -3,18 +3,10 @@ import { parseList } from './util'; const baseUrl = 'https://www.zaobao.com'; export const route: Route = { - path: '/:type?/:section?', + path: '/other/:type?/:section?', categories: ['traditional-media'], - example: '/zaobao/lifestyle/health', + example: '/zaobao/other/lifestyle/health', parameters: { type: 'https://www.zaobao.com/**lifestyle**/health 中的 **lifestyle**', section: 'https://www.zaobao.com/lifestyle/**health** 中的 **health**' }, - features: { - requireConfig: false, - requirePuppeteer: false, - antiCrawler: false, - supportBT: false, - supportPodcast: false, - supportScihub: false, - }, name: '其他栏目', maintainers: ['shunf4'], handler, diff --git a/lib/routes/zaobao/realtime.ts b/lib/routes/zaobao/realtime.ts index 2402f4087..ef108de7b 100644 --- a/lib/routes/zaobao/realtime.ts +++ b/lib/routes/zaobao/realtime.ts @@ -7,14 +7,6 @@ export const route: Route = { categories: ['traditional-media'], example: '/zaobao/realtime/china', parameters: { section: '分类,缺省为 china' }, - features: { - requireConfig: false, - requirePuppeteer: false, - antiCrawler: false, - supportBT: false, - supportPodcast: false, - supportScihub: false, - }, name: '即时新闻', maintainers: ['shunf4'], handler, diff --git a/lib/routes/zaobao/util.ts b/lib/routes/zaobao/util.ts index 8bd5a2a40..4beab5d7d 100644 --- a/lib/routes/zaobao/util.ts +++ b/lib/routes/zaobao/util.ts @@ -22,16 +22,20 @@ const got_ins = got.extend({ * * @param {*} ctx RSSHub 的 ctx 参数,用来设置缓存 * @param {string} sectionUrl 形如 /realtime/china 的字符串 - * @returns {Promise<{ - * title: string; - * resultList: { - * title: string; - * description: string; - * pubDate: string; - * link: string; - * }[];}>} 新闻标题以及新闻列表 + * @returns 新闻标题以及新闻列表 */ -const parseList = async (ctx, sectionUrl) => { +const parseList = async ( + ctx, + sectionUrl: string +): Promise<{ + title: string; + resultList: { + title: string; + description: string; + pubDate: string; + link: string; + }[]; +}> => { const response = await got_ins.get(baseUrl + sectionUrl); const $ = load(response.data); let data = $('.article-list').find('.article-type');