mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-01 14:57:14 +08:00
fix(route): nikkei route paths (#15684)
This commit is contained in:
@@ -8,15 +8,6 @@ export const route: Route = {
|
||||
path: '/asia',
|
||||
categories: ['traditional-media'],
|
||||
example: '/nikkei/asia',
|
||||
parameters: {},
|
||||
features: {
|
||||
requireConfig: false,
|
||||
requirePuppeteer: false,
|
||||
antiCrawler: false,
|
||||
supportBT: false,
|
||||
supportPodcast: false,
|
||||
supportScihub: false,
|
||||
},
|
||||
radar: [
|
||||
{
|
||||
source: ['asia.nikkei.com/'],
|
||||
@@ -25,7 +16,7 @@ export const route: Route = {
|
||||
name: 'Nikkei Asia Latest News',
|
||||
maintainers: ['rainrdx'],
|
||||
handler,
|
||||
url: 'asia.nikkei.com/',
|
||||
url: 'asia.nikkei.com',
|
||||
};
|
||||
|
||||
async function handler() {
|
||||
|
||||
@@ -9,9 +9,45 @@ import parser from '@/utils/rss-parser';
|
||||
|
||||
export const route: Route = {
|
||||
path: '/cn/*',
|
||||
name: 'Unknown',
|
||||
maintainers: [],
|
||||
name: '中文版新闻',
|
||||
example: '/nikkei/cn',
|
||||
maintainers: ['nczitzk'],
|
||||
handler,
|
||||
description: `::: tip
|
||||
如 [中国 经济 日经中文网](https://cn.nikkei.com/china/ceconomy.html) 的 URL 为 \`https://cn.nikkei.com/china/ceconomy.html\` 对应路由为 [\`/nikkei/cn/cn/china/ceconomy\`](https://rsshub.app/nikkei/cn/cn/china/ceconomy)
|
||||
|
||||
如 [中國 經濟 日經中文網](https://zh.cn.nikkei.com/china/ceconomy.html) 的 URL 为 \`https://zh.cn.nikkei.com/china/ceconomy.html\` 对应路由为 [\`/nikkei/cn/zh/china/ceconomy\`](https://rsshub.app/nikkei/cn/zh/china/ceconomy)
|
||||
|
||||
特别地,当 \`path\` 填入 \`rss\` 后(如路由为 [\`/nikkei/cn/cn/rss\`](https://rsshub.app/nikkei/cn/cn/rss)),此时返回的是 [官方 RSS 的内容](https://cn.nikkei.com/rss.html)
|
||||
:::`,
|
||||
radar: [
|
||||
{
|
||||
title: '中文版新闻',
|
||||
source: ['cn.nikkei.com/:category/:type', 'cn.nikkei.com/:category', 'cn.nikkei.com/'],
|
||||
target: (params) => {
|
||||
if (params.category && params.type) {
|
||||
return `/nikkei/cn/cn/${params.category}/${params.type.replace('.html', '')}`;
|
||||
} else if (params.category && !params.type) {
|
||||
return `/nikkei/cn/cn/${params.category.replace('.html', '')}`;
|
||||
} else {
|
||||
return `/nikkei/cn/cn`;
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '中文版新聞',
|
||||
source: ['zh.cn.nikkei.com/:category/:type', 'zh.cn.nikkei.com/:category', 'zh.cn.nikkei.com/'],
|
||||
target: (params) => {
|
||||
if (params.category && params.type) {
|
||||
return `/nikkei/cn/zh/${params.category}/${params.type.replace('.html', '')}`;
|
||||
} else if (params.category && !params.type) {
|
||||
return `/nikkei/cn/zh/${params.category.replace('.html', '')}`;
|
||||
} else {
|
||||
return `/nikkei/cn/zh`;
|
||||
}
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
async function handler(ctx) {
|
||||
@@ -40,7 +76,7 @@ async function handler(ctx) {
|
||||
officialFeed = await parser.parseURL(currentUrl);
|
||||
items = officialFeed.items.slice(0, limit).map((item) => ({
|
||||
title: item.title,
|
||||
link: new URL(item.attr('href'), rootUrl).href,
|
||||
link: new URL(item.link, rootUrl).href,
|
||||
}));
|
||||
} else {
|
||||
const response = await got({
|
||||
|
||||
@@ -3,11 +3,12 @@ import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
|
||||
export const route: Route = {
|
||||
path: ['/', '/index'],
|
||||
name: 'Unknown',
|
||||
maintainers: [],
|
||||
path: '/index',
|
||||
name: 'Home',
|
||||
example: '/nikkei/index',
|
||||
maintainers: ['zjysdhr'],
|
||||
handler,
|
||||
url: 'www.nikkei.com/',
|
||||
url: 'www.nikkei.com',
|
||||
};
|
||||
|
||||
async function handler() {
|
||||
|
||||
@@ -2,5 +2,5 @@ import type { Namespace } from '@/types';
|
||||
|
||||
export const namespace: Namespace = {
|
||||
name: 'The Nikkei 日本経済新聞',
|
||||
url: 'asia.nikkei.com',
|
||||
url: 'nikkei.com',
|
||||
};
|
||||
|
||||
@@ -10,9 +10,9 @@ import { art } from '@/utils/render';
|
||||
import path from 'node:path';
|
||||
|
||||
export const route: Route = {
|
||||
path: '/:category/:article_type?',
|
||||
path: '/news/:category/:article_type?',
|
||||
categories: ['traditional-media'],
|
||||
example: '/nikkei/news',
|
||||
example: '/nikkei/news/news',
|
||||
parameters: { category: 'Category, see table below', article_type: 'Only includes free articles, set `free` to enable, disabled by default' },
|
||||
radar: [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user