fix(route): PANews (#9832)
* fix(route): PANews * fix(route): PANews author
This commit is contained in:
+5
-5
@@ -965,22 +965,22 @@ IPFS 网关有可能失效,那时候换成其他网关。
|
||||
|
||||
<Route author="nczitzk" example="/panewslab" path="/panewslab/:category?" :paramsDesc="['分类,见下表,默认为精选']">
|
||||
|
||||
| DAO | 元宇宙 | DeFi | Layer 2 | 链游 | 波卡 | NFT | 央行数字货币 | 融资 | 活动 | 监管 |
|
||||
| --- | --- | ---- | ------- | -- | -- | --- | ------ | -- | -- | -- |
|
||||
| 精选 | 链游 | 元宇宙 | NFT | DeFi | 监管 | 央行数字货币 | 波卡 | Layer 2 | DAO | 融资 | 活动 |
|
||||
| -- | -- | --- | --- | ---- | -- | ------ | -- | ------- | --- | -- | -- |
|
||||
|
||||
</Route>
|
||||
|
||||
### 快讯
|
||||
|
||||
<Route author="nczitzk" example="/panewslab/newsflash" path="/panewslab/newsflash/:language?" :paramsDesc="['语言,默认为 zh,可在地址栏 URL 中找到']"/>
|
||||
<Route author="nczitzk" example="/panewslab/news" path="/panewslab/news"/>
|
||||
|
||||
### 专栏
|
||||
|
||||
<Route author="nczitzk" example="/panewslab/column/N7042814" path="/panewslab/column/:id" :paramsDesc="['专栏 id,可在地址栏 URL 中找到']"/>
|
||||
<Route author="nczitzk" example="/panewslab/author/166" path="/panewslab/author/:id" :paramsDesc="['专栏 id,可在地址栏 URL 中找到']"/>
|
||||
|
||||
### 专题
|
||||
|
||||
<Route author="nczitzk" example="/panewslab/topic/1582623288184036" path="/panewslab/topic/:id" :paramsDesc="['专题 id,可在地址栏 URL 中找到']"/>
|
||||
<Route author="nczitzk" example="/panewslab/topic/1629365774078402" path="/panewslab/topic/:id" :paramsDesc="['专题 id,可在地址栏 URL 中找到']"/>
|
||||
|
||||
## PMCAFF
|
||||
|
||||
|
||||
@@ -6,34 +6,22 @@ module.exports = async (ctx) => {
|
||||
const id = ctx.params.id;
|
||||
|
||||
const rootUrl = 'https://panewslab.com';
|
||||
const apiUrl = `${rootUrl}/api/newstopic/page`;
|
||||
const apiUrl = `${rootUrl}/webapi/subject/articles?Rn=${ctx.query.limit ?? 25}&LId=1&tw=0&uid=${id}`;
|
||||
const currentUrl = `${rootUrl}/zh/author/${id}.html`;
|
||||
|
||||
let author = '';
|
||||
|
||||
const response = await got({
|
||||
method: 'post',
|
||||
method: 'get',
|
||||
url: apiUrl,
|
||||
form: {
|
||||
memberId: id,
|
||||
language: 'zh',
|
||||
pageIndex: 1,
|
||||
pageSize: 25,
|
||||
newsTopicState: 'PUBLISHED',
|
||||
},
|
||||
});
|
||||
|
||||
let items = response.data.data.list.map((item) => {
|
||||
author = item.nick_name;
|
||||
return {
|
||||
author,
|
||||
title: item.title,
|
||||
pubDate: parseDate(item.create_time),
|
||||
link: `${rootUrl}/zh/articledetails/${item.id}.html`,
|
||||
description: `<blockquote>${item.remark}</blockquote>`,
|
||||
category: item.tags.split(','),
|
||||
};
|
||||
});
|
||||
let items = response.data.data.map((item) => ({
|
||||
title: item.title,
|
||||
author: item.author.name,
|
||||
pubDate: parseDate(item.publishTime * 1000),
|
||||
link: `${rootUrl}/zh/articledetails/${item.id}.html`,
|
||||
description: `<blockquote>${item.desc}</blockquote>`,
|
||||
category: item.tags,
|
||||
}));
|
||||
|
||||
items = await Promise.all(
|
||||
items.map((item) =>
|
||||
@@ -53,7 +41,7 @@ module.exports = async (ctx) => {
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: `PANews - ${author}`,
|
||||
title: `PANews - ${items[0].author}`,
|
||||
link: currentUrl,
|
||||
item: items,
|
||||
};
|
||||
+24
-17
@@ -2,33 +2,40 @@ const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
|
||||
const categories = {
|
||||
精选: '',
|
||||
链游: 'aipysd',
|
||||
元宇宙: 'arxgdo',
|
||||
NFT: 'dwhfpp',
|
||||
DeFi: 'gsqjtg',
|
||||
监管: 'kohnph',
|
||||
央行数字货币: 'loskks',
|
||||
波卡: 'sxrabd',
|
||||
'Layer 2': 'tdkreq',
|
||||
DAO: 'yyufxg',
|
||||
融资: 'zahilv',
|
||||
活动: 'zqives',
|
||||
};
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const category = ctx.params.category ?? '';
|
||||
const category = ctx.params.category ?? '精选';
|
||||
|
||||
const rootUrl = 'https://panewslab.com';
|
||||
const apiUrl = `${rootUrl}/api/newstopic/page`;
|
||||
const apiUrl = `${rootUrl}/webapi/depth/list?LId=1&Rn=${ctx.query.limit ?? 25}&TagId=${categories[category]}&tw=0`;
|
||||
const currentUrl = `${rootUrl}/zh/profundity/index.html`;
|
||||
|
||||
const response = await got({
|
||||
method: 'post',
|
||||
method: 'get',
|
||||
url: apiUrl,
|
||||
form: {
|
||||
language: 'zh',
|
||||
pageIndex: 1,
|
||||
pageSize: 25,
|
||||
newsTopicState: 'PUBLISHED',
|
||||
isEssence: 'T',
|
||||
tags: category,
|
||||
},
|
||||
});
|
||||
|
||||
let items = response.data.data.list.map((item) => ({
|
||||
let items = response.data.data.map((item) => ({
|
||||
title: item.title,
|
||||
author: item.nick_name,
|
||||
pubDate: parseDate(item.create_time),
|
||||
author: item.author.name,
|
||||
pubDate: parseDate(item.publishTime * 1000),
|
||||
link: `${rootUrl}/zh/articledetails/${item.id}.html`,
|
||||
description: `<blockquote>${item.remark}</blockquote>`,
|
||||
category: item.tags.split(','),
|
||||
description: `<blockquote>${item.desc}</blockquote>`,
|
||||
category: item.tags,
|
||||
}));
|
||||
|
||||
items = await Promise.all(
|
||||
@@ -49,7 +56,7 @@ module.exports = async (ctx) => {
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: `PANews - ${category || '精选'}`,
|
||||
title: `PANews - ${category}`,
|
||||
link: currentUrl,
|
||||
item: items,
|
||||
};
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
module.exports = {
|
||||
'/author/:id': ['nczitzk'],
|
||||
'/column/:id': ['nczitzk'],
|
||||
'/newsflash/:language?': ['nczitzk'],
|
||||
'/news': ['nczitzk'],
|
||||
'/newsflash': ['nczitzk'],
|
||||
'/topic/:id': ['nczitzk'],
|
||||
'/:category?': ['nczitzk'],
|
||||
};
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
const got = require('@/utils/got');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const rootUrl = 'https://panewslab.com';
|
||||
const apiUrl = `${rootUrl}/webapi/flashnews?LId=1&Rn=${ctx.query.limit ?? 50}&tw=0`;
|
||||
const currentUrl = `${rootUrl}/zh/news/index.html`;
|
||||
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: apiUrl,
|
||||
});
|
||||
|
||||
const items = response.data.data.flashNews[0].list.map((item) => ({
|
||||
title: item.title,
|
||||
author: item.author.name,
|
||||
pubDate: parseDate(item.publishTime * 1000),
|
||||
link: `${rootUrl}/zh/articledetails/${item.id}.html`,
|
||||
description: `<p>${item.desc.replace(/\r\n原文链接/g, '')}</p>`,
|
||||
category: item.tags,
|
||||
}));
|
||||
|
||||
ctx.state.data = {
|
||||
title: 'PANews - 快讯',
|
||||
link: currentUrl,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
@@ -1,35 +0,0 @@
|
||||
const got = require('@/utils/got');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const language = ctx.params.language ?? 'zh';
|
||||
|
||||
const rootUrl = 'https://panewslab.com';
|
||||
const apiUrl = `${rootUrl}/api/sqtopic/pageBy`;
|
||||
const currentUrl = `${rootUrl}/${language}/news/index.html`;
|
||||
|
||||
const response = await got({
|
||||
method: 'post',
|
||||
url: apiUrl,
|
||||
form: {
|
||||
language,
|
||||
pageIndex: 1,
|
||||
pageSize: 50,
|
||||
topicState: 'PUBLISHED',
|
||||
},
|
||||
});
|
||||
|
||||
const items = response.data.data.list[0].data.map((item) => ({
|
||||
title: item.title,
|
||||
author: item.nick_name,
|
||||
pubDate: parseDate(item.create_time),
|
||||
link: `${rootUrl}/${language}/sqarticledetails/${item.id}.html`,
|
||||
description: `<p>${item.content.replace(/来源链接$/, '').replace(/原文链接$/, '')}</p>`,
|
||||
}));
|
||||
|
||||
ctx.state.data = {
|
||||
title: 'PANews - 快讯',
|
||||
link: currentUrl,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
@@ -12,13 +12,13 @@ module.exports = {
|
||||
title: '快讯',
|
||||
docs: 'https://docs.rsshub.app/new-media.html#panews-kuai-xun',
|
||||
source: '/',
|
||||
target: '/panewslab/newsflash/:language?',
|
||||
target: '/panewslab/news',
|
||||
},
|
||||
{
|
||||
title: '专栏',
|
||||
docs: 'https://docs.rsshub.app/new-media.html#panews-zhuan-lan',
|
||||
source: '/',
|
||||
target: '/panewslab/column/:id',
|
||||
target: '/panewslab/author/:id',
|
||||
},
|
||||
{
|
||||
title: '专题',
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
module.exports = function (router) {
|
||||
router.get('/column/:id', require('./column'));
|
||||
router.get('/newsflash/:language?', require('./newsflash'));
|
||||
router.get('/author/:id', require('./author'));
|
||||
router.get('/column/:id', require('./author'));
|
||||
router.get('/news', require('./news'));
|
||||
router.get('/newsflash', require('./news'));
|
||||
router.get('/topic/:id', require('./topic'));
|
||||
router.get('/:category?', require('./index'));
|
||||
};
|
||||
|
||||
@@ -6,28 +6,21 @@ module.exports = async (ctx) => {
|
||||
const id = ctx.params.id;
|
||||
|
||||
const rootUrl = 'https://panewslab.com';
|
||||
const apiUrl = `${rootUrl}/newstopic/pageH`;
|
||||
const apiUrl = `${rootUrl}/webapi/subject/articles?Rn=${ctx.query.limit ?? 25}&LId=1&sid=${id}&tw=0`;
|
||||
const currentUrl = `${rootUrl}/zh/topiclist/${id}.html`;
|
||||
|
||||
const response = await got({
|
||||
method: 'post',
|
||||
method: 'get',
|
||||
url: apiUrl,
|
||||
form: {
|
||||
language: 'zh',
|
||||
pageIndex: 1,
|
||||
pageSize: 25,
|
||||
newsThemeId: id,
|
||||
newsTopicState: 'PUBLISHED',
|
||||
},
|
||||
});
|
||||
|
||||
let items = response.data.data.list.map((item) => ({
|
||||
let items = response.data.data.map((item) => ({
|
||||
title: item.title,
|
||||
author: item.nick_name,
|
||||
pubDate: parseDate(item.create_time),
|
||||
author: item.author.name,
|
||||
pubDate: parseDate(item.publishTime * 1000),
|
||||
link: `${rootUrl}/zh/articledetails/${item.id}.html`,
|
||||
description: `<blockquote>${item.remark}</blockquote>`,
|
||||
category: item.tags.split(','),
|
||||
description: `<blockquote>${item.desc}</blockquote>`,
|
||||
category: item.tags,
|
||||
}));
|
||||
|
||||
items = await Promise.all(
|
||||
|
||||
Reference in New Issue
Block a user