From 98e493921ed976844a8cbe91672841235fade33d Mon Sep 17 00:00:00 2001 From: Marisa <125703711+nashi23@users.noreply.github.com> Date: Sat, 6 Apr 2024 19:31:53 +0800 Subject: [PATCH] fix(route): huanqiu (#15107) (#15115) * fix(route): huanqiu (#15107) * fix(route): huanqiu (fix import) * Update lib/routes/huanqiu/index.ts Co-authored-by: Tony * Update lib/routes/huanqiu/index.ts Co-authored-by: Tony * Update lib/routes/huanqiu/index.ts Co-authored-by: Tony --------- --- lib/routes/huanqiu/index.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/routes/huanqiu/index.ts b/lib/routes/huanqiu/index.ts index 8696ecdd40c640..a59014961b048b 100644 --- a/lib/routes/huanqiu/index.ts +++ b/lib/routes/huanqiu/index.ts @@ -54,18 +54,19 @@ async function handler(ctx) { const resp = await got({ method: 'get', url: `${host}/api/channel_pc`, - }).json(); - const name = getKeysRecursive(resp.children, 'children', 'domain_name', [])[0]; + }); - const nodes = getKeysRecursive(resp.children, 'children', 'node', []) + const name = getKeysRecursive(resp.data.children, 'children', 'domain_name', [])[0]; + + const nodes = getKeysRecursive(resp.data.children, 'children', 'node', []) .map((x) => `"${x}"`) .join(','); const req = await got({ method: 'get', url: `${host}/api/list?node=${nodes}&offset=0&limit=${ctx.req.query('limit') ?? 20}`, - }).json(); + }); - let items = req.list + let items = req.data.list .filter((item) => item.aid) .map((item) => ({ link: `${host}/article/${item.aid}`,