Skip to content

Commit

Permalink
fix(route): fix xianbao typo and parse (#15148)
Browse files Browse the repository at this point in the history
  • Loading branch information
nashi23 authored Apr 8, 2024
1 parent 8757a93 commit 4e7f0c1
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions lib/routes/xianbao/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ export const route: Route = {
| 小嘀咕 | xiaodigu |
| 葫芦侠 | huluxia |
| 小刀娱乐网 | xiadao |
| 技术 QQ 网 | qqjishu |
| YYOK 大全 | yyok |
| 技术QQ网 | qqjishu |
| YYOK大全 | yyok |
| 活动资讯网 | huodong |
| 免费赚钱中心 | maifei |
| 免费赚钱中心 | mianfei |
| 一小时 | yixiaoshi |
| 三小时 | sanxiaoshi |
| 六小时 | liuxiaoshi |
Expand Down Expand Up @@ -84,7 +84,15 @@ async function handler(ctx) {
const response = await got(apiUrl);
const responseData = JSON.parse(response.body);

const items = responseData.map((item) => ({
let parsedData;
if (Array.isArray(responseData)) {
parsedData = responseData;
} else {
const hotKey = Object.keys(responseData).find((key) => key.startsWith('remen'));
parsedData = responseData[hotKey];
}

const items = parsedData.map((item) => ({
title: item.title,
link: `http://new.xianbao.fun${item.url}`,
description: item.content,
Expand Down Expand Up @@ -130,5 +138,5 @@ const CATEGORIES = [
{ id: 'qqjishu', fullName: '技术QQ网', pushPath: 'push_6' },
{ id: 'yyok', fullName: 'YYOK大全', pushPath: 'push_7' },
{ id: 'huodong', fullName: '活动资讯网', pushPath: 'push_8' },
{ id: 'maifei', fullName: '免费赚钱中心', pushPath: 'push_9' },
{ id: 'mianfei', fullName: '免费赚钱中心', pushPath: 'push_9' },
];

0 comments on commit 4e7f0c1

Please sign in to comment.