14 Commits

Author SHA1 Message Date
imsyy
36802252c0 Merge branch 'master' of github.com:imsyy/DailyHotApi 2024-07-30 11:50:31 +08:00
imsyy
7f5449089d 🔧 build: 更新版本号 2024-07-30 11:49:59 +08:00
底层用户
53c68a3d69 Merge pull request #72 from Kataick/fix-weibo-hot-field
fix(weibo): 修复微博热度字段
2024-07-26 18:30:24 +08:00
Kataick
447e0c6153 fix(weibo): 修复微博热度字段 2024-07-25 21:24:39 +08:00
imsyy
55f4e22693 feat: 新增 NodeSeek by @JianBing77 2024-07-22 18:07:03 +08:00
底层用户
c791e29a59 Merge pull request #71 from JianBing77/master
feat: 新增NodeSeek接口
2024-07-22 17:49:19 +08:00
JianBing77
91775a0763 feat: 新增NodeSeek接口 2024-07-19 11:41:15 +08:00
imsyy
a742f9df78 🐞 fix: 修复米游社系列接口出错 2024-07-09 09:35:27 +08:00
底层用户
f213d9810b Merge pull request #68 from Kataick/fix-zhihu-hot
fix(zhihu): fix hot error
2024-07-08 15:10:29 +08:00
底层用户
250a90cf2e Merge pull request #67 from Kataick/flx-douyin-url
fix(douyin): remove encodeURIComponent from url
2024-07-08 15:10:18 +08:00
Kataick
a4a1055604 fix(zhihu): hot error 2024-07-07 12:48:11 +08:00
Kataick
fd3d911b04 fix(douyin): remove encodeURIComponent from url 2024-07-06 13:24:54 +08:00
imsyy
bf80a2e22c feat: 新增 虎扑 & 新浪网 & 新浪新闻
- 修复历史上的今天 #63
2024-06-25 13:47:40 +08:00
imsyy
6988df58f1 🐞 fix: 修复历史上的今天 2024-06-24 16:02:06 +08:00
30 changed files with 607 additions and 208 deletions

View File

@@ -29,6 +29,9 @@
> 🟢 状态正常 / 🟠 可能失效 / ❌ 无法使用 / ⚠️ 需要科学上网
<details>
<summary>查看全部接口状态</summary>
| **站点** | **类别** | **调用名称** | **状态** |
| ---------------- | ------------ | -------------- | -------- |
| 哔哩哔哩 | 热门榜 | bilibili | 🟢 |
@@ -50,12 +53,16 @@
| 36 氪 | 热榜 | 36kr | 🟢 |
| 51CTO | 推荐榜 | 51cto | 🟢 |
| CSDN | 排行榜 | csdn | 🟢 |
| NodeSeek | 最新动态 | nodeseek | 🟢 |
| 稀土掘金 | 热榜 | juejin | 🟢 |
| 腾讯新闻 | 热点榜 | qq-news | 🟢 |
| 新浪网 | 热榜 | sina | 🟢 |
| 新浪新闻 | 热点榜 | sina-news | 🟢 |
| 网易新闻 | 热点榜 | netease-news | 🟢 |
| 吾爱破解 | 榜单 | 52pojie | ❌ |
| 全球主机交流 | 榜单 | hostloc | ❌ |
| 虎嗅 | 24小时 | huxiu | 🟢 |
| 虎扑 | 步行街热帖 | hupu | 🟢 |
| 爱范儿 | 快讯 | ifanr | 🟢 |
| 英雄联盟 | 更新公告 | lol | 🟢 |
| 原神 | 最新消息 | genshin | 🟢 |
@@ -69,6 +76,8 @@
| 中国地震台 | 地震速报 | earthquake | 🟢 |
| 历史上的今天 | 月-日 | history | 🟢 |
</details>
## ⚙️ 使用
本项目支持 `Node.js` 调用,可在安装完成后调用 `serveHotApi` 来开启服务器

View File

