diff --git a/lib/routes/apnews/topics.ts b/lib/routes/apnews/topics.ts index 5c693c712..df0ff5530 100644 --- a/lib/routes/apnews/topics.ts +++ b/lib/routes/apnews/topics.ts @@ -5,7 +5,7 @@ import { fetchArticle, removeDuplicateByKey } from './utils'; const HOME_PAGE = 'https://apnews.com'; export const route: Route = { - path: '/topics/:topic?', + path: ['/topics/:topic?', '/nav/:nav{.*}?'], categories: ['traditional-media', 'popular'], example: '/apnews/topics/apf-topnews', view: ViewType.Articles, @@ -35,8 +35,9 @@ export const route: Route = { }; async function handler(ctx) { - const { topic = 'trending-news' } = ctx.req.param(); - const url = `${HOME_PAGE}/hub/${topic}`; + const { topic = 'trending-news', nav = '' } = ctx.req.param(); + const useNav = ctx.req.routePath === '/apnews/nav/:nav{.*}?'; + const url = useNav ? `${HOME_PAGE}/${nav}` : `${HOME_PAGE}/hub/${topic}`; const response = await got(url); const $ = load(response.data);