rsshub 1.0.0-master.ddad734 → 1.0.0-master.dddc5cc

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (555) hide show
  1. package/README.md +13 -48
  2. package/lib/api/radar/rules/all.ts +3 -6
  3. package/lib/api/radar/rules/one.ts +3 -6
  4. package/lib/app.tsx +2 -0
  5. package/lib/config.ts +40 -6
  6. package/lib/errors/index.test.ts +1 -1
  7. package/lib/errors/index.tsx +10 -3
  8. package/lib/index.ts +1 -1
  9. package/lib/middleware/anti-hotlink.test.ts +197 -12
  10. package/lib/middleware/anti-hotlink.ts +29 -1
  11. package/lib/middleware/logger.ts +6 -2
  12. package/lib/middleware/parameter.test.ts +22 -5
  13. package/lib/middleware/parameter.ts +47 -17
  14. package/lib/middleware/template.tsx +14 -10
  15. package/lib/middleware/trace.ts +25 -0
  16. package/lib/registry.test.ts +8 -0
  17. package/lib/registry.ts +8 -0
  18. package/lib/router.js +1 -4
  19. package/lib/routes/141jav/index.ts +25 -21
  20. package/lib/routes/141ppv/index.ts +24 -20
  21. package/lib/routes/4ksj/forum.ts +54 -20
  22. package/lib/routes/500px/tribe-set.ts +3 -2
  23. package/lib/routes/51cto/recommend.ts +45 -7
  24. package/lib/routes/51read/article.ts +82 -0
  25. package/lib/routes/51read/namespace.ts +6 -0
  26. package/lib/routes/5eplay/utils.ts +5 -3
  27. package/lib/routes/abc/index.ts +2 -2
  28. package/lib/routes/academia/namespace.ts +1 -1
  29. package/lib/routes/agri/index.ts +307 -0
  30. package/lib/routes/agri/namespace.ts +8 -0
  31. package/lib/routes/agri/templates/description.art +21 -0
  32. package/lib/routes/aljazeera/index.ts +2 -2
  33. package/lib/routes/anime1/anime.ts +63 -0
  34. package/lib/routes/anime1/namespace.ts +6 -0
  35. package/lib/routes/anime1/search.ts +57 -0
  36. package/lib/routes/apnews/api.ts +62 -0
  37. package/lib/routes/apnews/rss.ts +3 -2
  38. package/lib/routes/apnews/sitemap.ts +99 -0
  39. package/lib/routes/apnews/topics.ts +4 -3
  40. package/lib/routes/apnews/utils.ts +7 -5
  41. package/lib/routes/apple/apps.ts +30 -8
  42. package/lib/routes/apple/podcast.ts +1 -1
  43. package/lib/routes/asus/bios.ts +88 -21
  44. package/lib/routes/asus/templates/bios.art +13 -6
  45. package/lib/routes/autocentre/index.ts +29 -0
  46. package/lib/routes/autocentre/namespace.ts +7 -0
  47. package/lib/routes/bbc/index.ts +3 -1
  48. package/lib/routes/behance/user.ts +14 -3
  49. package/lib/routes/beijingprice/index.ts +12 -12
  50. package/lib/routes/bestblogs/feeds.ts +107 -0
  51. package/lib/routes/bestblogs/namespace.ts +6 -0
  52. package/lib/routes/bilibili/api-interface.d.ts +1 -0
  53. package/lib/routes/bilibili/bangumi.ts +3 -2
  54. package/lib/routes/bilibili/bilibili-recommend.ts +42 -0
  55. package/lib/routes/bilibili/cache.ts +25 -1
  56. package/lib/routes/bilibili/dynamic.ts +105 -102
  57. package/lib/routes/bilibili/followings-video.ts +9 -3
  58. package/lib/routes/bilibili/ranking.ts +2 -1
  59. package/lib/routes/bilibili/readlist.ts +3 -2
  60. package/lib/routes/bilibili/utils.ts +5 -0
  61. package/lib/routes/bilibili/video.ts +4 -2
  62. package/lib/routes/binance/announcement.ts +168 -0
  63. package/lib/routes/binance/types.ts +26 -0
  64. package/lib/routes/bing/daily-wallpaper.ts +1 -1
  65. package/lib/routes/bitget/announcement.ts +200 -0
  66. package/lib/routes/bitget/namespace.ts +6 -0
  67. package/lib/routes/bitget/type.ts +26 -0
  68. package/lib/routes/bjnews/cat.ts +43 -0
  69. package/lib/routes/bjnews/column.ts +43 -0
  70. package/lib/routes/bjnews/namespace.ts +6 -0
  71. package/lib/routes/bjnews/utils.ts +19 -0
  72. package/lib/routes/bjp/apod.ts +4 -2
  73. package/lib/routes/bjx/fd.ts +35 -26
  74. package/lib/routes/buaa/jiaowu.ts +1 -1
  75. package/lib/routes/buaa/lib/space/newbook.ts +171 -0
  76. package/lib/routes/buaa/lib/space/templates/newbook.art +44 -0
  77. package/lib/routes/bupt/jwc.ts +130 -0
  78. package/lib/routes/caixin/latest.ts +3 -2
  79. package/lib/routes/cccfna/index.ts +2 -2
  80. package/lib/routes/ccfa/index.ts +216 -0
  81. package/lib/routes/ccfa/namespace.ts +8 -0
  82. package/lib/routes/ccfa/templates/description.art +7 -0
  83. package/lib/routes/cctv/category.ts +16 -12
  84. package/lib/routes/cctv/xwlb.ts +32 -10
  85. package/lib/routes/cdu/jwgg.ts +79 -0
  86. package/lib/routes/cdu/namespace.ts +6 -0
  87. package/lib/routes/cffex/announcement.ts +73 -0
  88. package/lib/routes/cffex/namespace.ts +6 -0
  89. package/lib/routes/changba/user.ts +6 -5
  90. package/lib/routes/chikubi/index.ts +75 -0
  91. package/lib/routes/chikubi/namespace.ts +6 -0
  92. package/lib/routes/chikubi/utils.ts +82 -0
  93. package/lib/routes/chlinlearn/daily-blog.ts +55 -0
  94. package/lib/routes/chlinlearn/namespcae.ts +6 -0
  95. package/lib/routes/cls/subject.ts +153 -0
  96. package/lib/routes/cls/templates/description.art +21 -0
  97. package/lib/routes/cnbc/rss.ts +1 -1
  98. package/lib/routes/copymanga/comic.ts +3 -1
  99. package/lib/routes/deeplearning/thebatch.ts +30 -18
  100. package/lib/routes/devolverdigital/blog.ts +59 -42
  101. package/lib/routes/devtrium/namespace.ts +6 -0
  102. package/lib/routes/devtrium/posts.ts +55 -0
  103. package/lib/routes/digitalcameraworld/news.ts +1 -1
  104. package/lib/routes/discord/channel.ts +10 -10
  105. package/lib/routes/discord/discord-api.ts +27 -32
  106. package/lib/routes/discord/templates/message.art +15 -0
  107. package/lib/routes/discourse/notifications.ts +2 -1
  108. package/lib/routes/discourse/official.ts +55 -0
  109. package/lib/routes/dockerhub/build.ts +3 -2
  110. package/lib/routes/dockerhub/utils.ts +4 -3
  111. package/lib/routes/dongqiudi/result.ts +1 -1
  112. package/lib/routes/douban/movie/coming.ts +68 -0
  113. package/lib/routes/douban/other/group.ts +2 -1
  114. package/lib/routes/douban/templates/movie_coming.art +27 -0
  115. package/lib/routes/duckdb/namespace.ts +6 -0
  116. package/lib/routes/duckdb/news.ts +65 -0
  117. package/lib/routes/dykszx/namespace.ts +8 -0
  118. package/lib/routes/dykszx/news.ts +88 -0
  119. package/lib/routes/eagle/blog.ts +13 -2
  120. package/lib/routes/eastmoney/report/index.ts +63 -15
  121. package/lib/routes/eastmoney/templates/stock_description.art +36 -0
  122. package/lib/routes/eastmoney/utils.ts +35 -0
  123. package/lib/routes/easynomad/joblist.ts +56 -0
  124. package/lib/routes/easynomad/namespace.ts +6 -0
  125. package/lib/routes/economist/espresso.ts +3 -2
  126. package/lib/routes/economist/full.ts +3 -2
  127. package/lib/routes/epicgames/index.ts +15 -5
  128. package/lib/routes/espn/namespace.ts +6 -0
  129. package/lib/routes/espn/news.ts +120 -0
  130. package/lib/routes/espn/templates/media.art +19 -0
  131. package/lib/routes/fashionnetwork/index.ts +192 -0
  132. package/lib/routes/fashionnetwork/namespace.ts +8 -0
  133. package/lib/routes/fashionnetwork/templates/description.art +17 -0
  134. package/lib/routes/fediverse/timeline.ts +37 -19
  135. package/lib/routes/flashcat/blog.ts +61 -0
  136. package/lib/routes/flashcat/namespace.ts +6 -0
  137. package/lib/routes/follow/namespace.ts +6 -0
  138. package/lib/routes/follow/profile.ts +69 -0
  139. package/lib/routes/follow/types.ts +38 -0
  140. package/lib/routes/foresightnews/util.ts +1 -1
  141. package/lib/routes/fortunechina/index.ts +24 -14
  142. package/lib/routes/ftm/index.ts +60 -0
  143. package/lib/routes/ftm/namespace.ts +6 -0
  144. package/lib/routes/galxe/index.ts +94 -0
  145. package/lib/routes/galxe/namespace.ts +9 -0
  146. package/lib/routes/gamer/ani/anime.ts +10 -3
  147. package/lib/routes/gamer/ani/new-anime.ts +4 -3
  148. package/lib/routes/gamer/gnn-index.ts +31 -11
  149. package/lib/routes/gamer/hot.ts +4 -3
  150. package/lib/routes/gamersky/ent.ts +57 -0
  151. package/lib/routes/gamersky/namespace.ts +10 -0
  152. package/lib/routes/gamersky/news.ts +91 -0
  153. package/lib/routes/gamersky/review.ts +80 -0
  154. package/lib/routes/gamersky/utils.ts +94 -0
  155. package/lib/routes/gdut/oa-news.ts +12 -17
  156. package/lib/routes/geekpark/index.ts +219 -0
  157. package/lib/routes/geekpark/namespace.ts +8 -0
  158. package/lib/routes/geekpark/templates/description.art +21 -0
  159. package/lib/routes/getitfree/util.ts +1 -1
  160. package/lib/routes/gisreportsonline/index.ts +60 -0
  161. package/lib/routes/gisreportsonline/namespace.ts +6 -0
  162. package/lib/routes/github/activity.ts +56 -0
  163. package/lib/routes/github/comments.ts +32 -30
  164. package/lib/routes/github/issue.ts +3 -2
  165. package/lib/routes/github/search.ts +20 -18
  166. package/lib/routes/github/star.ts +4 -3
  167. package/lib/routes/github/trending.ts +27 -5
  168. package/lib/routes/go/mhlw/pdf.ts +87 -0
  169. package/lib/routes/go/namespace.ts +8 -0
  170. package/lib/routes/go/niid/idwr-dl.ts +104 -0
  171. package/lib/routes/google/citations.ts +2 -2
  172. package/lib/routes/google/research.ts +45 -0
  173. package/lib/routes/google/scholar.ts +2 -2
  174. package/lib/routes/gov/cbirc/index.ts +371 -0
  175. package/lib/routes/gov/chongqing/sydwgkzp.ts +4 -4
  176. package/lib/routes/gov/cn/namespace.ts +8 -0
  177. package/lib/routes/gov/{news → cn/news}/index.ts +11 -7
  178. package/lib/routes/gov/lswz/index.ts +289 -0
  179. package/lib/routes/gov/ndrc/fggz.ts +637 -2
  180. package/lib/routes/gov/ndrc/namespace.ts +8 -0
  181. package/lib/routes/gov/ndrc/xwdt.ts +28 -8
  182. package/lib/routes/gov/ndrc/zfxxgk/articles.ts +73 -0
  183. package/lib/routes/gov/zj/ningbogzw-notice.ts +50 -0
  184. package/lib/routes/gov/zj/ningborsjnotice.ts +50 -0
  185. package/lib/routes/gq/news.ts +4 -3
  186. package/lib/routes/gs/developer/blog.ts +58 -0
  187. package/lib/routes/gs/namespace.ts +9 -0
  188. package/lib/routes/hackernews/index.ts +16 -5
  189. package/lib/routes/healthz.ts +8 -0
  190. package/lib/routes/hitcon/zeroday.ts +1 -1
  191. package/lib/routes/hket/index.ts +80 -76
  192. package/lib/routes/hottoys/index.ts +63 -0
  193. package/lib/routes/hottoys/namespace.ts +6 -0
  194. package/lib/routes/hpoi/all.ts +17 -6
  195. package/lib/routes/hpoi/character.ts +18 -6
  196. package/lib/routes/hpoi/info.ts +11 -6
  197. package/lib/routes/hpoi/user.ts +16 -4
  198. package/lib/routes/hpoi/utils.ts +36 -3
  199. package/lib/routes/hpoi/work.ts +18 -6
  200. package/lib/routes/hust/gs.ts +281 -0
  201. package/lib/routes/hust/namespace.ts +1 -1
  202. package/lib/routes/huxiu/util.ts +2 -2
  203. package/lib/routes/imhcg/blog.ts +47 -0
  204. package/lib/routes/imhcg/namespace.ts +7 -0
  205. package/lib/routes/imop/namespace.ts +10 -0
  206. package/lib/routes/imop/tianshu.ts +53 -0
  207. package/lib/routes/infzm/hot.ts +39 -0
  208. package/lib/routes/infzm/index.ts +3 -30
  209. package/lib/routes/infzm/utils.ts +34 -0
  210. package/lib/routes/inspirehep/author.ts +46 -0
  211. package/lib/routes/inspirehep/literature.ts +42 -0
  212. package/lib/routes/inspirehep/namespace.ts +7 -0
  213. package/lib/routes/inspirehep/types.ts +210 -0
  214. package/lib/routes/inspirehep/utils.ts +15 -0
  215. package/lib/routes/instagram/private-api/index.ts +20 -3
  216. package/lib/routes/iplaysoft/index.ts +68 -0
  217. package/lib/routes/iplaysoft/namespace.ts +6 -0
  218. package/lib/routes/iwara/subscriptions.ts +1 -1
  219. package/lib/routes/j-test/namespace.ts +6 -0
  220. package/lib/routes/j-test/news.ts +64 -0
  221. package/lib/routes/japanpost/namespace.ts +7 -1
  222. package/lib/routes/japanpost/router.ts +40 -0
  223. package/lib/routes/japanpost/track.ts +1 -23
  224. package/lib/routes/javbus/index.ts +2 -1
  225. package/lib/routes/javdb/actors.ts +6 -2
  226. package/lib/routes/jianshu/collection.ts +3 -2
  227. package/lib/routes/jianshu/home.ts +3 -2
  228. package/lib/routes/jianshu/user.ts +3 -2
  229. package/lib/routes/jike/topic.ts +10 -3
  230. package/lib/routes/jike/user.ts +3 -2
  231. package/lib/routes/jjwxc/book.ts +22 -17
  232. package/lib/routes/joins/chinese.ts +218 -0
  233. package/lib/routes/joins/namespace.ts +8 -0
  234. package/lib/routes/joins/templates/description.art +17 -0
  235. package/lib/routes/juejin/dynamic.ts +114 -0
  236. package/lib/routes/kakuyomu/namespace.ts +6 -0
  237. package/lib/routes/kakuyomu/types.ts +6 -0
  238. package/lib/routes/kakuyomu/works.ts +73 -0
  239. package/lib/routes/kaopu/news.ts +3 -3
  240. package/lib/routes/kemono/index.ts +21 -0
  241. package/lib/routes/keylol/index.ts +56 -11
  242. package/lib/routes/kurogames/namespace.ts +7 -0
  243. package/lib/routes/kurogames/wutheringwaves/news.ts +59 -0
  244. package/lib/routes/kyodonews/index.ts +1 -1
  245. package/lib/routes/lemmy/index.ts +30 -3
  246. package/lib/routes/lemmy/namespace.ts +1 -0
  247. package/lib/routes/link3/events.ts +86 -0
  248. package/lib/routes/link3/namespace.ts +6 -0
  249. package/lib/routes/link3/profile.ts +143 -0
  250. package/lib/routes/linkedin/cn/renderer.ts +1 -1
  251. package/lib/routes/lmu/jobs.ts +96 -0
  252. package/lib/routes/lmu/namespace.ts +17 -0
  253. package/lib/routes/lmu/templates/jobPosting.art +11 -0
  254. package/lib/routes/lofter/collection.ts +87 -0
  255. package/lib/routes/lofter/user.ts +3 -2
  256. package/lib/routes/luma/index.ts +92 -0
  257. package/lib/routes/luma/namespace.ts +6 -0
  258. package/lib/routes/maccms/index.ts +72 -0
  259. package/lib/routes/maccms/namespace.ts +9 -0
  260. package/lib/routes/maccms/type.ts +102 -0
  261. package/lib/routes/malaysiakini/index.ts +179 -0
  262. package/lib/routes/malaysiakini/namespace.ts +11 -0
  263. package/lib/routes/mastodon/account-id.ts +26 -3
  264. package/lib/routes/mastodon/acct.ts +15 -4
  265. package/lib/routes/mastodon/timeline-local.ts +14 -3
  266. package/lib/routes/mastodon/timeline-remote.ts +14 -3
  267. package/lib/routes/mcmod/index.ts +105 -0
  268. package/lib/routes/mcmod/namespace.ts +6 -0
  269. package/lib/routes/mcmod/templates/mod.art +13 -0
  270. package/lib/routes/meishichina/index.ts +1997 -0
  271. package/lib/routes/meishichina/namespace.ts +8 -0
  272. package/lib/routes/metacritic/index.ts +10 -0
  273. package/lib/routes/metrics.ts +12 -0
  274. package/lib/routes/mihoyo/bbs/img-ranking.ts +4 -4
  275. package/lib/routes/mihoyo/bbs/static-data.ts +7 -0
  276. package/lib/routes/minecraft/version.ts +1 -1
  277. package/lib/routes/mirrormedia/category.ts +101 -0
  278. package/lib/routes/mirrormedia/index.ts +3 -16
  279. package/lib/routes/mirrormedia/utils.ts +19 -0
  280. package/lib/routes/misskey/featured-notes.ts +3 -2
  281. package/lib/routes/misskey/user-timeline.ts +43 -0
  282. package/lib/routes/misskey/utils.ts +41 -1
  283. package/lib/routes/nasa/apod.ts +4 -3
  284. package/lib/routes/nasa/namespace.ts +1 -1
  285. package/lib/routes/natgeo/dailyphoto.ts +5 -4
  286. package/lib/routes/natgeo/dailyselection.ts +18 -3
  287. package/lib/routes/nationalgeographic/latest-stories.ts +1 -1
  288. package/lib/routes/nationalgeographic/templates/stories.art +1 -1
  289. package/lib/routes/neea/index.ts +47 -19
  290. package/lib/routes/neea/jlpt.ts +12 -15
  291. package/lib/routes/neea/namespace.ts +2 -2
  292. package/lib/routes/newyorker/news.ts +29 -21
  293. package/lib/routes/nga/forum.ts +3 -2
  294. package/lib/routes/nhk/news.ts +32 -15
  295. package/lib/routes/nicovideo/namespace.ts +7 -0
  296. package/lib/routes/nicovideo/templates/video.art +7 -0
  297. package/lib/routes/nicovideo/types.ts +54 -0
  298. package/lib/routes/nicovideo/utils.ts +37 -0
  299. package/lib/routes/nicovideo/video.ts +47 -0
  300. package/lib/routes/nyaa/main.ts +2 -3
  301. package/lib/routes/nyaa/namespace.ts +10 -0
  302. package/lib/routes/nytimes/book.ts +14 -17
  303. package/lib/routes/nytimes/index.ts +16 -9
  304. package/lib/routes/obsidian/namespace.ts +6 -0
  305. package/lib/routes/obsidian/publish.ts +83 -0
  306. package/lib/routes/obsidian/utils.ts +8 -0
  307. package/lib/routes/oct0pu5/namespace.ts +10 -0
  308. package/lib/routes/oct0pu5/rss.ts +48 -0
  309. package/lib/routes/oschina/news.ts +2 -0
  310. package/lib/routes/pconline/focus.ts +143 -0
  311. package/lib/routes/pconline/namespace.ts +10 -0
  312. package/lib/routes/people/index.ts +8 -2
  313. package/lib/routes/picnob/namespace.ts +1 -4
  314. package/lib/routes/picnob/user.ts +14 -5
  315. package/lib/routes/picuki/namespace.ts +1 -4
  316. package/lib/routes/picuki/profile.ts +11 -7
  317. package/lib/routes/pixiv/ranking.ts +3 -1
  318. package/lib/routes/pixiv/search.ts +22 -2
  319. package/lib/routes/pixiv/user.ts +2 -1
  320. package/lib/routes/pixiv/utils.ts +3 -3
  321. package/lib/routes/pixivision/index.ts +84 -0
  322. package/lib/routes/pixivision/namespace.ts +6 -0
  323. package/lib/routes/pixivision/utils.ts +86 -0
  324. package/lib/routes/pku/bbs/hot.ts +1 -1
  325. package/lib/routes/pornhub/category.ts +3 -2
  326. package/lib/routes/pornhub/model.ts +4 -3
  327. package/lib/routes/pornhub/pornstar.ts +65 -15
  328. package/lib/routes/pornhub/search.ts +3 -2
  329. package/lib/routes/ps/monthly-games.ts +3 -2
  330. package/lib/routes/psyche/topic.ts +1 -1
  331. package/lib/routes/psyche/type.ts +1 -1
  332. package/lib/routes/psyche/utils.ts +1 -1
  333. package/lib/routes/qiche365/namespace.ts +5 -0
  334. package/lib/routes/qiche365/recall.ts +53 -0
  335. package/lib/routes/qidian/chapter.ts +4 -3
  336. package/lib/routes/qidian/namespace.ts +1 -1
  337. package/lib/routes/questn/community.ts +76 -0
  338. package/lib/routes/questn/events.ts +101 -0
  339. package/lib/routes/questn/namespace.ts +6 -0
  340. package/lib/routes/questn/util.ts +16 -0
  341. package/lib/routes/readwise/list.ts +152 -0
  342. package/lib/routes/readwise/namespace.ts +6 -0
  343. package/lib/routes/rebase/geekdaily.ts +35 -0
  344. package/lib/routes/rebase/namespace.ts +6 -0
  345. package/lib/routes/reuters/common.ts +56 -2
  346. package/lib/routes/rss3/index.ts +157 -0
  347. package/lib/routes/rss3/interfaces/metadata.ts +67 -0
  348. package/lib/routes/rss3/namespace.ts +7 -0
  349. package/lib/routes/rsshub/routes.ts +20 -13
  350. package/lib/routes/samd/news.ts +2 -2
  351. package/lib/routes/sara/index.ts +1 -1
  352. package/lib/routes/sciencedirect/cf-email.ts +0 -1
  353. package/lib/routes/scut/gzic/media.ts +71 -0
  354. package/lib/routes/scut/gzic/news.ts +65 -0
  355. package/lib/routes/scut/gzic/notice.ts +88 -0
  356. package/lib/routes/sdu/{cs.ts → cs/index.ts} +46 -12
  357. package/lib/routes/sdu/cs/yjsgz.ts +85 -0
  358. package/lib/routes/sdu/gjsw.ts +80 -0
  359. package/lib/routes/sdu/namespace.ts +2 -2
  360. package/lib/routes/sdu/qd/xszxqd.ts +98 -0
  361. package/lib/routes/sdu/qd/xyb.ts +82 -0
  362. package/lib/routes/sdu/ygb.ts +90 -0
  363. package/lib/routes/shiep/config.ts +4 -10
  364. package/lib/routes/shiep/index.ts +9 -9
  365. package/lib/routes/showstart/artist.ts +5 -4
  366. package/lib/routes/showstart/brand.ts +5 -4
  367. package/lib/routes/showstart/event.ts +8 -7
  368. package/lib/routes/showstart/search.ts +43 -9
  369. package/lib/routes/showstart/service.ts +81 -53
  370. package/lib/routes/showstart/site.ts +41 -0
  371. package/lib/routes/showstart/utils.ts +9 -8
  372. package/lib/routes/sis001/author.ts +52 -0
  373. package/lib/routes/sis001/common.ts +38 -0
  374. package/lib/routes/sis001/forum.ts +2 -29
  375. package/lib/routes/sjtu/jwc.ts +4 -1
  376. package/lib/routes/sjtu/namespace.ts +1 -1
  377. package/lib/routes/sjtu/seiee/index.ts +97 -0
  378. package/lib/routes/smzdm/keyword.ts +3 -2
  379. package/lib/routes/smzdm/product.ts +85 -0
  380. package/lib/routes/smzdm/ranking.ts +180 -46
  381. package/lib/routes/solidot/main.ts +28 -12
  382. package/lib/routes/soundon/namespace.ts +6 -0
  383. package/lib/routes/soundon/podcast.ts +80 -0
  384. package/lib/routes/soundon/types.ts +67 -0
  385. package/lib/routes/spotify/artist.ts +3 -2
  386. package/lib/routes/spotify/playlist.ts +3 -2
  387. package/lib/routes/spotify/show.ts +1 -1
  388. package/lib/routes/springer/journal.ts +10 -12
  389. package/lib/routes/sse/sselawsrules.ts +370 -0
  390. package/lib/routes/sspai/author.ts +1 -1
  391. package/lib/routes/sspai/column.ts +1 -1
  392. package/lib/routes/sspai/index.ts +6 -5
  393. package/lib/routes/sspai/matrix.ts +1 -1
  394. package/lib/routes/sspai/series-update.ts +1 -1
  395. package/lib/routes/sspai/tag.ts +1 -1
  396. package/lib/routes/sspai/topic.ts +1 -1
  397. package/lib/routes/sustainabilitymag/articles.ts +2 -0
  398. package/lib/routes/sustainabilitymag/namespace.ts +1 -1
  399. package/lib/routes/swjtu/scai/bks.ts +76 -0
  400. package/lib/routes/szse/rule.ts +315 -42
  401. package/lib/routes/t66y/index.ts +29 -7
  402. package/lib/routes/taoguba/blog.ts +1 -1
  403. package/lib/routes/taoguba/index.ts +1 -1
  404. package/lib/routes/techcrunch/news.ts +20 -29
  405. package/lib/routes/techcrunch/templates/description.art +7 -0
  406. package/lib/routes/telecompaper/news.ts +1 -1
  407. package/lib/routes/telegram/blog.ts +3 -2
  408. package/lib/routes/telegram/channel.ts +37 -3
  409. package/lib/routes/telegram/stickerpack.ts +3 -2
  410. package/lib/routes/tencent/news/author.ts +2 -1
  411. package/lib/routes/test/index.ts +50 -43
  412. package/lib/routes/the/index.ts +214 -0
  413. package/lib/routes/the/namespace.ts +8 -0
  414. package/lib/routes/the/templates/description.art +27 -0
  415. package/lib/routes/the/util.ts +307 -0
  416. package/lib/routes/theblockbeats/index.ts +10 -5
  417. package/lib/routes/theinitium/app.ts +137 -0
  418. package/lib/routes/theinitium/templates/description.art +17 -0
  419. package/lib/routes/thoughtworks/index.ts +71 -0
  420. package/lib/routes/thoughtworks/namespace.ts +6 -0
  421. package/lib/routes/threads/index.ts +26 -20
  422. package/lib/routes/tju/cic/index.ts +2 -2
  423. package/lib/routes/tju/news/index.ts +2 -2
  424. package/lib/routes/tju/oaa/index.ts +2 -2
  425. package/lib/routes/towardsdatascience/latest.ts +67 -0
  426. package/lib/routes/towardsdatascience/namespace.ts +6 -0
  427. package/lib/routes/tvb/news.ts +1 -0
  428. package/lib/routes/twitch/live.ts +3 -2
  429. package/lib/routes/twitch/video.ts +15 -6
  430. package/lib/routes/twitter/api/index.ts +3 -1
  431. package/lib/routes/twitter/api/mobile-api/login.ts +155 -131
  432. package/lib/routes/twitter/api/web-api/api.ts +19 -0
  433. package/lib/routes/twitter/api/web-api/constants.ts +17 -14
  434. package/lib/routes/twitter/api/web-api/login.ts +73 -0
  435. package/lib/routes/twitter/api/web-api/utils.ts +154 -64
  436. package/lib/routes/twitter/home-latest.ts +60 -0
  437. package/lib/routes/twitter/home.ts +2 -2
  438. package/lib/routes/twitter/keyword.ts +3 -2
  439. package/lib/routes/twitter/likes.ts +1 -1
  440. package/lib/routes/twitter/list.ts +6 -3
  441. package/lib/routes/twitter/media.ts +4 -3
  442. package/lib/routes/twitter/namespace.ts +2 -2
  443. package/lib/routes/twitter/tweet.ts +1 -0
  444. package/lib/routes/twitter/user.ts +5 -4
  445. package/lib/routes/twitter/utils.ts +4 -1
  446. package/lib/routes/uber/blog.ts +1 -1
  447. package/lib/routes/udn/breaking-news.ts +9 -0
  448. package/lib/routes/ustc/scms.ts +97 -0
  449. package/lib/routes/v2ex/tab.ts +3 -2
  450. package/lib/routes/v2ex/topics.ts +19 -3
  451. package/lib/routes/v2ex/xna.ts +55 -0
  452. package/lib/routes/vimeo/category.ts +4 -3
  453. package/lib/routes/vimeo/usr-videos.ts +3 -2
  454. package/lib/routes/voronoiapp/author.ts +41 -0
  455. package/lib/routes/voronoiapp/common.ts +247 -0
  456. package/lib/routes/voronoiapp/editors-pick.ts +28 -0
  457. package/lib/routes/voronoiapp/home.ts +29 -0
  458. package/lib/routes/voronoiapp/latest.ts +28 -0
  459. package/lib/routes/voronoiapp/namespace.ts +6 -0
  460. package/lib/routes/voronoiapp/popular.ts +49 -0
  461. package/lib/routes/voronoiapp/search.ts +33 -0
  462. package/lib/routes/voronoiapp/types.d.ts +78 -0
  463. package/lib/routes/watasuke/blog.ts +1 -1
  464. package/lib/routes/wchscu/namespace.ts +6 -0
  465. package/lib/routes/wchscu/recruit.ts +73 -0
  466. package/lib/routes/weibo/keyword.ts +3 -2
  467. package/lib/routes/weibo/namespace.ts +2 -1
  468. package/lib/routes/weibo/oasis/user.ts +1 -1
  469. package/lib/routes/weibo/search/hot.ts +12 -7
  470. package/lib/routes/weibo/super-index.ts +23 -11
  471. package/lib/routes/weibo/user.ts +15 -3
  472. package/lib/routes/weibo/utils.ts +20 -4
  473. package/lib/routes/wfu/news.ts +1 -1
  474. package/lib/routes/whu/cs.ts +11 -3
  475. package/lib/routes/whu/gs/index.ts +2 -1
  476. package/lib/routes/whu/news.ts +27 -2
  477. package/lib/routes/withgoogle/explorables.ts +54 -0
  478. package/lib/routes/withgoogle/namespace.ts +6 -0
  479. package/lib/routes/wordpress/util.ts +1 -1
  480. package/lib/routes/xiaohongshu/notes.ts +10 -2
  481. package/lib/routes/xiaohongshu/user.ts +30 -6
  482. package/lib/routes/xiaohongshu/util.ts +3 -1
  483. package/lib/routes/xiaoyuzhou/podcast.ts +2 -1
  484. package/lib/routes/xidian/cs.ts +143 -0
  485. package/lib/routes/xidian/gr.ts +289 -0
  486. package/lib/routes/xidian/jwc.ts +1 -0
  487. package/lib/routes/xidian/namespace.ts +1 -1
  488. package/lib/routes/xinhuanet/app.ts +109 -0
  489. package/lib/routes/xinhuanet/namespace.ts +8 -0
  490. package/lib/routes/xsijishe/forum.ts +5 -0
  491. package/lib/routes/xsijishe/rank.ts +23 -3
  492. package/lib/routes/xueqiu/cookies.ts +14 -1
  493. package/lib/routes/xueqiu/favorite.ts +16 -2
  494. package/lib/routes/yahoo/news/index.ts +149 -0
  495. package/lib/routes/yahoo/news/listid.ts +67 -0
  496. package/lib/routes/yahoo/news/{tw/provider-helper.ts → provider-helper.ts} +9 -4
  497. package/lib/routes/yahoo/news/{tw/provider.ts → provider.ts} +21 -6
  498. package/lib/routes/yahoo/news/{tw/utils.ts → utils.ts} +24 -15
  499. package/lib/routes/yicai/carousel.ts +48 -0
  500. package/lib/routes/yicai/utils.ts +23 -17
  501. package/lib/routes/yilinzazhi/index.ts +58 -0
  502. package/lib/routes/yilinzazhi/latest.ts +103 -0
  503. package/lib/routes/yilinzazhi/namespace.ts +8 -0
  504. package/lib/routes/youtube/playlist.ts +3 -2
  505. package/lib/routes/youtube/subscriptions.ts +1 -0
  506. package/lib/routes/youtube/user.ts +2 -1
  507. package/lib/routes/yystv/docs.ts +28 -19
  508. package/lib/routes/zaobao/util.ts +1 -1
  509. package/lib/routes/zcool/discover.ts +2 -1
  510. package/lib/routes/zhihu/activities.ts +2 -1
  511. package/lib/routes/zhihu/answers.ts +5 -1
  512. package/lib/routes/zhihu/execlib/x-zse-96-v3.ts +2 -0
  513. package/lib/routes/zhihu/hot.ts +56 -7
  514. package/lib/routes/zhihu/namespace.ts +3 -0
  515. package/lib/routes/zhihu/utils.ts +21 -7
  516. package/lib/routes/zhihu/zhuanlan.ts +8 -7
  517. package/lib/routes/zhuwang/index.ts +1 -1
  518. package/lib/routes/zsxq/types.ts +9 -0
  519. package/lib/routes/zsxq/utils.ts +4 -3
  520. package/lib/routes.test.ts +11 -5
  521. package/lib/setup.test.ts +1 -1
  522. package/lib/types.ts +20 -0
  523. package/lib/utils/cache/index.ts +8 -0
  524. package/lib/utils/camelcase-keys.spec.ts +127 -0
  525. package/lib/utils/camelcase-keys.ts +27 -0
  526. package/lib/utils/common-utils.ts +1 -0
  527. package/lib/utils/ofetch.ts +14 -0
  528. package/lib/utils/otel/index.ts +2 -0
  529. package/lib/utils/otel/metric.ts +67 -0
  530. package/lib/utils/otel/trace.ts +28 -0
  531. package/lib/utils/request-rewriter/fetch.ts +8 -1
  532. package/lib/views/atom.tsx +2 -2
  533. package/lib/views/error.tsx +3 -3
  534. package/lib/views/index.tsx +7 -9
  535. package/lib/views/json.ts +2 -2
  536. package/lib/views/layout.tsx +1 -1
  537. package/lib/views/rss.tsx +9 -2
  538. package/package.json +60 -48
  539. package/lib/routes/moduzy/index.ts +0 -80
  540. package/lib/routes/moduzy/namespace.ts +0 -17
  541. package/lib/routes/moduzy/type.ts +0 -95
  542. package/lib/routes/sse/lawandrules.ts +0 -68
  543. package/lib/routes/yahoo/news/tw/index.ts +0 -80
  544. package/lib/routes/yahoo/news/us/index.ts +0 -55
  545. package/lib/routes/zhihu/hotlist.ts +0 -72
  546. package/lib/routes-deprecated/anime1/anime.js +0 -25
  547. package/lib/routes-deprecated/anime1/search.js +0 -25
  548. package/lib/routes-deprecated/bjnews/news.js +0 -44
  549. package/lib/routes-deprecated/dykszx/news.js +0 -60
  550. package/lib/routes-deprecated/gamersky/ent.js +0 -89
  551. package/lib/routes-deprecated/gamersky/news.js +0 -34
  552. package/lib/routes-deprecated/geekpark/breakingnews.js +0 -25
  553. package/lib/routes-deprecated/iplay/home.js +0 -26
  554. package/lib/routes-deprecated/iplay/utils.js +0 -57
  555. /package/lib/routes/{moduzy → maccms}/templates/vod.art +0 -0