@@ -1,6 +1,6 @@
{
"name": "dailyhot-api",
"version": "2.0.2",
"version": "2.0.4",
"description": "An Api on Today's Hot list",
"keywords": [
"API",
@@ -36,28 +36,30 @@
},
"type": "module",
"dependencies": {
"@hono/node-server": "^1.11.2",
"@hono/node-server": "^1.12.0",
"axios": "^1.7.2",
"chalk": "^5.3.0",
"cheerio": "1.0.0-rc.12",
"dayjs": "^1.11.11",
"dayjs": "^1.11.12",
"dotenv": "^16.4.5",
"feed": "^4.2.2",
"hono": "^4.4.5",
"hono": "^4.5.1",
"md5": "^2.3.0",
"node-cache": "^5.1.2",
"rss-parser": "^3.13.0",
"winston": "^3.13.0"
"winston": "^3.13.1",
"xml2js": "^0.6.2"
},
"devDependencies": {
"@types/node": "^20.14.2",
"@typescript-eslint/eslint-plugin": "^7.13.0",
"@typescript-eslint/parser": "^7.13.0",
"@types/node": "^20.14.11",
"@types/xml2js": "^0.4.14",
"@typescript-eslint/eslint-plugin": "^7.16.1",
"@typescript-eslint/parser": "^7.16.1",
"cross-env": "^7.0.3",
"eslint": "^8.57.0",
"prettier": "^3.3.2",
"prettier": "^3.3.3",
"tsx": "^3.14.0",
"typescript": "^5.4.5"
"typescript": "^5.5.3"
},
"engines": {
"node": ">=20"

279
pnpm-lock.yaml generated
View File

@@ -9,8 +9,8 @@ importers:
.:
dependencies:
'@hono/node-server':
specifier: ^1.11.2
version: 1.11.2
specifier: ^1.12.0
version: 1.12.0
axios:
specifier: ^1.7.2
version: 1.7.2
@@ -21,8 +21,8 @@ importers:
specifier: 1.0.0-rc.12
version: 1.0.0-rc.12
dayjs:
specifier: ^1.11.11
version: 1.11.11
specifier: ^1.11.12
version: 1.11.12
dotenv:
specifier: ^16.4.5
version: 16.4.5
@@ -30,8 +30,8 @@ importers:
specifier: ^4.2.2
version: 4.2.2
hono:
specifier: ^4.4.5
version: 4.4.5
specifier: ^4.5.1
version: 4.5.1
md5:
specifier: ^2.3.0
version: 2.3.0
@@ -42,18 +42,24 @@ importers:
specifier: ^3.13.0
version: 3.13.0
winston:
specifier: ^3.13.0
version: 3.13.0
specifier: ^3.13.1
version: 3.13.1
xml2js:
specifier: ^0.6.2
version: 0.6.2
devDependencies:
'@types/node':
specifier: ^20.14.2
version: 20.14.2
specifier: ^20.14.11
version: 20.14.11
'@types/xml2js':
specifier: ^0.4.14
version: 0.4.14
'@typescript-eslint/eslint-plugin':
specifier: ^7.13.0
version: 7.13.0(@typescript-eslint/parser@7.13.0(eslint@8.57.0)(typescript@5.4.5))(eslint@8.57.0)(typescript@5.4.5)
specifier: ^7.16.1
version: 7.16.1(@typescript-eslint/parser@7.16.1(eslint@8.57.0)(typescript@5.5.3))(eslint@8.57.0)(typescript@5.5.3)
'@typescript-eslint/parser':
specifier: ^7.13.0
version: 7.13.0(eslint@8.57.0)(typescript@5.4.5)
specifier: ^7.16.1
version: 7.16.1(eslint@8.57.0)(typescript@5.5.3)
cross-env:
specifier: ^7.0.3
version: 7.0.3
@@ -61,14 +67,14 @@ importers:
specifier: ^8.57.0
version: 8.57.0
prettier:
specifier: ^3.3.2
version: 3.3.2
specifier: ^3.3.3
version: 3.3.3
tsx:
specifier: ^3.14.0
version: 3.14.0
typescript:
specifier: ^5.4.5
version: 5.4.5
specifier: ^5.5.3
version: 5.5.3
packages:
@@ -217,8 +223,8 @@ packages:
peerDependencies:
eslint: ^6.0.0 || ^7.0.0 || >=8.0.0
'@eslint-community/regexpp@4.10.1':
resolution: {integrity: sha512-Zm2NGpWELsQAD1xsJzGQpYfvICSsFkEpU0jxBjfdC6uNEWXcHnfs9hScFWtXVDVl+rBQJGrl4g1vcKIejpH9dA==}
'@eslint-community/regexpp@4.11.0':
resolution: {integrity: sha512-G/M/tIiMrTAxEWRfLfQJMmGNX28IxBg4PBz8XqQhqUHLFI6TL2htpIB1iQCj144V5ee/JaKyT9/WZ0MGZWfA7A==}
engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0}
'@eslint/eslintrc@2.1.4':
@@ -229,13 +235,14 @@ packages:
resolution: {integrity: sha512-Ys+3g2TaW7gADOJzPt83SJtCDhMjndcDMFVQ/Tj9iA1BfJzFKD9mAUXT3OenpuPHbI6P/myECxRJrofUsDx/5g==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
'@hono/node-server@1.11.2':
resolution: {integrity: sha512-JhX0nUC66GeDxpIdMKWDRMEwtQBa64CY907iAF1sYqb4m2p2PdSU7zkbnNhAZLg/6IjSlTuj6CF307JlBXVvpg==}
'@hono/node-server@1.12.0':
resolution: {integrity: sha512-e6oHjNiErRxsZRZBmc2KucuvY3btlO/XPncIpP2X75bRdTilF9GLjm3NHvKKunpJbbJJj31/FoPTksTf8djAVw==}
engines: {node: '>=18.14.1'}
'@humanwhocodes/config-array@0.11.14':
resolution: {integrity: sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==}
engines: {node: '>=10.10.0'}
deprecated: Use @eslint/config-array instead
'@humanwhocodes/module-importer@1.0.1':
resolution: {integrity: sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==}
@@ -257,14 +264,17 @@ packages:
resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==}
engines: {node: '>= 8'}
'@types/node@20.14.2':
resolution: {integrity: sha512-xyu6WAMVwv6AKFLB+e/7ySZVr/0zLCzOa7rSpq6jNwpqOrUbcACDWC+53d4n2QHOnDou0fbIsg8wZu/sxrnI4Q==}
'@types/node@20.14.11':
resolution: {integrity: sha512-kprQpL8MMeszbz6ojB5/tU8PLN4kesnN8Gjzw349rDlNgsSzg90lAVj3llK99Dh7JON+t9AuscPPFW6mPbTnSA==}
'@types/triple-beam@1.3.5':
resolution: {integrity: sha512-6WaYesThRMCl19iryMYP7/x2OVgCtbIVflDGFpWnb9irXI3UjYE4AzmYuiUKY1AJstGijoY+MgUszMgRxIYTYw==}
'@typescript-eslint/eslint-plugin@7.13.0':
resolution: {integrity: sha512-FX1X6AF0w8MdVFLSdqwqN/me2hyhuQg4ykN6ZpVhh1ij/80pTvDKclX1sZB9iqex8SjQfVhwMKs3JtnnMLzG9w==}
'@types/xml2js@0.4.14':
resolution: {integrity: sha512-4YnrRemBShWRO2QjvUin8ESA41rH+9nQGLUGZV/1IDhi3SL9OhdpNC/MrulTWuptXKwhx/aDxE7toV0f/ypIXQ==}
'@typescript-eslint/eslint-plugin@7.16.1':
resolution: {integrity: sha512-SxdPak/5bO0EnGktV05+Hq8oatjAYVY3Zh2bye9pGZy6+jwyR3LG3YKkV4YatlsgqXP28BTeVm9pqwJM96vf2A==}
engines: {node: ^18.18.0 || >=20.0.0}
peerDependencies:
'@typescript-eslint/parser': ^7.0.0
@@ -274,8 +284,8 @@ packages:
typescript:
optional: true
'@typescript-eslint/parser@7.13.0':
resolution: {integrity: sha512-EjMfl69KOS9awXXe83iRN7oIEXy9yYdqWfqdrFAYAAr6syP8eLEFI7ZE4939antx2mNgPRW/o1ybm2SFYkbTVA==}
'@typescript-eslint/parser@7.16.1':
resolution: {integrity: sha512-u+1Qx86jfGQ5i4JjK33/FnawZRpsLxRnKzGE6EABZ40KxVT/vWsiZFEBBHjFOljmmV3MBYOHEKi0Jm9hbAOClA==}
engines: {node: ^18.18.0 || >=20.0.0}
peerDependencies:
eslint: ^8.56.0
@@ -284,12 +294,12 @@ packages:
typescript:
optional: true
'@typescript-eslint/scope-manager@7.13.0':
resolution: {integrity: sha512-ZrMCe1R6a01T94ilV13egvcnvVJ1pxShkE0+NDjDzH4nvG1wXpwsVI5bZCvE7AEDH1mXEx5tJSVR68bLgG7Dng==}
'@typescript-eslint/scope-manager@7.16.1':
resolution: {integrity: sha512-nYpyv6ALte18gbMz323RM+vpFpTjfNdyakbf3nsLvF43uF9KeNC289SUEW3QLZ1xPtyINJ1dIsZOuWuSRIWygw==}
engines: {node: ^18.18.0 || >=20.0.0}
'@typescript-eslint/type-utils@7.13.0':
resolution: {integrity: sha512-xMEtMzxq9eRkZy48XuxlBFzpVMDurUAfDu5Rz16GouAtXm0TaAoTFzqWUFPPuQYXI/CDaH/Bgx/fk/84t/Bc9A==}
'@typescript-eslint/type-utils@7.16.1':
resolution: {integrity: sha512-rbu/H2MWXN4SkjIIyWcmYBjlp55VT+1G3duFOIukTNFxr9PI35pLc2ydwAfejCEitCv4uztA07q0QWanOHC7dA==}
engines: {node: ^18.18.0 || >=20.0.0}
peerDependencies:
eslint: ^8.56.0
@@ -298,12 +308,12 @@ packages:
typescript:
optional: true
'@typescript-eslint/types@7.13.0':
resolution: {integrity: sha512-QWuwm9wcGMAuTsxP+qz6LBBd3Uq8I5Nv8xb0mk54jmNoCyDspnMvVsOxI6IsMmway5d1S9Su2+sCKv1st2l6eA==}
'@typescript-eslint/types@7.16.1':
resolution: {integrity: sha512-AQn9XqCzUXd4bAVEsAXM/Izk11Wx2u4H3BAfQVhSfzfDOm/wAON9nP7J5rpkCxts7E5TELmN845xTUCQrD1xIQ==}
engines: {node: ^18.18.0 || >=20.0.0}
'@typescript-eslint/typescript-estree@7.13.0':
resolution: {integrity: sha512-cAvBvUoobaoIcoqox1YatXOnSl3gx92rCZoMRPzMNisDiM12siGilSM4+dJAekuuHTibI2hVC2fYK79iSFvWjw==}
'@typescript-eslint/typescript-estree@7.16.1':
resolution: {integrity: sha512-0vFPk8tMjj6apaAZ1HlwM8w7jbghC8jc1aRNJG5vN8Ym5miyhTQGMqU++kuBFDNKe9NcPeZ6x0zfSzV8xC1UlQ==}
engines: {node: ^18.18.0 || >=20.0.0}
peerDependencies:
typescript: '*'
@@ -311,14 +321,14 @@ packages:
typescript:
optional: true
'@typescript-eslint/utils@7.13.0':
resolution: {integrity: sha512-jceD8RgdKORVnB4Y6BqasfIkFhl4pajB1wVxrF4akxD2QPM8GNYjgGwEzYS+437ewlqqrg7Dw+6dhdpjMpeBFQ==}
'@typescript-eslint/utils@7.16.1':
resolution: {integrity: sha512-WrFM8nzCowV0he0RlkotGDujx78xudsxnGMBHI88l5J8wEhED6yBwaSLP99ygfrzAjsQvcYQ94quDwI0d7E1fA==}
engines: {node: ^18.18.0 || >=20.0.0}
peerDependencies:
eslint: ^8.56.0
'@typescript-eslint/visitor-keys@7.13.0':
resolution: {integrity: sha512-nxn+dozQx+MK61nn/JP+M4eCkHDSxSLDpgE3WcQo0+fkjEolnaB5jswvIKC4K56By8MMgIho7f1PVxERHEo8rw==}
'@typescript-eslint/visitor-keys@7.16.1':
resolution: {integrity: sha512-Qlzzx4sE4u3FsHTPQAAQFJFNOuqtuY0LFrZHwQ8IHK705XxBiWOFkfKRWu6niB7hwfgnwIpO4jTC75ozW1PHWg==}
engines: {node: ^18.18.0 || >=20.0.0}
'@ungap/structured-clone@1.2.0':
@@ -329,8 +339,8 @@ packages:
peerDependencies:
acorn: ^6.0.0 || ^7.0.0 || ^8.0.0
acorn@8.11.3:
resolution: {integrity: sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==}
acorn@8.12.1:
resolution: {integrity: sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==}
engines: {node: '>=0.4.0'}
hasBin: true
@@ -454,8 +464,8 @@ packages:
resolution: {integrity: sha512-HTUrgRJ7r4dsZKU6GjmpfRK1O76h97Z8MfS1G0FozR+oF2kG6Vfe8JE6zwrkbxigziPHinCJ+gCPjA9EaBDtRw==}
engines: {node: '>= 6'}
dayjs@1.11.11:
resolution: {integrity: sha512-okzr3f11N6WuqYtZSvm+F776mB41wRZMhKP+hc34YdW+KmtYYK9iqvHSwo2k9FEH3fhGXvOPV6yz2IcSrfRUDg==}
dayjs@1.11.12:
resolution: {integrity: sha512-Rt2g+nTbLlDWZTwwrIXjy9MeiZmSDI375FvZs72ngxx8PDC6YXOeR3q5LAuPzjZQxhiWdRKac7RKV+YyQYfYIg==}
debug@4.3.5:
resolution: {integrity: sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg==}
@@ -534,8 +544,8 @@ packages:
resolution: {integrity: sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
esquery@1.5.0:
resolution: {integrity: sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==}
esquery@1.6.0:
resolution: {integrity: sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==}
engines: {node: '>=0.10'}
esrecurse@4.3.0:
@@ -616,8 +626,8 @@ packages:
engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0}
os: [darwin]
get-tsconfig@4.7.5:
resolution: {integrity: sha512-ZCuZCnlqNzjb4QprAzXKdpp/gh6KTxSJuw3IBsPnV/7fV4NxC9ckB+vPTt8w7fJA0TaSD7c55BR47JD6MEDyDw==}
get-tsconfig@4.7.6:
resolution: {integrity: sha512-ZAqrLlu18NbDdRaHq+AKXzAmqIUPswPWKUchfytdAjiRFnCe5ojG2bstg6mRiZabkKfCoL/e98pbBELIV/YCeA==}
glob-parent@5.1.2:
resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==}
@@ -646,8 +656,8 @@ packages:
resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==}
engines: {node: '>=8'}
hono@4.4.5:
resolution: {integrity: sha512-hyf+1c+gTEo0+xjdYT2e8y4M3HcEy0ARuRZHPRgeRhq/mupkI4j9/qEWVKsyj0se4KhfRnYrld4Tk6z/9veq/Q==}
hono@4.5.1:
resolution: {integrity: sha512-6q8AugoWG5wlrjdGG8OFFiqEsPlPGjODjUik48sEJeko4Tae1UsLS2vUiYHLEJx1gJvOZa4BWkQC+urwDmkEvQ==}
engines: {node: '>=16.0.0'}
htmlparser2@8.0.2:
@@ -731,8 +741,8 @@ packages:
lodash.merge@4.6.2:
resolution: {integrity: sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==}
logform@2.6.0:
resolution: {integrity: sha512-1ulHeNPp6k/LD8H91o7VYFBng5i1BDE7HoKxVbZiGFidS1Rj65qcywLxX+pVfAPoQJEjRdvKcusKwOupHCVOVQ==}
logform@2.6.1:
resolution: {integrity: sha512-CdaO738xRapbKIMVn2m4F6KTj4j7ooJ8POVnebSgKo3KBz5axNXRAL7ZdRjIV6NOr2Uf4vjtRkxrFETOioCqSA==}
engines: {node: '>= 12.0.0'}
md5@2.3.0:
@@ -757,8 +767,8 @@ packages:
minimatch@3.1.2:
resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==}
minimatch@9.0.4:
resolution: {integrity: sha512-KqWh+VchfxcMNRAJjj2tnsSJdNbHsVgnkBhTNrW7AjVo6OvLtxw8zfT9oLw1JSohlFzJ8jCoTgaoXvJ+kHt6fw==}
minimatch@9.0.5:
resolution: {integrity: sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==}
engines: {node: '>=16 || 14 >=14.17'}
ms@2.1.2:
@@ -829,8 +839,8 @@ packages:
resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==}
engines: {node: '>= 0.8.0'}
prettier@3.3.2:
resolution: {integrity: sha512-rAVeHYMcv8ATV5d508CFdn+8/pHPpXeIid1DdrPwXnaAdH7cqjVbpJaT5eq4yRAFU/lsbwYwSF/n5iNrdJHPQA==}
prettier@3.3.3:
resolution: {integrity: sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==}
engines: {node: '>=14'}
hasBin: true
@@ -880,8 +890,8 @@ packages:
sax@1.4.1:
resolution: {integrity: sha512-+aWOz7yVScEGoKNd4PA10LZ8sk0A/z5+nXQG5giUO5rprX9jgYsTdov9qCchZiPIZezbZH+jRut8nPodFAX4Jg==}
semver@7.6.2:
resolution: {integrity: sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==}
semver@7.6.3:
resolution: {integrity: sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==}
engines: {node: '>=10'}
hasBin: true
@@ -957,8 +967,8 @@ packages:
resolution: {integrity: sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==}
engines: {node: '>=10'}
typescript@5.4.5:
resolution: {integrity: sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==}
typescript@5.5.3:
resolution: {integrity: sha512-/hreyEujaB0w76zKo6717l3L0o/qEUtRgdvUBvlkhoWeOVMjMuHNHk0BRBzikzuGDqNmPQbg5ifMEqsHLiIUcQ==}
engines: {node: '>=14.17'}
hasBin: true
@@ -976,12 +986,12 @@ packages:
engines: {node: '>= 8'}
hasBin: true
winston-transport@4.7.0:
resolution: {integrity: sha512-ajBj65K5I7denzer2IYW6+2bNIVqLGDHqDw3Ow8Ohh+vdW+rv4MZ6eiDvHoKhfJFZ2auyN8byXieDDJ96ViONg==}
winston-transport@4.7.1:
resolution: {integrity: sha512-wQCXXVgfv/wUPOfb2x0ruxzwkcZfxcktz6JIMUaPLmcNhO4bZTwA/WtDWK74xV3F2dKu8YadrFv0qhwYjVEwhA==}
engines: {node: '>= 12.0.0'}
winston@3.13.0:
resolution: {integrity: sha512-rwidmA1w3SE4j0E5MuIufFhyJPBDG7Nu71RkZor1p2+qHvJSZ9GYDA81AyleQcZbh/+V6HjeBdfnTZJm9rSeQQ==}
winston@3.13.1:
resolution: {integrity: sha512-SvZit7VFNvXRzbqGHsv5KSmgbEYR5EiQfDAL9gxYkRqa934Hnk++zze0wANKtMHcy/gI4W/3xmSDwlhf865WGw==}
engines: {node: '>= 12.0.0'}
word-wrap@1.2.5:
@@ -999,6 +1009,10 @@ packages:
resolution: {integrity: sha512-drPFnkQJik/O+uPKpqSgr22mpuFHqKdbS835iAQrUC73L2F5WkboIRd63ai/2Yg6I1jzifPFKH2NTK+cfglkIA==}
engines: {node: '>=4.0.0'}
xml2js@0.6.2:
resolution: {integrity: sha512-T4rieHaC1EXcES0Kxxj4JWgaUQHDk+qwHcYOCFHfiwKz7tOVPLq7Hjq9dM1WCMhylqMEfP7hMcOIChvotiZegA==}
engines: {node: '>=4.0.0'}
xmlbuilder@11.0.1:
resolution: {integrity: sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==}
engines: {node: '>=4.0'}
@@ -1088,7 +1102,7 @@ snapshots:
eslint: 8.57.0
eslint-visitor-keys: 3.4.3
'@eslint-community/regexpp@4.10.1': {}
'@eslint-community/regexpp@4.11.0': {}
'@eslint/eslintrc@2.1.4':
dependencies:
@@ -1106,7 +1120,7 @@ snapshots:
'@eslint/js@8.57.0': {}
'@hono/node-server@1.11.2': {}
'@hono/node-server@1.12.0': {}
'@humanwhocodes/config-array@0.11.14':
dependencies:
@@ -1132,100 +1146,104 @@ snapshots:
'@nodelib/fs.scandir': 2.1.5
fastq: 1.17.1
'@types/node@20.14.2':
'@types/node@20.14.11':
dependencies:
undici-types: 5.26.5
'@types/triple-beam@1.3.5': {}
'@typescript-eslint/eslint-plugin@7.13.0(@typescript-eslint/parser@7.13.0(eslint@8.57.0)(typescript@5.4.5))(eslint@8.57.0)(typescript@5.4.5)':
'@types/xml2js@0.4.14':
dependencies:
'@eslint-community/regexpp': 4.10.1
'@typescript-eslint/parser': 7.13.0(eslint@8.57.0)(typescript@5.4.5)
'@typescript-eslint/scope-manager': 7.13.0
'@typescript-eslint/type-utils': 7.13.0(eslint@8.57.0)(typescript@5.4.5)
'@typescript-eslint/utils': 7.13.0(eslint@8.57.0)(typescript@5.4.5)
'@typescript-eslint/visitor-keys': 7.13.0
'@types/node': 20.14.11
'@typescript-eslint/eslint-plugin@7.16.1(@typescript-eslint/parser@7.16.1(eslint@8.57.0)(typescript@5.5.3))(eslint@8.57.0)(typescript@5.5.3)':
dependencies:
'@eslint-community/regexpp': 4.11.0
'@typescript-eslint/parser': 7.16.1(eslint@8.57.0)(typescript@5.5.3)
'@typescript-eslint/scope-manager': 7.16.1
'@typescript-eslint/type-utils': 7.16.1(eslint@8.57.0)(typescript@5.5.3)
'@typescript-eslint/utils': 7.16.1(eslint@8.57.0)(typescript@5.5.3)
'@typescript-eslint/visitor-keys': 7.16.1
eslint: 8.57.0
graphemer: 1.4.0
ignore: 5.3.1
natural-compare: 1.4.0
ts-api-utils: 1.3.0(typescript@5.4.5)
ts-api-utils: 1.3.0(typescript@5.5.3)
optionalDependencies:
typescript: 5.4.5
typescript: 5.5.3
transitivePeerDependencies:
- supports-color
'@typescript-eslint/parser@7.13.0(eslint@8.57.0)(typescript@5.4.5)':
'@typescript-eslint/parser@7.16.1(eslint@8.57.0)(typescript@5.5.3)':
dependencies:
'@typescript-eslint/scope-manager': 7.13.0
'@typescript-eslint/types': 7.13.0
'@typescript-eslint/typescript-estree': 7.13.0(typescript@5.4.5)
'@typescript-eslint/visitor-keys': 7.13.0
'@typescript-eslint/scope-manager': 7.16.1
'@typescript-eslint/types': 7.16.1
'@typescript-eslint/typescript-estree': 7.16.1(typescript@5.5.3)
'@typescript-eslint/visitor-keys': 7.16.1
debug: 4.3.5
eslint: 8.57.0
optionalDependencies:
typescript: 5.4.5
typescript: 5.5.3
transitivePeerDependencies:
- supports-color
'@typescript-eslint/scope-manager@7.13.0':
'@typescript-eslint/scope-manager@7.16.1':
dependencies:
'@typescript-eslint/types': 7.13.0
'@typescript-eslint/visitor-keys': 7.13.0
'@typescript-eslint/types': 7.16.1
'@typescript-eslint/visitor-keys': 7.16.1
'@typescript-eslint/type-utils@7.13.0(eslint@8.57.0)(typescript@5.4.5)':
'@typescript-eslint/type-utils@7.16.1(eslint@8.57.0)(typescript@5.5.3)':
dependencies:
'@typescript-eslint/typescript-estree': 7.13.0(typescript@5.4.5)
'@typescript-eslint/utils': 7.13.0(eslint@8.57.0)(typescript@5.4.5)
'@typescript-eslint/typescript-estree': 7.16.1(typescript@5.5.3)
'@typescript-eslint/utils': 7.16.1(eslint@8.57.0)(typescript@5.5.3)
debug: 4.3.5
eslint: 8.57.0
ts-api-utils: 1.3.0(typescript@5.4.5)
ts-api-utils: 1.3.0(typescript@5.5.3)
optionalDependencies:
typescript: 5.4.5
typescript: 5.5.3
transitivePeerDependencies:
- supports-color
'@typescript-eslint/types@7.13.0': {}
'@typescript-eslint/types@7.16.1': {}
'@typescript-eslint/typescript-estree@7.13.0(typescript@5.4.5)':
'@typescript-eslint/typescript-estree@7.16.1(typescript@5.5.3)':
dependencies:
'@typescript-eslint/types': 7.13.0
'@typescript-eslint/visitor-keys': 7.13.0
'@typescript-eslint/types': 7.16.1
'@typescript-eslint/visitor-keys': 7.16.1
debug: 4.3.5
globby: 11.1.0
is-glob: 4.0.3
minimatch: 9.0.4
semver: 7.6.2
ts-api-utils: 1.3.0(typescript@5.4.5)
minimatch: 9.0.5
semver: 7.6.3
ts-api-utils: 1.3.0(typescript@5.5.3)
optionalDependencies:
typescript: 5.4.5
typescript: 5.5.3
transitivePeerDependencies:
- supports-color
'@typescript-eslint/utils@7.13.0(eslint@8.57.0)(typescript@5.4.5)':
'@typescript-eslint/utils@7.16.1(eslint@8.57.0)(typescript@5.5.3)':
dependencies:
'@eslint-community/eslint-utils': 4.4.0(eslint@8.57.0)
'@typescript-eslint/scope-manager': 7.13.0
'@typescript-eslint/types': 7.13.0
'@typescript-eslint/typescript-estree': 7.13.0(typescript@5.4.5)
'@typescript-eslint/scope-manager': 7.16.1
'@typescript-eslint/types': 7.16.1
'@typescript-eslint/typescript-estree': 7.16.1(typescript@5.5.3)
eslint: 8.57.0
transitivePeerDependencies:
- supports-color
- typescript
'@typescript-eslint/visitor-keys@7.13.0':
'@typescript-eslint/visitor-keys@7.16.1':
dependencies:
'@typescript-eslint/types': 7.13.0
'@typescript-eslint/types': 7.16.1
eslint-visitor-keys: 3.4.3
'@ungap/structured-clone@1.2.0': {}
acorn-jsx@5.3.2(acorn@8.11.3):
acorn-jsx@5.3.2(acorn@8.12.1):
dependencies:
acorn: 8.11.3
acorn: 8.12.1
acorn@8.11.3: {}
acorn@8.12.1: {}
ajv@6.12.6:
dependencies:
@@ -1362,7 +1380,7 @@ snapshots:
css-what@6.1.0: {}
dayjs@1.11.11: {}
dayjs@1.11.12: {}
debug@4.3.5:
dependencies:
@@ -1443,7 +1461,7 @@ snapshots:
eslint@8.57.0:
dependencies:
'@eslint-community/eslint-utils': 4.4.0(eslint@8.57.0)
'@eslint-community/regexpp': 4.10.1
'@eslint-community/regexpp': 4.11.0
'@eslint/eslintrc': 2.1.4
'@eslint/js': 8.57.0
'@humanwhocodes/config-array': 0.11.14
@@ -1459,7 +1477,7 @@ snapshots:
eslint-scope: 7.2.2
eslint-visitor-keys: 3.4.3
espree: 9.6.1
esquery: 1.5.0
esquery: 1.6.0
esutils: 2.0.3
fast-deep-equal: 3.1.3
file-entry-cache: 6.0.1
@@ -1485,11 +1503,11 @@ snapshots:
espree@9.6.1:
dependencies:
acorn: 8.11.3
acorn-jsx: 5.3.2(acorn@8.11.3)
acorn: 8.12.1
acorn-jsx: 5.3.2(acorn@8.12.1)
eslint-visitor-keys: 3.4.3
esquery@1.5.0:
esquery@1.6.0:
dependencies:
estraverse: 5.3.0
@@ -1561,7 +1579,7 @@ snapshots:
fsevents@2.3.3:
optional: true
get-tsconfig@4.7.5:
get-tsconfig@4.7.6:
dependencies:
resolve-pkg-maps: 1.0.0
@@ -1599,7 +1617,7 @@ snapshots:
has-flag@4.0.0: {}
hono@4.4.5: {}
hono@4.5.1: {}
htmlparser2@8.0.2:
dependencies:
@@ -1669,7 +1687,7 @@ snapshots:
lodash.merge@4.6.2: {}
logform@2.6.0:
logform@2.6.1:
dependencies:
'@colors/colors': 1.6.0
'@types/triple-beam': 1.3.5
@@ -1701,7 +1719,7 @@ snapshots:
dependencies:
brace-expansion: 1.1.11
minimatch@9.0.4:
minimatch@9.0.5:
dependencies:
brace-expansion: 2.0.1
@@ -1769,7 +1787,7 @@ snapshots:
prelude-ls@1.2.1: {}
prettier@3.3.2: {}
prettier@3.3.3: {}
proxy-from-env@1.1.0: {}
@@ -1808,7 +1826,7 @@ snapshots:
sax@1.4.1: {}
semver@7.6.2: {}
semver@7.6.3: {}
shebang-command@2.0.0:
dependencies:
@@ -1855,14 +1873,14 @@ snapshots:
triple-beam@1.4.1: {}
ts-api-utils@1.3.0(typescript@5.4.5):
ts-api-utils@1.3.0(typescript@5.5.3):
dependencies:
typescript: 5.4.5
typescript: 5.5.3
tsx@3.14.0:
dependencies:
esbuild: 0.18.20
get-tsconfig: 4.7.5
get-tsconfig: 4.7.6
source-map-support: 0.5.21
optionalDependencies:
fsevents: 2.3.3
@@ -1873,7 +1891,7 @@ snapshots:
type-fest@0.20.2: {}
typescript@5.4.5: {}
typescript@5.5.3: {}
undici-types@5.26.5: {}
@@ -1887,25 +1905,25 @@ snapshots:
dependencies:
isexe: 2.0.0
winston-transport@4.7.0:
winston-transport@4.7.1:
dependencies:
logform: 2.6.0
logform: 2.6.1
readable-stream: 3.6.2
triple-beam: 1.4.1
winston@3.13.0:
winston@3.13.1:
dependencies:
'@colors/colors': 1.6.0
'@dabh/diagnostics': 2.0.3
async: 3.2.5
is-stream: 2.0.1
logform: 2.6.0
logform: 2.6.1
one-time: 1.0.0
readable-stream: 3.6.2
safe-stable-stringify: 2.4.3
stack-trace: 0.0.10
triple-beam: 1.4.1
winston-transport: 4.7.0
winston-transport: 4.7.1
word-wrap@1.2.5: {}
@@ -1920,6 +1938,11 @@ snapshots:
sax: 1.4.1
xmlbuilder: 11.0.1
xml2js@0.6.2:
dependencies:
sax: 1.4.1
xmlbuilder: 11.0.1
xmlbuilder@11.0.1: {}
yocto-queue@0.1.0: {}

