mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
fix: PNAS parameter & default value (#4258)
This commit is contained in:
@@ -4,13 +4,13 @@ const got = require('@/utils/got');
|
||||
module.exports = async (ctx) => {
|
||||
const baseUrl = `https://www.pnas.org`;
|
||||
|
||||
const tid = ctx.params.tid;
|
||||
const topic = ctx.params.topic;
|
||||
|
||||
let url = `${baseUrl}/content/early/recent`;
|
||||
if (tid !== 'latest') {
|
||||
url = `${baseUrl}/content/by/section/${ctx.params.tid}`;
|
||||
if (topic && topic !== 'latest') {
|
||||
url = `${baseUrl}/content/by/section/${ctx.params.topic}`;
|
||||
} else {
|
||||
ctx.params.tid = 'Latest Research';
|
||||
ctx.params.topic = 'Latest Research';
|
||||
}
|
||||
|
||||
const res = await got.get(url);
|
||||
@@ -59,7 +59,7 @@ module.exports = async (ctx) => {
|
||||
})
|
||||
);
|
||||
ctx.state.data = {
|
||||
title: `PNAS | ${ctx.params.tid}`,
|
||||
title: `PNAS | ${ctx.params.topic}`,
|
||||
link: url,
|
||||
item: out,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user