fix(route): zaobao (#15685)
This commit is contained in:
parent
249cedc0d4
commit
41e8bcded8
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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');
|
||||
|
|
|
|||
Loading…
Reference in New Issue