mirror of
https://github.com/imsyy/DailyHotApi.git
synced 2026-01-12 13:14:55 +08:00
🐞 fix: 修复启动异常
This commit is contained in:
@@ -32,7 +32,7 @@
|
|||||||
"dev": "cross-env NODE_ENV=development tsx watch --no-cache src/index.ts",
|
"dev": "cross-env NODE_ENV=development tsx watch --no-cache src/index.ts",
|
||||||
"dev:cache": "cross-env NODE_ENV=development tsx watch src/index.ts",
|
"dev:cache": "cross-env NODE_ENV=development tsx watch src/index.ts",
|
||||||
"build": "tsc --project tsconfig.json",
|
"build": "tsc --project tsconfig.json",
|
||||||
"start": "cross-env NODE_ENV=development tsx dist/index.js"
|
"start": "cross-env NODE_ENV=development tsx dist/src/index.js"
|
||||||
},
|
},
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ app.get("/all", (c) =>
|
|||||||
if (excludeRoutes.includes(path)) {
|
if (excludeRoutes.includes(path)) {
|
||||||
return {
|
return {
|
||||||
name: path,
|
name: path,
|
||||||
path: null,
|
path: undefined,
|
||||||
message: "该接口暂时下线",
|
message: "该接口暂时下线",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ const getList = async (options: Options, noCache: boolean): Promise<RouterResTyp
|
|||||||
desc: v.desc || "该视频暂无简介",
|
desc: v.desc || "该视频暂无简介",
|
||||||
cover: v.pic?.replace(/http:/, "https:"),
|
cover: v.pic?.replace(/http:/, "https:"),
|
||||||
author: v.author,
|
author: v.author,
|
||||||
timestamp: null,
|
timestamp: undefined,
|
||||||
hot: v.video_review,
|
hot: v.video_review,
|
||||||
url: `https://www.bilibili.com/video/${v.bvid}`,
|
url: `https://www.bilibili.com/video/${v.bvid}`,
|
||||||
mobileUrl: `https://m.bilibili.com/video/${v.bvid}`,
|
mobileUrl: `https://m.bilibili.com/video/${v.bvid}`,
|
||||||
|
|||||||
@@ -29,8 +29,8 @@ const getList = async (noCache: boolean): Promise<RouterResType> => {
|
|||||||
data: list.map((v: RouterType["csdn"]) => ({
|
data: list.map((v: RouterType["csdn"]) => ({
|
||||||
id: v.productId,
|
id: v.productId,
|
||||||
title: v.articleTitle,
|
title: v.articleTitle,
|
||||||
cover: v.picList?.[0] || null,
|
cover: v.picList?.[0] || undefined,
|
||||||
desc: null,
|
desc: undefined,
|
||||||
author: v.nickName,
|
author: v.nickName,
|
||||||
timestamp: getTime(v.period),
|
timestamp: getTime(v.period),
|
||||||
hot: Number(v.hotRankScore),
|
hot: Number(v.hotRankScore),
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ const getDyCookies = async () => {
|
|||||||
return cookieData;
|
return cookieData;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("获取抖音 Cookie 出错" + error);
|
console.error("获取抖音 Cookie 出错" + error);
|
||||||
return null;
|
return undefined;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ const getList = async (options: Options, noCache: boolean) => {
|
|||||||
title: data.subject,
|
title: data.subject,
|
||||||
desc: data.content,
|
desc: data.content,
|
||||||
cover: data.cover || data?.images?.[0],
|
cover: data.cover || data?.images?.[0],
|
||||||
author: v.user?.nickname || null,
|
author: v.user?.nickname || undefined,
|
||||||
timestamp: getTime(data.created_at),
|
timestamp: getTime(data.created_at),
|
||||||
hot: data.view_status,
|
hot: data.view_status,
|
||||||
url: `https://www.miyoushe.com/ys/article/${data.post_id}`,
|
url: `https://www.miyoushe.com/ys/article/${data.post_id}`,
|
||||||
|
|||||||
@@ -44,11 +44,11 @@ const getList = async (options: Options, noCache: boolean) => {
|
|||||||
data: list.map((v: RouterType["history"], index: number) => ({
|
data: list.map((v: RouterType["history"], index: number) => ({
|
||||||
id: index,
|
id: index,
|
||||||
title: load(v.title).text().trim(),
|
title: load(v.title).text().trim(),
|
||||||
cover: v.cover ? v.pic_share : null,
|
cover: v.cover ? v.pic_share : undefined,
|
||||||
desc: load(v.desc).text().trim(),
|
desc: load(v.desc).text().trim(),
|
||||||
year: v.year,
|
year: v.year,
|
||||||
timestamp: null,
|
timestamp: undefined,
|
||||||
hot: null,
|
hot: undefined,
|
||||||
url: v.link,
|
url: v.link,
|
||||||
mobileUrl: v.link,
|
mobileUrl: v.link,
|
||||||
})),
|
})),
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ const getList = async (options: Options, noCache: boolean) => {
|
|||||||
title: data.subject,
|
title: data.subject,
|
||||||
desc: data.content,
|
desc: data.content,
|
||||||
cover: data.cover || data?.images?.[0],
|
cover: data.cover || data?.images?.[0],
|
||||||
author: v.user?.nickname || null,
|
author: v.user?.nickname || undefined,
|
||||||
timestamp: getTime(data.created_at),
|
timestamp: getTime(data.created_at),
|
||||||
hot: data.view_status,
|
hot: data.view_status,
|
||||||
url: `https://www.miyoushe.com/bh3/article/${data.post_id}`,
|
url: `https://www.miyoushe.com/bh3/article/${data.post_id}`,
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ const getList = async (options: Options, noCache: boolean) => {
|
|||||||
title: v.title,
|
title: v.title,
|
||||||
author: v.username,
|
author: v.username,
|
||||||
hot: v.replies,
|
hot: v.replies,
|
||||||
timestamp: null,
|
timestamp: undefined,
|
||||||
url: `https://bbs.hupu.com/${v.tid}.html`,
|
url: `https://bbs.hupu.com/${v.tid}.html`,
|
||||||
mobileUrl: v.url,
|
mobileUrl: v.url,
|
||||||
})),
|
})),
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ const getList = async (noCache: boolean) => {
|
|||||||
desc: titleProcessing(v.content).intro,
|
desc: titleProcessing(v.content).intro,
|
||||||
author: v.user_info.username,
|
author: v.user_info.username,
|
||||||
timestamp: getTime(v.publish_time),
|
timestamp: getTime(v.publish_time),
|
||||||
hot: null,
|
hot: undefined,
|
||||||
url: v.url || `https://www.huxiu.com/moment/${v.object_id}.html`,
|
url: v.url || `https://www.huxiu.com/moment/${v.object_id}.html`,
|
||||||
mobileUrl: v.url || `https://m.huxiu.com/moment/${v.object_id}.html`,
|
mobileUrl: v.url || `https://m.huxiu.com/moment/${v.object_id}.html`,
|
||||||
})),
|
})),
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ const getList = async (noCache: boolean) => {
|
|||||||
const href = dom.find("a").attr("href");
|
const href = dom.find("a").attr("href");
|
||||||
const time = dom.find("span.time").text().trim();
|
const time = dom.find("span.time").text().trim();
|
||||||
const match = time.match(/'([^']+)'/);
|
const match = time.match(/'([^']+)'/);
|
||||||
const dateTime = match ? match[1] : null;
|
const dateTime = match ? match[1] : undefined;
|
||||||
return {
|
return {
|
||||||
id: href ? Number(replaceLink(href, true)) : 100000,
|
id: href ? Number(replaceLink(href, true)) : 100000,
|
||||||
title: dom.find(".newsbody h2").text().trim(),
|
title: dom.find(".newsbody h2").text().trim(),
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ const getList = async (options: Options, noCache: boolean): Promise<RouterResTyp
|
|||||||
title: data.subject,
|
title: data.subject,
|
||||||
desc: data.content,
|
desc: data.content,
|
||||||
cover: data.cover || data?.images?.[0],
|
cover: data.cover || data?.images?.[0],
|
||||||
author: v.user?.nickname || null,
|
author: v.user?.nickname || undefined,
|
||||||
timestamp: getTime(data.created_at),
|
timestamp: getTime(data.created_at),
|
||||||
hot: data.view_status || 0,
|
hot: data.view_status || 0,
|
||||||
url: `https://www.miyoushe.com/ys/article/${data.post_id}`,
|
url: `https://www.miyoushe.com/ys/article/${data.post_id}`,
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ const getList = async (noCache: boolean) => {
|
|||||||
title: v.title,
|
title: v.title,
|
||||||
cover: v.imgsrc,
|
cover: v.imgsrc,
|
||||||
author: v.source,
|
author: v.source,
|
||||||
hot: null,
|
hot: undefined,
|
||||||
timestamp: getTime(v.ptime),
|
timestamp: getTime(v.ptime),
|
||||||
url: `https://www.163.com/dy/article/${v.docid}.html`,
|
url: `https://www.163.com/dy/article/${v.docid}.html`,
|
||||||
mobileUrl: `https://m.163.com/dy/article/${v.docid}.html`,
|
mobileUrl: `https://m.163.com/dy/article/${v.docid}.html`,
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ const getList = async (options: Options, noCache: boolean) => {
|
|||||||
data: list.map((v: RouterType["sina-news"]) => ({
|
data: list.map((v: RouterType["sina-news"]) => ({
|
||||||
id: v.id,
|
id: v.id,
|
||||||
title: v.title,
|
title: v.title,
|
||||||
author: v.media || null,
|
author: v.media || undefined,
|
||||||
hot: parseFloat(v.top_num.replace(/,/g, "")),
|
hot: parseFloat(v.top_num.replace(/,/g, "")),
|
||||||
timestamp: getTime(v.create_date + " " + v.create_time),
|
timestamp: getTime(v.create_date + " " + v.create_time),
|
||||||
url: v.url,
|
url: v.url,
|
||||||
|
|||||||
@@ -50,9 +50,9 @@ const getList = async (options: Options, noCache: boolean) => {
|
|||||||
return {
|
return {
|
||||||
id: base.base.uniqueId,
|
id: base.base.uniqueId,
|
||||||
title: info.title,
|
title: info.title,
|
||||||
desc: null,
|
desc: undefined,
|
||||||
author: null,
|
author: undefined,
|
||||||
timestamp: null,
|
timestamp: undefined,
|
||||||
hot: parseChineseNumber(info.hotValue),
|
hot: parseChineseNumber(info.hotValue),
|
||||||
url: base.base.url,
|
url: base.base.url,
|
||||||
mobileUrl: base.base.url,
|
mobileUrl: base.base.url,
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ const getList = async (options: Options, noCache: boolean) => {
|
|||||||
title: data.subject,
|
title: data.subject,
|
||||||
desc: data.content,
|
desc: data.content,
|
||||||
cover: data.cover || data?.images?.[0],
|
cover: data.cover || data?.images?.[0],
|
||||||
author: v.user?.nickname || null,
|
author: v.user?.nickname || undefined,
|
||||||
timestamp: getTime(data.created_at),
|
timestamp: getTime(data.created_at),
|
||||||
hot: data.view_status,
|
hot: data.view_status,
|
||||||
url: `https://www.miyoushe.com/sr/article/${data.post_id}`,
|
url: `https://www.miyoushe.com/sr/article/${data.post_id}`,
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ const getList = async (options: Options, noCache: boolean) => {
|
|||||||
title: v.title,
|
title: v.title,
|
||||||
desc: v.content,
|
desc: v.content,
|
||||||
author: v.member.username,
|
author: v.member.username,
|
||||||
timestamp: null,
|
timestamp: undefined,
|
||||||
hot: v.replies,
|
hot: v.replies,
|
||||||
url: v.url,
|
url: v.url,
|
||||||
mobileUrl: v.url,
|
mobileUrl: v.url,
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ const getList = async (options: Options, noCache: boolean) => {
|
|||||||
desc: v.issuetime + " " + v.title,
|
desc: v.issuetime + " " + v.title,
|
||||||
cover: v.pic,
|
cover: v.pic,
|
||||||
timestamp: getTime(v.issuetime),
|
timestamp: getTime(v.issuetime),
|
||||||
hot: null,
|
hot: undefined,
|
||||||
url: `http://nmc.cn${v.url}`,
|
url: `http://nmc.cn${v.url}`,
|
||||||
mobileUrl: `http://nmc.cn${v.url}`,
|
mobileUrl: `http://nmc.cn${v.url}`,
|
||||||
})),
|
})),
|
||||||
|
|||||||
@@ -35,10 +35,10 @@ const getList = async (noCache: boolean) => {
|
|||||||
data: list.map((v: RouterType["zhihu-daily"]) => ({
|
data: list.map((v: RouterType["zhihu-daily"]) => ({
|
||||||
id: v.id,
|
id: v.id,
|
||||||
title: v.title,
|
title: v.title,
|
||||||
cover: v.images?.[0] ?? null,
|
cover: v.images?.[0] ?? undefined,
|
||||||
author: v.hint,
|
author: v.hint,
|
||||||
hot: null,
|
hot: undefined,
|
||||||
timestamp: null,
|
timestamp: undefined,
|
||||||
url: v.url,
|
url: v.url,
|
||||||
mobileUrl: v.url,
|
mobileUrl: v.url,
|
||||||
})),
|
})),
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ export const getTime = (timeInput: string | number): number | undefined => {
|
|||||||
"YYYY-MM-DD",
|
"YYYY-MM-DD",
|
||||||
];
|
];
|
||||||
|
|
||||||
let parsedDate: dayjs.Dayjs | null = null;
|
let parsedDate: dayjs.Dayjs | undefined = undefined;
|
||||||
for (const pattern of formatPatterns) {
|
for (const pattern of formatPatterns) {
|
||||||
parsedDate = dayjs(standardizedInput, pattern, true);
|
parsedDate = dayjs(standardizedInput, pattern, true);
|
||||||
if (parsedDate.isValid()) {
|
if (parsedDate.isValid()) {
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ const getWereadID = (bookId: string) => {
|
|||||||
return strSub;
|
return strSub;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("处理微信读书 ID 时出现错误:" + error);
|
console.error("处理微信读书 ID 时出现错误:" + error);
|
||||||
return null;
|
return undefined;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user