diff --git a/docs/new-media.md b/docs/new-media.md index 4925fd987..82f88d574 100644 --- a/docs/new-media.md +++ b/docs/new-media.md @@ -965,22 +965,22 @@ IPFS 网关有可能失效,那时候换成其他网关。 -| DAO | 元宇宙 | DeFi | Layer 2 | 链游 | 波卡 | NFT | 央行数字货币 | 融资 | 活动 | 监管 | -| --- | --- | ---- | ------- | -- | -- | --- | ------ | -- | -- | -- | +| 精选 | 链游 | 元宇宙 | NFT | DeFi | 监管 | 央行数字货币 | 波卡 | Layer 2 | DAO | 融资 | 活动 | +| -- | -- | --- | --- | ---- | -- | ------ | -- | ------- | --- | -- | -- | ### 快讯 - + ### 专栏 - + ### 专题 - + ## PMCAFF diff --git a/lib/v2/panewslab/column.js b/lib/v2/panewslab/author.js similarity index 55% rename from lib/v2/panewslab/column.js rename to lib/v2/panewslab/author.js index 5105e4f29..e5608461a 100644 --- a/lib/v2/panewslab/column.js +++ b/lib/v2/panewslab/author.js @@ -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: `
${item.remark}
`, - 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: `
${item.desc}
`, + 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, }; diff --git a/lib/v2/panewslab/index.js b/lib/v2/panewslab/index.js index 6afee6da6..0e8d52aa5 100644 --- a/lib/v2/panewslab/index.js +++ b/lib/v2/panewslab/index.js @@ -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: `
${item.remark}
`, - category: item.tags.split(','), + description: `
${item.desc}
`, + 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, }; diff --git a/lib/v2/panewslab/maintainer.js b/lib/v2/panewslab/maintainer.js index e97866430..06cba6d62 100644 --- a/lib/v2/panewslab/maintainer.js +++ b/lib/v2/panewslab/maintainer.js @@ -1,6 +1,8 @@ module.exports = { + '/author/:id': ['nczitzk'], '/column/:id': ['nczitzk'], - '/newsflash/:language?': ['nczitzk'], + '/news': ['nczitzk'], + '/newsflash': ['nczitzk'], '/topic/:id': ['nczitzk'], '/:category?': ['nczitzk'], }; diff --git a/lib/v2/panewslab/news.js b/lib/v2/panewslab/news.js new file mode 100644 index 000000000..25e00d13f --- /dev/null +++ b/lib/v2/panewslab/news.js @@ -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: `

${item.desc.replace(/\r\n原文链接/g, '')}

`, + category: item.tags, + })); + + ctx.state.data = { + title: 'PANews - 快讯', + link: currentUrl, + item: items, + }; +}; diff --git a/lib/v2/panewslab/newsflash.js b/lib/v2/panewslab/newsflash.js deleted file mode 100644 index 404262b9a..000000000 --- a/lib/v2/panewslab/newsflash.js +++ /dev/null @@ -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: `

${item.content.replace(/来源链接$/, '').replace(/原文链接$/, '')}

`, - })); - - ctx.state.data = { - title: 'PANews - 快讯', - link: currentUrl, - item: items, - }; -}; diff --git a/lib/v2/panewslab/radar.js b/lib/v2/panewslab/radar.js index 12d1fe4df..46cfa95ea 100644 --- a/lib/v2/panewslab/radar.js +++ b/lib/v2/panewslab/radar.js @@ -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: '专题', diff --git a/lib/v2/panewslab/router.js b/lib/v2/panewslab/router.js index f4a36673d..32b02864b 100644 --- a/lib/v2/panewslab/router.js +++ b/lib/v2/panewslab/router.js @@ -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')); }; diff --git a/lib/v2/panewslab/topic.js b/lib/v2/panewslab/topic.js index dab1565c8..a35c73ac7 100644 --- a/lib/v2/panewslab/topic.js +++ b/lib/v2/panewslab/topic.js @@ -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: `
${item.remark}
`, - category: item.tags.split(','), + description: `
${item.desc}
`, + category: item.tags, })); items = await Promise.all(