@@ -17,7 +17,7 @@ const matchPath = (path: string, paths: string[]) => {
17
17
  return false;
18
18
  };
19
19
 
20
- // return ture if the path needs to be processed
20
+ // return true if the path needs to be processed
21
21
  const filterPath = (path: string) => {
22
22
  const include = config.hotlink.includePaths;
23
23
  const exclude = config.hotlink.excludePaths;
@@ -44,6 +44,18 @@ const parseUrl = (str: string) => {
44
44
 
45
45
  return url;
46
46
  };
47
+
48
+ const replaceUrl = (template?: string, url?: string) => {
49
+ if (!template || !url) {
50
+ return url;
51
+ }
52
+ const oldUrl = parseUrl(url);
53
+ if (oldUrl && oldUrl.protocol !== 'data:') {
54
+ return interpolate(template, oldUrl);
55
+ }
56
+ return url;
57
+ };
58
+
47
59
  const replaceUrls = ($: CheerioAPI, selector: string, template: string, attribute = 'src') => {
48
60
  $(selector).each(function () {
49
61
  const oldSrc = $(this).attr(attribute);
@@ -120,6 +132,9 @@ const middleware: MiddlewareHandler = async (ctx, next) => {
120
132
  // image link
121
133
  const data: Data = ctx.get('data');
122
134
  if (data) {
135
+ if (data.image) {
136
+ data.image = replaceUrl(imageHotlinkTemplate, data.image);
137
+ }
123
138
  if (data.description) {
124
139
  data.description = process(data.description, imageHotlinkTemplate, multimediaHotlinkTemplate);
125
140
  }
@@ -129,6 +144,19 @@ const middleware: MiddlewareHandler = async (ctx, next) => {
129
144
  if (item.description) {
130
145
  item.description = process(item.description, imageHotlinkTemplate, multimediaHotlinkTemplate);
131
146
  }
147
+ if (item.enclosure_url && item.enclosure_type) {
148
+ if (item.enclosure_type.startsWith('image/')) {
149
+ item.enclosure_url = replaceUrl(imageHotlinkTemplate, item.enclosure_url);
150
+ } else if (/^(video|audio)\//.test(item.enclosure_type)) {
151
+ item.enclosure_url = replaceUrl(multimediaHotlinkTemplate, item.enclosure_url);
152
+ }
153
+ }
154
+ if (item.image) {
155
+ item.image = replaceUrl(imageHotlinkTemplate, item.image);
156
+ }
157
+ if (item.itunes_item_image) {
158
+ item.itunes_item_image = replaceUrl(imageHotlinkTemplate, item.itunes_item_image);
159
+ }
132
160
  }
133
161
  }
134
162
 
@@ -1,3 +1,4 @@
1
+ import { requestMetric } from '@/utils/otel';
1
2
  import { MiddlewareHandler } from 'hono';
2
3
  import logger from '@/utils/logger';
3
4
  import { getPath, time } from '@/utils/helpers';
@@ -25,7 +26,7 @@ const colorStatus = (status: number) => {
25
26
  };
26
27
 
27
28
  const middleware: MiddlewareHandler = async (ctx, next) => {
28
- const { method, raw } = ctx.req;
29
+ const { method, raw, routePath } = ctx.req;
29
30
  const path = getPath(raw);
30
31
 
31
32
  logger.info(`${LogPrefix.Incoming} ${method} ${path}`);
@@ -34,7 +35,10 @@ const middleware: MiddlewareHandler = async (ctx, next) => {
34
35
 
35
36
  await next();
36
37
 
37
- logger.info(`${LogPrefix.Outgoing} ${method} ${path} ${colorStatus(ctx.res.status)} ${time(start)}`);
38
+ const status = ctx.res.status;
39
+
40
+ logger.info(`${LogPrefix.Outgoing} ${method} ${path} ${colorStatus(status)} ${time(start)}`);
41
+ requestMetric.success(Date.now() - start, { path: routePath, method, status });
38
42
  };
39
43
 
40
44
  export default middleware;
@@ -427,7 +427,8 @@ describe('multi parameter', () => {
427
427
  });
428
428
 
429
429
  describe('openai', () => {
430
- it(`chatgpt`, async () => {
430
+ it('processes both title and description', async () => {
431
+ config.openai.inputOption = 'both';
431
432
  const responseWithGpt = await app.request('/test/gpt?chatgpt=true');
432
433
  const responseNormal = await app.request('/test/gpt');
433
434
 
@@ -437,9 +438,25 @@ describe('openai', () => {
437
438
  const parsedGpt = await parser.parseString(await responseWithGpt.text());
438
439
  const parsedNormal = await parser.parseString(await responseNormal.text());
439
440
 
440
- expect(parsedGpt.items[0].content).not.toBe(undefined);
441
- expect(parsedGpt.items[0].content).toBe(parsedNormal.items[0].content);
442
- expect(parsedGpt.items[1].content).not.toBe(undefined);
443
- expect(parsedGpt.items[1].content).not.toBe(parsedNormal.items[1].content);
441
+ expect(parsedGpt.items[0].title).not.toBe(parsedNormal.items[0].title);
442
+ expect(parsedGpt.items[0].title).toContain('AI processed content.');
443
+ expect(parsedGpt.items[0].content).not.toBe(parsedNormal.items[0].content);
444
+ expect(parsedGpt.items[0].content).toContain('AI processed content.');
445
+ });
446
+
447
+ it('processes title or description', async () => {
448
+ // test title
449
+ config.openai.inputOption = 'title';
450
+ const responseTitleOnly = await app.request('/test/gpt?chatgpt=true');
451
+ const parsedTitleOnly = await parser.parseString(await responseTitleOnly.text());
452
+ expect(parsedTitleOnly.items[0].title).toContain('AI processed content.');
453
+ expect(parsedTitleOnly.items[0].content).not.toContain('AI processed content.');
454
+
455
+ // test description
456
+ config.openai.inputOption = 'description';
457
+ const responseDescriptionOnly = await app.request('/test/gpt?chatgpt=true');
458
+ const parsedDescriptionOnly = await parser.parseString(await responseDescriptionOnly.text());
459
+ expect(parsedDescriptionOnly.items[0].title).not.toContain('AI processed content.');
460
+ expect(parsedDescriptionOnly.items[0].content).toContain('AI processed content.');
444
461
  });
445
462
  });
@@ -32,7 +32,7 @@ const resolveRelativeLink = ($: CheerioAPI, elem: Element, attr: string, baseUrl
32
32
  }
33
33
  };
34
34
 
35
- const summarizeArticle = async (articleText: string) => {
35
+ const getAiCompletion = async (prompt: string, text: string) => {
36
36
  const apiUrl = `${config.openai.endpoint}/chat/completions`;
37
37
  const response = await ofetch(apiUrl, {
38
38
  method: 'POST',
@@ -40,8 +40,8 @@ const summarizeArticle = async (articleText: string) => {
40
40
  model: config.openai.model,
41
41
  max_tokens: config.openai.maxTokens,
42
42
  messages: [
43
- { role: 'system', content: config.openai.prompt },
44
- { role: 'user', content: articleText },
43
+ { role: 'system', content: prompt },
44
+ { role: 'user', content: text },
45
45
  ],
46
46
  temperature: config.openai.temperature,
47
47
  },
@@ -327,23 +327,53 @@ const middleware: MiddlewareHandler = async (ctx, next) => {
327
327
  if (ctx.req.query('chatgpt') && config.openai.apiKey) {
328
328
  data.item = await Promise.all(
329
329
  data.item.map(async (item) => {
330
- if (item.description) {
331
- try {
332
- const summary = await cache.tryGet(`openai:${item.link}`, async () => {
333
- const text = convert(item.description!);
334
- if (text.length < 300) {
335
- return '';
336
- }
337
- const summary_md = await summarizeArticle(text);
338
- return md.render(summary_md);
330
+ try {
331
+ // handle description
332
+ if (config.openai.inputOption === 'description' && item.description) {
333
+ const description = await cache.tryGet(`openai:description:${item.link}`, async () => {
334
+ const description = convert(item.description!);
335
+ const descriptionMd = await getAiCompletion(config.openai.promptDescription, description);
336
+ return md.render(descriptionMd);
339
337
  });
340
- // 将总结结果添加到文章数据中
341
- if (summary !== '') {
342
- item.description = summary + '<hr/><br/>' + item.description;
338
+ // add it to the description
339
+ if (description !== '') {
340
+ item.description = description + '<hr/><br/>' + item.description;
341
+ }
342
+ }
343
+ // handle title
344
+ else if (config.openai.inputOption === 'title' && item.title) {
345
+ const title = await cache.tryGet(`openai:title:${item.link}`, async () => {
346
+ const title = convert(item.title!);
347
+ return await getAiCompletion(config.openai.promptTitle, title);
348
+ });
349
+ // replace the title
350
+ if (title !== '') {
351
+ item.title = title + '';
352
+ }
353
+ }
354
+ // handle both
355
+ else if (config.openai.inputOption === 'both' && item.title && item.description) {
356
+ const title = await cache.tryGet(`openai:title:${item.link}`, async () => {
357
+ const title = convert(item.title!);
358
+ return await getAiCompletion(config.openai.promptTitle, title);
359
+ });
360
+ // replace the title
361
+ if (title !== '') {
362
+ item.title = title + '';
363
+ }
364
+
365
+ const description = await cache.tryGet(`openai:description:${item.link}`, async () => {
366
+ const description = convert(item.description!);
367
+ const descriptionMd = await getAiCompletion(config.openai.promptDescription, description);
368
+ return md.render(descriptionMd);
369
+ });
370
+ // add it to the description
371
+ if (description !== '') {
372
+ item.description = description + '<hr/><br/>' + item.description;
343
373
  }
344
- } catch {
345
- // when openai failed, return default description and not write cache
346
374
  }
375
+ } catch {
376
+ // when openai failed, return default content and not write cache
347
377
  }
348
378
  return item;
349
379
  })
@@ -94,18 +94,22 @@ const middleware: MiddlewareHandler = async (ctx, next) => {
94
94
  return ctx.json(result);
95
95
  }
96
96
 
97
- // retain .ums for backward compatibility
98
- if (outputType === 'ums' || outputType === 'rss3') {
99
- return ctx.json(rss3(result));
100
- } else if (outputType === 'json') {
101
- ctx.header('Content-Type', 'application/feed+json; charset=UTF-8');
102
- return ctx.body(json(result));
103
- } else if (ctx.get('no-content')) {
97
+ if (ctx.get('no-content')) {
104
98
  return ctx.body(null);
105
- } else if (outputType === 'atom') {
106
- return ctx.render(<Atom data={result} />);
107
99
  } else {
108
- return ctx.render(<RSS data={result} />);
100
+ // retain .ums for backward compatibility
101
+ switch (outputType) {
102
+ case 'ums':
103
+ case 'rss3':
104
+ return ctx.json(rss3(result));
105
+ case 'json':
106
+ ctx.header('Content-Type', 'application/feed+json; charset=UTF-8');
107
+ return ctx.body(json(result));
108
+ case 'atom':
109
+ return ctx.render(<Atom data={result} />);
110
+ default:
111
+ return ctx.render(<RSS data={result} />);
112
+ }
109
113
  }
110
114
  };
111
115
 
@@ -0,0 +1,25 @@
1
+ import { MiddlewareHandler } from 'hono';
2
+ import { getPath } from '@/utils/helpers';
3
+ import { config } from '@/config';
4
+ import { tracer } from '@/utils/otel';
5
+
6
+ const middleware: MiddlewareHandler = async (ctx, next) => {
7
+ if (config.debugInfo) {
8
+ // Only enable tracing in debug mode
9
+ const { method, raw } = ctx.req;
10
+ const path = getPath(raw);
11
+
12
+ const span = tracer.startSpan(`${method} ${path}`, {
13
+ kind: 1, // server
14
+ attributes: {},
15
+ });
16
+ span.addEvent('invoking handleRequest');
17
+ await next();
18
+ span.end();
19
+ } else {
20
+ // Skip
21
+ await next();
22
+ }
23
+ };
24
+
25
+ export default middleware;
@@ -29,4 +29,12 @@ describe('registry', () => {
29
29
  const response = await app.request('/favicon.ico');
30
30
  expect(response.status).toBe(200);
31
31
  });
32
+
33
+ // healthz
34
+ it('/healthz', async () => {
35
+ const response = await app.request('/healthz');
36
+ expect(response.status).toBe(200);
37
+ expect(response.headers.get('cache-control')).toBe('no-cache');
38
+ expect(await response.text()).toBe('ok');
39
+ });
32
40
  });
package/lib/registry.ts CHANGED
@@ -4,9 +4,12 @@ import { Hono, type Handler } from 'hono';
4
4
  import path from 'node:path';
5
5
  import { fileURLToPath } from 'node:url';
6
6
  import { serveStatic } from '@hono/node-server/serve-static';
7
+ import { config } from '@/config';
7
8
 
8
9
  import index from '@/routes/index';
10
+ import healthz from '@/routes/healthz';
9
11
  import robotstxt from '@/routes/robots.txt';
12
+ import metrics from '@/routes/metrics';
10
13
 
11
14
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
12
15
 
@@ -98,7 +101,12 @@ for (const namespace in namespaces) {
98
101
  }
99
102
 
100
103
  app.get('/', index);
104
+ app.get('/healthz', healthz);
101
105
  app.get('/robots.txt', robotstxt);
106
+ if (config.debugInfo) {
107
+ // Only enable tracing in debug mode
108
+ app.get('/metrics', metrics);
109
+ }
102
110
  app.use(
103
111
  '/*',
104
112
  serveStatic({
package/lib/router.js CHANGED
@@ -66,9 +66,6 @@ router.get('/konachan.net/post/popular_recent/:period', lazyloadRouteHandler('./
66
66
  // EZTV
67
67
  router.get('/eztv/torrents/:imdb_id', lazyloadRouteHandler('./routes/eztv/imdb'));
68
68
 
69
- // 新京报
70
- router.get('/bjnews/:cat', lazyloadRouteHandler('./routes/bjnews/news'));
71
-
72
69
  // 米哈游
73
70
  router.get('/mihoyo/bh3/:type', lazyloadRouteHandler('./routes/mihoyo/bh3'));
74
71
  router.get('/mihoyo/bh2/:type', lazyloadRouteHandler('./routes/mihoyo/bh2'));
@@ -364,7 +361,7 @@ router.get('/ltaaa/:category?', lazyloadRouteHandler('./routes/ltaaa/index'));
364
361
  router.get('/autotrader/:query', lazyloadRouteHandler('./routes/autotrader'));
365
362
 
366
363
  // 极客公园
367
- router.get('/geekpark/breakingnews', lazyloadRouteHandler('./routes/geekpark/breakingnews'));
364
+ // router.get('/geekpark/breakingnews', lazyloadRouteHandler('./routes/geekpark/breakingnews'));
368
365
 
369
366
  // 搜狗
370
367
  // router.get('/sogou/doodles', lazyloadRouteHandler('./routes/sogou/doodles'));
@@ -10,49 +10,53 @@ import { art } from '@/utils/render';
10
10
  import path from 'node:path';
11
11
 
12
12
  export const route: Route = {
13
- path: '/{.*}?',
13
+ path: '/:type/:keyword{.*}?',
14
14
  categories: ['multimedia'],
15
15
  name: '通用',
16
16
  maintainers: ['cgkings', 'nczitzk'],
17
+ parameters: { type: '类型,可查看下表的类型说明', keyword: '关键词,可查看下表的关键词说明' },
18
+ handler,
17
19
  description: `**类型**
18
20
 
19
- | 最新 | 热门 | 随机 | 指定演员 | 指定标签 |
20
- | ---- | ------- | ------ | -------- | -------- |
21
- | new | popular | random | actress | tag |
21
+ | 最新 | 热门 | 随机 | 指定演员 | 指定标签 | 日期 |
22
+ | ---- | ------- | ------ | -------- | -------- | ---- |
23
+ | new | popular | random | actress | tag | date |
22
24
 
23
- **关键词**
25
+ **关键词**
24
26
 
25
- | 空 | 日期范围 | 演员名 | 标签名 |
26
- | -- | ----------- | ------------ | -------------- |
27
- | | 7 / 30 / 60 | Yua%20Mikami | Adult%20Awards |
27
+ | 空 | 日期范围 | 演员名 | 标签名 | 年月日 |
28
+ | -- | ----------- | ------------ | -------------- | ---------- |
29
+ | | 7 / 30 / 60 | Yua%20Mikami | Adult%20Awards | 2020/07/30 |
28
30
 
29
- **示例说明**
31
+ **示例说明**
30
32
 
31
- - \`/141jav/new\`
33
+ - \`/141jav/new\`
32
34
 
33
- 仅当类型为 \`new\` \`popular\` 或 \`random\` 时关键词为 **空**
35
+ 仅当类型为 \`new\` \`popular\` 或 \`random\` 时关键词为 **空**
34
36
 
35
- - \`/141jav/popular/30\`
37
+ - \`/141jav/popular/30\`
36
38
 
37
- \`popular\` \`random\` 类型的关键词可填写 \`7\` \`30\` 或 \`60\` 三个 **日期范围** 之一,分别对应 **7 天**、**30 天** 或 **60 天内**
39
+ \`popular\` \`random\` 类型的关键词可填写 \`7\` \`30\` 或 \`60\` 三个 **日期范围** 之一,分别对应 **7 天**、**30 天** 或 **60 天内**
38
40
 
39
- - \`/141jav/actress/Yua%20Mikami\`
41
+ - \`/141jav/actress/Yua%20Mikami\`
40
42
 
41
- \`actress\` 类型的关键词必须填写 **演员名** ,可在 [此处](https://141jav.com/actress) 演员单页链接中获取
43
+ \`actress\` 类型的关键词必须填写 **演员名** ,可在 [此处](https://141jav.com/actress/) 演员单页链接中获取
42
44
 
43
- - \`/141jav/tag/Adult%20Awards\`
45
+ - \`/141jav/tag/Adult%20Awards\`
44
46
 
45
- \`tag\` 类型的关键词必须填写 **标签名** 且标签中的 \`/\` 必须替换为 \`%2F\` ,可在 [此处](https://141jav.com/tag) 标签单页链接中获取
47
+ \`tag\` 类型的关键词必须填写 **标签名** 且标签中的 \`/\` 必须替换为 \`%2F\` ,可在 [此处](https://141jav.com/tag/) 标签单页链接中获取
46
48
 
47
- - \`/141jav/date/2020/07/30\`
49
+ - \`/141jav/date/2020/07/30\`
48
50
 
49
- \`date\` 类型的关键词必须填写 **日期**`,
50
- handler,
51
+ \`date\` 类型的关键词必须填写 **日期(年/月/日)**`,
51
52
  };
52
53
 
53
54
  async function handler(ctx) {
54
55
  const rootUrl = 'https://www.141jav.com';
55
- const currentUrl = `${rootUrl}${getSubPath(ctx)}`;
56
+ const type = ctx.req.param('type');
57
+ const keyword = ctx.req.param('keyword') ?? '';
58
+
59
+ const currentUrl = `${rootUrl}/${type}${keyword ? `/${keyword}` : ''}`;
56
60
 
57
61
  const response = await got({
58
62
  method: 'get',
@@ -10,49 +10,53 @@ import { art } from '@/utils/render';
10
10
  import path from 'node:path';
11
11
 
12
12
  export const route: Route = {
13
- path: '/{.*}?',
13
+ path: '/:type/:keyword{.*}?',
14
14
  categories: ['multimedia'],
15
15
  name: '通用',
16
16
  maintainers: ['cgkings', 'nczitzk'],
17
+ parameters: { type: '类型,可查看下表的类型说明', keyword: '关键词,可查看下表的关键词说明' },
17
18
  handler,
18
19
  description: `**类型**
19
20
 
20
- | 最新 | 热门 | 随机 | 指定演员 | 指定标签 |
21
- | ---- | ------- | ------ | -------- | -------- |
22
- | new | popular | random | actress | tag |
21
+ | 最新 | 热门 | 随机 | 指定演员 | 指定标签 | 日期 |
22
+ | ---- | ------- | ------ | -------- | -------- | ---- |
23
+ | new | popular | random | actress | tag | date |
23
24
 
24
- **关键词**
25
+ **关键词**
25
26
 
26
- | 空 | 日期范围 | 演员名 | 标签名 |
27
- | -- | ----------- | ------------ | -------------- |
28
- | | 7 / 30 / 60 | Yua%20Mikami | Adult%20Awards |
27
+ | 空 | 日期范围 | 演员名 | 标签名 | 年月日 |
28
+ | -- | ----------- | ------------ | -------------- | ---------- |
29
+ | | 7 / 30 / 60 | Yua%20Mikami | Adult%20Awards | 2020/07/30 |
29
30
 
30
- **示例说明**
31
+ **示例说明**
31
32
 
32
- - \`/141ppv/new\`
33
+ - \`/141ppv/new\`
33
34
 
34
- 仅当类型为 \`new\` \`popular\` 或 \`random\` 时关键词为 **空**
35
+ 仅当类型为 \`new\` \`popular\` 或 \`random\` 时关键词为 **空**
35
36
 
36
- - \`/141ppv/popular/30\`
37
+ - \`/141ppv/popular/30\`
37
38
 
38
- \`popular\` \`random\` 类型的关键词可填写 \`7\` \`30\` 或 \`60\` 三个 **日期范围** 之一,分别对应 **7 天**、**30 天** 或 **60 天内**
39
+ \`popular\` \`random\` 类型的关键词可填写 \`7\` \`30\` 或 \`60\` 三个 **日期范围** 之一,分别对应 **7 天**、**30 天** 或 **60 天内**
39
40
 
40
- - \`/141ppv/actress/Yua%20Mikami\`
41
+ - \`/141ppv/actress/Yua%20Mikami\`
41
42
 
42
- \`actress\` 类型的关键词必须填写 **演员名** ,可在 [此处](https://141ppv.com/actress) 演员单页链接中获取
43
+ \`actress\` 类型的关键词必须填写 **演员名** ,可在 [此处](https://141ppv.com/actress/) 演员单页链接中获取
43
44
 
44
- - \`/141ppv/tag/Adult%20Awards\`
45
+ - \`/141ppv/tag/Adult%20Awards\`
45
46
 
46
- \`tag\` 类型的关键词必须填写 **标签名** 且标签中的 \`/\` 必须替换为 \`%2F\` ,可在 [此处](https://141ppv.com/tag) 标签单页链接中获取
47
+ \`tag\` 类型的关键词必须填写 **标签名** 且标签中的 \`/\` 必须替换为 \`%2F\` ,可在 [此处](https://141ppv.com/tag/) 标签单页链接中获取
47
48
 
48
- - \`/141ppv/date/2020/07/30\`
49
+ - \`/141ppv/date/2020/07/30\`
49
50
 
50
- \`date\` 类型的关键词必须填写 **日期**`,
51
+ \`date\` 类型的关键词必须填写 **日期(年/月/日)**`,
51
52
  };
52
53
 
53
54
  async function handler(ctx) {
54
55
  const rootUrl = 'https://www.141ppv.com';
55
- const currentUrl = `${rootUrl}${getSubPath(ctx)}`;
56
+ const type = ctx.req.param('type');
57
+ const keyword = ctx.req.param('keyword') ?? '';
58
+
59
+ const currentUrl = `${rootUrl}/${type}${keyword ? `/${keyword}` : ''}`;
56
60
 
57
61
  const response = await got({
58
62
  method: 'get',
@@ -3,13 +3,13 @@ import { getCurrentPath } from '@/utils/helpers';
3
3
  const __dirname = getCurrentPath(import.meta.url);
4
4
 
5
5
  import cache from '@/utils/cache';
6
- import got from '@/utils/got';
6
+ import ofetch from '@/utils/ofetch';
7
7
  import { load } from 'cheerio';
8
8
  import timezone from '@/utils/timezone';
9
9
  import { parseDate } from '@/utils/parse-date';
10
10
  import { art } from '@/utils/render';
11
11
  import path from 'node:path';
12
- import iconv from 'iconv-lite';
12
+ import md5 from '@/utils/md5';
13
13
 
14
14
  export const route: Route = {
15
15
  path: '/:id?',
@@ -27,6 +27,16 @@ export const route: Route = {
27
27
  categories: ['multimedia'],
28
28
  };
29
29
 
30
+ function stringtoHex(acSTR) {
31
+ let val = '';
32
+ for (let i = 0; i <= acSTR.length - 1; i++) {
33
+ const str = acSTR.charAt(i);
34
+ const code = str.codePointAt();
35
+ val += code;
36
+ }
37
+ return val;
38
+ }
39
+
30
40
  async function handler(ctx) {
31
41
  const { id = '4k-uhd-1' } = ctx.req.param();
32
42
  const limit = ctx.req.query('limit') ? Number.parseInt(ctx.req.query('limit')) : 25;
@@ -34,11 +44,13 @@ async function handler(ctx) {
34
44
  const rootUrl = 'https://www.4ksj.com';
35
45
  const currentUrl = new URL(`${id}.html`, rootUrl).href;
36
46
 
37
- const { data: response } = await got(currentUrl, {
38
- responseType: 'buffer',
47
+ const response = await ofetch(currentUrl, {
48
+ responseType: 'arrayBuffer',
39
49
  });
40
50
 
41
- const $ = load(iconv.decode(response, 'gbk'));
51
+ const decoder = new TextDecoder('gbk');
52
+
53
+ const $ = load(decoder.decode(response));
42
54
 
43
55
  const language = 'zh';
44
56
  const image = $('div.nexlogo img').prop('src');
@@ -54,14 +66,42 @@ async function handler(ctx) {
54
66
  };
55
67
  });
56
68
 
69
+ const getCookie = () =>
70
+ cache.tryGet('4ksj:cookie', async () => {
71
+ const response = await ofetch(items[0].link);
72
+ const $ = load(response);
73
+ const scriptPath = $('script').attr('src')!;
74
+ const scriptUrl = new URL(scriptPath, rootUrl).href;
75
+
76
+ const scriptResponse = await ofetch(scriptUrl);
77
+ const key = scriptResponse.match(/{var key="(.*?)"/)?.[1];
78
+ const value = scriptResponse.match(/",value="(.*?)"/)?.[1];
79
+ const getPath = scriptResponse.match(/\.get\("(.*?&key=)"/)?.[1];
80
+
81
+ if (!key || !value || !getPath) {
82
+ throw new Error('Failed to get cookie');
83
+ }
84
+
85
+ const cookieResponse = await ofetch.raw(`${rootUrl}${getPath}${key}&value=${md5(stringtoHex(value))}`);
86
+ return cookieResponse.headers
87
+ .getSetCookie()
88
+ .map((c) => c.split(';')[0])
89
+ .join('; ');
90
+ });
91
+
92
+ const cookie = await getCookie();
93
+
57
94
  items = await Promise.all(
58
95
  items.map((item) =>
59
96
  cache.tryGet(item.link, async () => {
60
- const { data: detailResponse } = await got(item.link, {
61
- responseType: 'buffer',
97
+ const detailResponse = await ofetch(item.link, {
98
+ responseType: 'arrayBuffer',
99
+ headers: {
100
+ Cookie: cookie as string,
101
+ },
62
102
  });
63
103
 
64
- const $$ = load(iconv.decode(detailResponse, 'gbk'));
104
+ const $$ = load(decoder.decode(detailResponse));
65
105
 
66
106
  $$('div.nex_drama_intros em').first().remove();
67
107
  $$('strong font').each((_, el) => {
@@ -86,14 +126,8 @@ async function handler(ctx) {
86
126
  const value = li.find('span').length === 0 ? li.contents().last().text().trim() : li.find('span').text().trim();
87
127
 
88
128
  return { [key]: value };
89
- })
90
- .reduce(
91
- (obj, item) => ({
92
- ...obj,
93
- ...item,
94
- }),
95
- {}
96
- );
129
+ });
130
+ const mergedDetails = Object.assign({}, ...details);
97
131
 
98
132
  const links =
99
133
  $$('td.t_f ignore_js_op').length === 0
@@ -154,17 +188,17 @@ async function handler(ctx) {
154
188
  ]
155
189
  : undefined,
156
190
  title,
157
- keys: Object.keys(details),
158
- details,
191
+ keys: Object.keys(mergedDetails),
192
+ details: mergedDetails,
159
193
  description,
160
194
  info: $$('div.nex_drama_sums').html(),
161
195
  links,
162
196
  });
163
197
  item.pubDate = timezone(parseDate(pubDate, 'YYYY-M-D HH:mm:ss'), +8);
164
- item.category = Object.values(details)
198
+ item.category = Object.values(mergedDetails)
165
199
  .flatMap((c) => c.split(/\s/))
166
200
  .filter(Boolean);
167
- item.author = details['导演'];
201
+ item.author = mergedDetails['导演'];
168
202
  item.content = {
169
203
  html: description,
170
204
  text: $$('div.nex_drama_intros').text(),
@@ -1,4 +1,4 @@
1
- import { Route } from '@/types';
1
+ import { Route, ViewType } from '@/types';
2
2
  import { getCurrentPath } from '@/utils/helpers';
3
3
  const __dirname = getCurrentPath(import.meta.url);
4
4
 
@@ -10,7 +10,8 @@ import { baseUrl, getTribeDetail, getTribeSets } from './utils';
10
10
 
11
11
  export const route: Route = {
12
12
  path: '/tribe/set/:id',
13
- categories: ['picture'],
13
+ categories: ['picture', 'popular'],
14
+ view: ViewType.Pictures,
14
15
  example: '/500px/tribe/set/f5de0b8aa6d54ec486f5e79616418001',
15
16
  parameters: { id: '部落 ID' },
16
17
  name: '部落影集',