Skip to content

Commit

Permalink
fix(route): huanqiu (#14304)
Browse files Browse the repository at this point in the history
  • Loading branch information
TonyRL authored Jan 22, 2024
1 parent f965e0b commit 89788a6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/v2/huanqiu/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,26 @@ module.exports = async (ctx) => {
throw new Error('Invalid category');
}

const host = 'https://' + category + '.huanqiu.com';
const host = `https://${category}.huanqiu.com`;

const resp = await got({
method: 'get',
url: [...host, '/api/channel_pc'],
url: `${host}/api/channel_pc`,
}).json();
const name = getKeysRecursive(resp.children, 'children', 'domain_name', [])[0];

const nodes = getKeysRecursive(resp.children, 'children', 'node', [])
.map((x) => '"' + x + '"')
.map((x) => `"${x}"`)
.join(',');
const req = await got({
method: 'get',
url: [...host, '/api/list?node='] + nodes + `&offset=0&limit=${ctx.query.limit ?? 20}`,
url: `${host}/api/list?node=${nodes}&offset=0&limit=${ctx.query.limit ?? 20}`,
}).json();

let items = req.list
.filter((item) => item.aid)
.map((item) => ({
link: host + '/article/' + item.aid,
link: `${host}/article/${item.aid}`,
title: item.title,
}));

Expand Down

0 comments on commit 89788a6

Please sign in to comment.