🐞 fix: 修复知乎字段变更 #98

This commit is contained in:
imsyy
2025-04-02 14:32:18 +08:00
parent 410d88860d
commit dddcb27487
4 changed files with 583 additions and 398 deletions

View File

@@ -36,42 +36,47 @@
}, },
"type": "module", "type": "module",
"dependencies": { "dependencies": {
"@hono/node-server": "^1.13.7", "@hono/node-server": "^1.14.0",
"axios": "^1.7.8", "axios": "^1.8.4",
"chalk": "^5.3.0", "chalk": "^5.4.1",
"cheerio": "^1.0.0", "cheerio": "^1.0.0",
"dayjs": "^1.11.13", "dayjs": "^1.11.13",
"dotenv": "^16.4.6", "dotenv": "^16.4.7",
"feed": "^4.2.2", "feed": "^4.2.2",
"flatted": "^3.3.2", "flatted": "^3.3.3",
"hono": "^4.6.12", "hono": "^4.7.5",
"iconv-lite": "^0.6.3", "iconv-lite": "^0.6.3",
"ioredis": "^5.4.1", "ioredis": "^5.6.0",
"md5": "^2.3.0", "md5": "^2.3.0",
"node-cache": "^5.1.2", "node-cache": "^5.1.2",
"node-fetch": "^3.3.2", "node-fetch": "^3.3.2",
"rss-parser": "^3.13.0", "rss-parser": "^3.13.0",
"user-agents": "^1.1.379", "user-agents": "^1.1.496",
"winston": "^3.17.0" "winston": "^3.17.0"
}, },
"devDependencies": { "devDependencies": {
"@eslint/js": "^9.16.0", "@eslint/js": "^9.23.0",
"@types/cheerio": "^0.22.35", "@types/cheerio": "^0.22.35",
"@types/md5": "^2.3.5", "@types/md5": "^2.3.5",
"@types/node": "^22.10.1", "@types/node": "^22.13.17",
"@types/user-agents": "^1.0.4", "@types/user-agents": "^1.0.4",
"@types/xml2js": "^0.4.14", "@types/xml2js": "^0.4.14",
"@typescript-eslint/eslint-plugin": "^8.17.0", "@typescript-eslint/eslint-plugin": "^8.29.0",
"@typescript-eslint/parser": "^8.17.0", "@typescript-eslint/parser": "^8.29.0",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"eslint": "^9.16.0", "eslint": "^9.23.0",
"globals": "^15.13.0", "globals": "^15.15.0",
"prettier": "^3.4.1", "prettier": "^3.5.3",
"tsx": "^4.19.2", "tsx": "^4.19.3",
"typescript": "^5.7.2", "typescript": "^5.8.2",
"typescript-eslint": "^8.17.0" "typescript-eslint": "^8.29.0"
}, },
"engines": { "engines": {
"node": ">=20" "node": ">=20"
},
"pnpm": {
"onlyBuiltDependencies": [
"esbuild"
]
} }
} }

934
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -95,6 +95,7 @@ export type RouterType = {
title: string; title: string;
excerpt: string; excerpt: string;
created: number; created: number;
url: string;
}; };
children: [ children: [
{ {

View File

@@ -24,6 +24,7 @@ const getList = async (noCache: boolean) => {
...result, ...result,
data: list.map((v: RouterType["zhihu"]) => { data: list.map((v: RouterType["zhihu"]) => {
const data = v.target; const data = v.target;
const questionId = data.url.split("/").pop();
return { return {
id: data.id, id: data.id,
title: data.title, title: data.title,
@@ -31,8 +32,8 @@ const getList = async (noCache: boolean) => {
cover: v.children[0].thumbnail, cover: v.children[0].thumbnail,
timestamp: getTime(data.created), timestamp: getTime(data.created),
hot: parseFloat(v.detail_text.split(" ")[0]) * 10000, hot: parseFloat(v.detail_text.split(" ")[0]) * 10000,
url: `https://www.zhihu.com/question/${data.id}`, url: `https://www.zhihu.com/question/${questionId}`,
mobileUrl: `https://www.zhihu.com/question/${data.id}`, mobileUrl: `https://www.zhihu.com/question/${questionId}`,
}; };
}), }),
}; };