mirror of
https://github.com/imsyy/DailyHotApi.git
synced 2026-01-12 13:14:55 +08:00
🦄 refactor: 调整接口结构
This commit is contained in:
@@ -4,16 +4,14 @@ import { get } from "../utils/getData.js";
|
||||
import { getTime } from "../utils/getTime.js";
|
||||
|
||||
export const handleRoute = async (_: undefined, noCache: boolean) => {
|
||||
const { fromCache, data, updateTime } = await getList(noCache);
|
||||
const listData = await getList(noCache);
|
||||
const routeData: RouterData = {
|
||||
name: "huxiu",
|
||||
title: "虎嗅",
|
||||
type: "24小时",
|
||||
link: "https://www.huxiu.com/moment/",
|
||||
total: data?.length || 0,
|
||||
updateTime,
|
||||
fromCache,
|
||||
data,
|
||||
total: listData.data?.length || 0,
|
||||
...listData,
|
||||
};
|
||||
return routeData;
|
||||
};
|
||||
@@ -38,8 +36,7 @@ const getList = async (noCache: boolean) => {
|
||||
const matchResult = result.data.match(pattern);
|
||||
const jsonObject = JSON.parse(matchResult[1]).moment.momentList.moment_list.datalist;
|
||||
return {
|
||||
fromCache: result.fromCache,
|
||||
updateTime: result.updateTime,
|
||||
...result,
|
||||
data: jsonObject.map((v: RouterType["huxiu"]) => ({
|
||||
id: v.object_id,
|
||||
title: titleProcessing(v.content).title,
|
||||
|
||||
Reference in New Issue
Block a user