46
src/router.types.d.ts vendored
View File

@@ -85,8 +85,8 @@ export type RouterType = {
word: string;
word_scheme: string;
note: string;
category: string;
raw_hot: number;
flag_desc: string;
num: number;
onboard_time: number;
};
zhihu: {
@@ -126,9 +126,7 @@ export type RouterType = {
content: string;
cover: string;
created_at: number;
};
stat: {
view_num: number;
view_status: number;
};
user: {
nickname: string;
@@ -269,4 +267,42 @@ export type RouterType = {
period: string;
productId: string;
};
history: {
year: string;
title: string;
link: string;
desc: string;
cover: string;
pic_share: string;
};
hupu: {
tid: number;
title: string;
replies: number;
username: string;
time: string;
url: string;
};
sina: {
base: {
base: {
uniqueId: string;
url: string;
};
};
info: {
hotValue: string;
title: string;
};
};
"sina-news": {
id: string;
title: string;
media: string;
url: string;
create_date: string;
create_time: string;
top_num: string;
time: string;
};
};

View File

@@ -10,7 +10,7 @@ export const handleRoute = async (c: ListContext, noCache: boolean) => {
name: "36kr",
title: "36氪",
type: "热榜",
parame: {
params: {
type: {
name: "热榜分类",
type: {

View File

@@ -11,7 +11,7 @@ export const handleRoute = async (c: ListContext, noCache: boolean) => {
name: "52pojie",
title: "吾爱破解",
type: "榜单",
parame: {
params: {
type: {
name: "榜单分类",
type: {

View File

@@ -12,7 +12,7 @@ export const handleRoute = async (c: ListContext, noCache: boolean) => {
title: "AcFun",
type: "排行榜",
description: "AcFun是一家弹幕视频网站致力于为每一个人带来欢乐。",
parame: {
params: {
type: {
name: "频道",
type: {

View File

@@ -9,7 +9,7 @@ export const handleRoute = async (c: ListContext, noCache: boolean) => {
name: "baidu",
title: "百度",
type: "热搜榜",
parame: {
params: {
type: {
name: "热搜类别",
type: {

View File

@@ -12,7 +12,7 @@ export const handleRoute = async (c: ListContext, noCache: boolean) => {
title: "哔哩哔哩",
type: "热门榜",
description: "你所热爱的,就是你的生活",
parame: {
params: {
type: {
name: "排行榜分区",
type: {

View File

@@ -18,14 +18,14 @@ export const handleRoute = async (_: undefined, noCache: boolean) => {
};
// 数据处理
const getNumbers = (text: string | undefined) => {
if (!text) return 10000000;
const getNumbers = (text: string | undefined): number => {
if (!text) return 0;
const regex = /\d+/;
const match = text.match(regex);
if (match) {
return Number(match[0]);
} else {
return 10000000;
return 0;
}
};
@@ -44,7 +44,8 @@ const getList = async (noCache: boolean) => {
const listData = listDom.toArray().map((item) => {
const dom = $(item);
const url = dom.find("a").attr("href") || undefined;
const score = dom.find(".rating_nums").text() ?? "0.0";
const scoreDom = dom.find(".rating_nums");
const score = scoreDom.length > 0 ? scoreDom.text() : "0.0";
return {
id: getNumbers(url),
title: `${score}${dom.find("a").attr("title")}`,

View File

@@ -54,8 +54,8 @@ const getList = async (noCache: boolean) => {
title: v.word,
timestamp: getTime(v.event_time),
hot: v.hot_value,
url: `https://www.douyin.com/hot/${encodeURIComponent(v.sentence_id)}`,
mobileUrl: `https://www.douyin.com/hot/${encodeURIComponent(v.sentence_id)}`,
url: `https://www.douyin.com/hot/${v.sentence_id}`,
mobileUrl: `https://www.douyin.com/hot/${v.sentence_id}`,
})),
};
};

View File

@@ -33,7 +33,7 @@ export const handleRoute = async (c: ListContext, noCache: boolean) => {
name: "earthquake",
title: "中国地震台",
type: "地震速报",
parame: {
params: {
type: {
name: "速报分类",
type: {

View File

@@ -10,7 +10,7 @@ export const handleRoute = async (c: ListContext, noCache: boolean) => {
name: "genshin",
title: "原神",
type: "最新动态",
parame: {
params: {
type: {
name: "榜单分类",
type: {
@@ -44,9 +44,9 @@ const getList = async (options: Options, noCache: boolean) => {
title: data.subject,
desc: data.content,
cover: data.cover,
author: v.user.nickname,
author: v.user?.nickname || null,
timestamp: getTime(data.created_at),
hot: v.stat.view_num,
hot: data.view_status,
url: `https://www.miyoushe.com/ys/article/${data.post_id}`,
mobileUrl: `https://m.miyoushe.com/ys/#/article/${data.post_id}`,
};

View File

@@ -11,7 +11,7 @@ export const handleRoute = async (c: ListContext, noCache: boolean) => {
title: "HelloGitHub",
type: "热门仓库",
description: "分享 GitHub 上有趣、入门级的开源项目",
parame: {
params: {
sort: {
name: "排行榜分区",
type: {

View File

@@ -1,22 +1,23 @@
import type { RouterData, ListContext, Options } from "../types.js";
import type { RouterType } from "../router.types.js";
import { load } from "cheerio";
import { get } from "../utils/getData.js";
import { getCurrentDateTime } from "../utils/getTime.js";
export const handleRoute = async (c: ListContext, noCache: boolean) => {
// 获取日期
const day = c.req.query("day") || getCurrentDateTime().day;
const month = c.req.query("month") || getCurrentDateTime().month;
const day = c.req.query("day") || getCurrentDateTime(true).day;
const month = c.req.query("month") || getCurrentDateTime(true).month;
const { fromCache, data, updateTime } = await getList({ month, day }, noCache);
const routeData: RouterData = {
name: "history",
title: "历史上的今天",
type: `${month}-${day}`,
parame: {
params: {
month: "月份",
day: "日期",
},
link: "https://www.lssjt.com/",
link: "https://baike.baidu.com/calendar",
total: data?.length || 0,
updateTime,
fromCache,
@@ -26,26 +27,30 @@ export const handleRoute = async (c: ListContext, noCache: boolean) => {
};
const getList = async (options: Options, noCache: boolean) => {
const { month, day } = options;
const url = `https://www.lssjt.com/${month}/${day}/`;
const result = await get({ url, noCache });
const $ = load(result.data);
const listDom = $("li.circler");
const listData = listDom.toArray().map((item, index) => {
const dom = $(item);
const href = dom.find("a").attr("href");
return {
id: index,
title: dom.find("a.txt").text().trim() || dom.find("a").attr("title"),
cover: dom.find("img").attr("data-original"),
timestamp: dom.find("div.text span").text().trim() || dom.find("div.t span").text().trim(),
hot: null,
url: href || undefined,
mobileUrl: href || undefined,
};
const monthStr = month.toString().padStart(2, "0");
const dayStr = day.toString().padStart(2, "0");
const url = `https://baike.baidu.com/cms/home/eventsOnHistory/${monthStr}.json`;
const result = await get({
url,
noCache,
params: {
_: new Date().getTime(),
},
});
const list = result.data[monthStr][monthStr + dayStr];
return {
fromCache: result.fromCache,
updateTime: result.updateTime,
data: listData,
data: list.map((v: RouterType["history"], index: number) => ({
id: index,
title: load(v.title).text().trim(),
cover: v.cover ? v.pic_share : null || null,
desc: load(v.desc).text().trim(),
year: v.year,
timestamp: null,
hot: null,
url: v.link,
mobileUrl: v.link,
})),
};
};

View File

@@ -10,7 +10,7 @@ export const handleRoute = async (c: ListContext, noCache: boolean) => {
name: "honkai",
title: "崩坏3",
type: "最新动态",
parame: {
params: {
type: {
name: "榜单分类",
type: {
@@ -43,10 +43,10 @@ const getList = async (options: Options, noCache: boolean) => {
id: data.post_id,
title: data.subject,
desc: data.content,
cover: data.cover || v.image_list[0].url,
author: v.user.nickname,
cover: data.cover,
author: v.user?.nickname || null,
timestamp: getTime(data.created_at),
hot: v.stat.view_num,
hot: data.view_status,
url: `https://www.miyoushe.com/bh3/article/${data.post_id}`,
mobileUrl: `https://m.miyoushe.com/bh3/#/article/${data.post_id}`,
};

View File

@@ -11,7 +11,7 @@ export const handleRoute = async (c: ListContext, noCache: boolean) => {
name: "hostloc",
title: "全球主机交流",
type: "榜单",
parame: {
params: {
type: {
name: "榜单分类",
type: {

51
src/routes/hupu.ts Normal file
View File

@@ -0,0 +1,51 @@
import type { RouterData, ListContext, Options } from "../types.js";
import type { RouterType } from "../router.types.js";
import { get } from "../utils/getData.js";
export const handleRoute = async (c: ListContext, noCache: boolean) => {
const type = c.req.query("type") || "1";
const { fromCache, data, updateTime } = await getList({ type }, noCache);
const routeData: RouterData = {
name: "hupu",
title: "虎扑",
type: "步行街热帖",
params: {
type: {
name: "榜单分类",
type: {
1: "主干道",
6: "恋爱区",
11: "校园区",
12: "历史区",
612: "摄影区",
},
},
},
link: "https://bbs.hupu.com/all-gambia",
total: data?.length || 0,
updateTime,
fromCache,
data,
};
return routeData;
};
const getList = async (options: Options, noCache: boolean) => {
const { type } = options;
const url = `https://m.hupu.com/api/v2/bbs/topicThreads?topicId=${type}&page=1`;
const result = await get({ url, noCache });
const list = result.data.data.topicThreads;
return {
fromCache: result.fromCache,
updateTime: result.updateTime,
data: list.map((v: RouterType["hupu"]) => ({
id: v.tid,
title: v.title,
author: v.username,
hot: v.replies,
timestamp: null,
url: `https://bbs.hupu.com/${v.tid}.html`,
mobileUrl: v.url,
})),
};
};

50
src/routes/nodeseek.ts Normal file
View File

@@ -0,0 +1,50 @@
import type { RouterData } from "../types.js";
import { get } from "../utils/getData.js";
import { parseStringPromise } from "xml2js";
export const handleRoute = async (_: undefined, noCache: boolean) => {
const { fromCache, data, updateTime } = await getList(noCache);
const routeData: RouterData = {
name: "nodeseek",
title: "NodeSeek",
type: "最新",
params: {
type: {
name: "分类",
type: {
all: "所有",
},
},
},
link: "https://www.nodeseek.com/",
total: data?.length || 0,
updateTime,
fromCache,
data,
};
return routeData;
};
const getList = async (noCache: boolean) => {
const url = `https://rss.nodeseek.com/`;
const result = await get({ url, noCache });
const rssData = await parseStringPromise(result.data);
const list = rssData.rss.channel[0].item;
return {
fromCache: result.fromCache,
updateTime: result.updateTime,
data: list.map((v: any) => ({
id: v.guid[0]._,
title: v.title[0],
desc: v.description ? v.description[0] : "",
author: v["dc:creator"] ? v["dc:creator"][0] : "unknown",
timestamp: new Date(v.pubDate[0]).getTime(),
hot: null, // NodeSeek RSS 中没有类似于hot的字段
url: v.link[0],
mobileUrl: v.link[0],
})),
};
};

137
src/routes/sina-news.ts Normal file
View File

@@ -0,0 +1,137 @@
import type { RouterData, ListContext, Options } from "../types.js";
import type { RouterType } from "../router.types.js";
import { getTime, getCurrentDateTime } from "../utils/getTime.js";
import { get } from "../utils/getData.js";
// 榜单类别
const listType = {
"1": {
name: "总排行",
www: "news",
params: "www_www_all_suda_suda",
},
"2": {
name: "视频排行",
www: "news",
params: "video_news_all_by_vv",
},
"3": {
name: "图片排行",
www: "news",
params: "total_slide_suda",
},
"4": {
name: "国内新闻",
www: "news",
params: "news_china_suda",
},
"5": {
name: "国际新闻",
www: "news",
params: "news_world_suda",
},
"6": {
name: "社会新闻",
www: "news",
params: "news_society_suda",
},
"7": {
name: "体育新闻",
www: "sports",
params: "sports_suda",
},
"8": {
name: "财经新闻",
www: "finance",
params: "finance_0_suda",
},
"9": {
name: "娱乐新闻",
www: "ent",
params: "ent_suda",
},
"10": {
name: "科技新闻",
www: "tech",
params: "tech_news_suda",
},
"11": {
name: "军事新闻",
www: "news",
params: "news_mil_suda",
},
};
export const handleRoute = async (c: ListContext, noCache: boolean) => {
const type = c.req.query("type") || "1";
const { fromCache, data, updateTime } = await getList({ type }, noCache);
const routeData: RouterData = {
name: "sina-news",
title: "新浪新闻",
type: listType[type].name,
params: {
type: {
name: "榜单分类",
type: Object.fromEntries(Object.entries(listType).map(([key, value]) => [key, value.name])),
},
},
link: "https://sinanews.sina.cn/",
total: data?.length || 0,
updateTime,
fromCache,
data,
};
return routeData;
};
// JSONP 处理
const parseData = (data: string) => {
// 移除前后多余空白
if (!data) throw new Error("Input data is empty or invalid");
// 提取 JSON 字符串部分
const prefix = "var data = ";
if (!data.startsWith(prefix))
throw new Error("Input data does not start with the expected prefix");
let jsonString = data.slice(prefix.length).trim();
// 确保字符串以 ';' 结尾并移除它
if (jsonString.endsWith(";")) {
jsonString = jsonString.slice(0, -1).trim();
} else {
throw new Error("Input data does not end with a semicolon");
}
// 格式是否正确
if (jsonString.startsWith("{") && jsonString.endsWith("}")) {
// 解析为 JSON 对象
try {
const jsonData = JSON.parse(jsonString);
return jsonData;
} catch (error) {
throw new Error("Failed to parse JSON: " + error.message);
}
} else {
throw new Error("Invalid JSON format");
}
};
const getList = async (options: Options, noCache: boolean) => {
const { type } = options;
// 必要数据
const { params, www } = listType[type];
const { year, month, day } = getCurrentDateTime(true);
const url = `https://top.${www}.sina.com.cn/ws/GetTopDataList.php?top_type=day&top_cat=${params}&top_time=${year + month + day}&top_show_num=50`;
const result = await get({ url, noCache });
const list = parseData(result.data).data;
return {
fromCache: result.fromCache,
updateTime: result.updateTime,
data: list.map((v: RouterType["sina-news"]) => ({
id: v.id,
title: v.title,
author: v.media || null,
hot: parseFloat(v.top_num.replace(/,/g, "")),
timestamp: getTime(v.create_date + " " + v.create_time),
url: v.url,
mobileUrl: v.url,
})),
};
};

62
src/routes/sina.ts Normal file
View File

@@ -0,0 +1,62 @@
import type { RouterData, ListContext, Options } from "../types.js";
import type { RouterType } from "../router.types.js";
import { parseChineseNumber } from "../utils/getNum.js";
import { get } from "../utils/getData.js";
export const handleRoute = async (c: ListContext, noCache: boolean) => {
const type = c.req.query("type") || "1";
const { fromCache, data, updateTime } = await getList({ type }, noCache);
const routeData: RouterData = {
name: "sina",
title: "新浪网",
type: "热榜太多,一个就够",
params: {
type: {
name: "榜单分类",
type: {
all: "新浪热榜",
hotcmnt: "热议榜",
minivideo: "视频热榜",
ent: "娱乐热榜",
ai: "AI热榜",
auto: "汽车热榜",
mother: "育儿热榜",
fashion: "时尚热榜",
travel: "旅游热榜",
esg: "ESG热榜",
},
},
},
link: "https://sinanews.sina.cn/",
total: data?.length || 0,
updateTime,
fromCache,
data,
};
return routeData;
};
const getList = async (options: Options, noCache: boolean) => {
const { type } = options;
const url = `https://newsapp.sina.cn/api/hotlist?newsId=HB-1-snhs%2Ftop_news_list-${type}`;
const result = await get({ url, noCache });
const list = result.data.data.hotList;
return {
fromCache: result.fromCache,
updateTime: result.updateTime,
data: list.map((v: RouterType["sina"]) => {
const base = v.base;
const info = v.info;
return {
id: base.base.uniqueId,
title: info.title,
desc: null,
author: null,
timestamp: null,
hot: parseChineseNumber(info.hotValue),
url: base.base.url,
mobileUrl: base.base.url,
};
}),
};
};

View File

@@ -10,7 +10,7 @@ export const handleRoute = async (c: ListContext, noCache: boolean) => {
name: "sspai",
title: "少数派",
type: "热榜",
parame: {
params: {
type: {
name: "分类",
type: ["热门文章", "应用推荐", "生活方式", "效率技巧", "少数派播客"],

View File

@@ -10,7 +10,7 @@ export const handleRoute = async (c: ListContext, noCache: boolean) => {
name: "starrail",
title: "崩坏:星穹铁道",
type: "最新动态",
parame: {
params: {
type: {
name: "榜单分类",
type: {
@@ -44,9 +44,9 @@ const getList = async (options: Options, noCache: boolean) => {
title: data.subject,
desc: data.content,
cover: data.cover,
author: v.user.nickname,
author: v.user?.nickname || null,
timestamp: getTime(data.created_at),
hot: v.stat.view_num,
hot: data.view_status,
url: `https://www.miyoushe.com/sr/article/${data.post_id}`,
mobileUrl: `https://m.miyoushe.com/sr/#/article/${data.post_id}`,
};

View File

@@ -9,7 +9,7 @@ export const handleRoute = async (c: ListContext, noCache: boolean) => {
name: "v2ex",
title: "V2EX",
type: "主题榜",
parame: {
params: {
type: {
name: "榜单分类",
type: {

View File

@@ -10,7 +10,7 @@ export const handleRoute = async (c: ListContext, noCache: boolean) => {
name: "weatheralarm",
title: "中央气象台",
type: type || "全国气象预警",
parame: {
params: {
province: {
name: "预警区域",
value: "省份名称( 例如:广东省 ",

View File

@@ -32,9 +32,9 @@ const getList = async (noCache: boolean) => {
id: v.mid,
title: v.word,
desc: v.note || key,
author: v.category,
author: v.flag_desc,
timestamp: getTime(v.onboard_time),
hot: v.raw_hot,
hot: v.num,
url: `https://s.weibo.com/weibo?q=${encodeURIComponent(key)}&t=31&band_rank=1&Refer=top`,
mobileUrl: `https://s.weibo.com/weibo?q=${encodeURIComponent(
key,

View File

@@ -33,7 +33,7 @@ const getList = async (noCache: boolean) => {
desc: data.excerpt,
cover: v.children[0].thumbnail,
timestamp: getTime(data.created),
hot: parseInt(v.detail_text.replace(/[^\d]/g, "")) * 10000,
hot: parseFloat(v.detail_text.split(" ")[0]) * 10000,
url: `https://www.zhihu.com/question/${data.id}`,
mobileUrl: `https://www.zhihu.com/question/${data.id}`,
};

2
src/types.d.ts vendored
View File

@@ -22,7 +22,7 @@ export type RouterData = {
title: string;
type: string;
description?: string;
parame?: Record<string, string | object>;
params?: Record<string, string | object>;
total: number;
link?: string;
updateTime: string;

20
src/utils/getNum.ts Normal file
View File

@@ -0,0 +1,20 @@
export const parseChineseNumber = (chineseNumber: string): number => {
// 单位对照表
const units: { [key: string]: number } = {
亿: 1e8,
: 1e4,
: 1e3,
: 1e2,
};
// 遍历单位对照表
for (const unit in units) {
if (chineseNumber.includes(unit)) {
// 转换为数字
const numberPart = parseFloat(chineseNumber.replace(unit, ""));
return numberPart * units[unit];
}
}
return parseFloat(chineseNumber);
};

View File

@@ -1,12 +1,12 @@
import dayjs from "dayjs";
interface CurrentDateTime {
year: number;
month: number;
day: number;
hour: number;
minute: number;
second: number;
year: string;
month: string;
day: string;
hour: string;
minute: string;
second: string;
}
export const getTime = (timeInput: string | number): number | null => {
try {
@@ -65,15 +65,18 @@ export const getTime = (timeInput: string | number): number | null => {
}
};
export const getCurrentDateTime = (): CurrentDateTime => {
export const getCurrentDateTime = (padZero: boolean = false): CurrentDateTime => {
const now = dayjs();
// 补零
const pad = (num: number): string => (num < 10 ? `0${num}` : `${num}`);
return {
year: now.year(),
month: now.month() + 1,
day: now.date(),
hour: now.hour(),
minute: now.minute(),
second: now.second(),
year: now.year().toString(),
month: padZero ? pad(now.month() + 1) : (now.month() + 1).toString(),
day: padZero ? pad(now.date()) : now.date().toString(),
hour: padZero ? pad(now.hour()) : now.hour().toString(),
minute: padZero ? pad(now.minute()) : now.minute().toString(),
second: padZero ? pad(now.second()) : now.second().toString(),
};
};