@ttkit/daily-hot-api 0.0.0-stage → 0.1.1

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 (450) hide show
  1. package/.env.example +77 -0
  2. package/LICENSE +21 -0
  3. package/README.md +317 -2
  4. package/bin/daily-hot-api.js +25 -0
  5. package/dist/app.controller.d.ts +41 -0
  6. package/dist/app.controller.js +91 -0
  7. package/dist/app.controller.js.map +1 -0
  8. package/dist/app.module.d.ts +4 -0
  9. package/dist/app.module.js +44 -0
  10. package/dist/app.module.js.map +1 -0
  11. package/dist/app.service.d.ts +19 -0
  12. package/dist/app.service.js +57 -0
  13. package/dist/app.service.js.map +1 -0
  14. package/dist/cache/cache.module.d.ts +2 -0
  15. package/dist/cache/cache.module.js +52 -0
  16. package/dist/cache/cache.module.js.map +1 -0
  17. package/dist/cache/cache.service.d.ts +26 -0
  18. package/dist/cache/cache.service.js +163 -0
  19. package/dist/cache/cache.service.js.map +1 -0
  20. package/dist/cli/args.d.ts +24 -0
  21. package/dist/cli/args.js +261 -0
  22. package/dist/cli/args.js.map +1 -0
  23. package/dist/cli/commands/logs.d.ts +3 -0
  24. package/dist/cli/commands/logs.js +55 -0
  25. package/dist/cli/commands/logs.js.map +1 -0
  26. package/dist/cli/commands/restart.d.ts +3 -0
  27. package/dist/cli/commands/restart.js +62 -0
  28. package/dist/cli/commands/restart.js.map +1 -0
  29. package/dist/cli/commands/start.d.ts +3 -0
  30. package/dist/cli/commands/start.js +280 -0
  31. package/dist/cli/commands/start.js.map +1 -0
  32. package/dist/cli/commands/status.d.ts +3 -0
  33. package/dist/cli/commands/status.js +78 -0
  34. package/dist/cli/commands/status.js.map +1 -0
  35. package/dist/cli/commands/stop.d.ts +12 -0
  36. package/dist/cli/commands/stop.js +135 -0
  37. package/dist/cli/commands/stop.js.map +1 -0
  38. package/dist/cli/context.d.ts +4 -0
  39. package/dist/cli/context.js +3 -0
  40. package/dist/cli/context.js.map +1 -0
  41. package/dist/cli/env.d.ts +2 -0
  42. package/dist/cli/env.js +80 -0
  43. package/dist/cli/env.js.map +1 -0
  44. package/dist/cli/errors.d.ts +14 -0
  45. package/dist/cli/errors.js +25 -0
  46. package/dist/cli/errors.js.map +1 -0
  47. package/dist/cli/health.d.ts +2 -0
  48. package/dist/cli/health.js +44 -0
  49. package/dist/cli/health.js.map +1 -0
  50. package/dist/cli/help.d.ts +3 -0
  51. package/dist/cli/help.js +158 -0
  52. package/dist/cli/help.js.map +1 -0
  53. package/dist/cli/index.d.ts +2 -0
  54. package/dist/cli/index.js +94 -0
  55. package/dist/cli/index.js.map +1 -0
  56. package/dist/cli/log-file.d.ts +8 -0
  57. package/dist/cli/log-file.js +58 -0
  58. package/dist/cli/log-file.js.map +1 -0
  59. package/dist/cli/output.d.ts +7 -0
  60. package/dist/cli/output.js +46 -0
  61. package/dist/cli/output.js.map +1 -0
  62. package/dist/cli/paths.d.ts +33 -0
  63. package/dist/cli/paths.js +76 -0
  64. package/dist/cli/paths.js.map +1 -0
  65. package/dist/cli/run-state.d.ts +25 -0
  66. package/dist/cli/run-state.js +159 -0
  67. package/dist/cli/run-state.js.map +1 -0
  68. package/dist/common/middlewares/logger.middleware.d.ts +7 -0
  69. package/dist/common/middlewares/logger.middleware.js +29 -0
  70. package/dist/common/middlewares/logger.middleware.js.map +1 -0
  71. package/dist/config/config.module.d.ts +2 -0
  72. package/dist/config/config.module.js +47 -0
  73. package/dist/config/config.module.js.map +1 -0
  74. package/dist/config/configuration.d.ts +3 -0
  75. package/dist/config/configuration.js +5 -0
  76. package/dist/config/configuration.js.map +1 -0
  77. package/dist/config/validation.schema.d.ts +114 -0
  78. package/dist/config/validation.schema.js +69 -0
  79. package/dist/config/validation.schema.js.map +1 -0
  80. package/dist/daily-brief/clients/ai-analysis.client.d.ts +20 -0
  81. package/dist/daily-brief/clients/ai-analysis.client.js +217 -0
  82. package/dist/daily-brief/clients/ai-analysis.client.js.map +1 -0
  83. package/dist/daily-brief/clients/brief-search.service.d.ts +11 -0
  84. package/dist/daily-brief/clients/brief-search.service.js +52 -0
  85. package/dist/daily-brief/clients/brief-search.service.js.map +1 -0
  86. package/dist/daily-brief/clients/deepseek-search.client.d.ts +11 -0
  87. package/dist/daily-brief/clients/deepseek-search.client.js +70 -0
  88. package/dist/daily-brief/clients/deepseek-search.client.js.map +1 -0
  89. package/dist/daily-brief/clients/tavily-search.client.d.ts +11 -0
  90. package/dist/daily-brief/clients/tavily-search.client.js +72 -0
  91. package/dist/daily-brief/clients/tavily-search.client.js.map +1 -0
  92. package/dist/daily-brief/daily-brief.config.d.ts +31 -0
  93. package/dist/daily-brief/daily-brief.config.js +108 -0
  94. package/dist/daily-brief/daily-brief.config.js.map +1 -0
  95. package/dist/daily-brief/daily-brief.controller.d.ts +72 -0
  96. package/dist/daily-brief/daily-brief.controller.js +169 -0
  97. package/dist/daily-brief/daily-brief.controller.js.map +1 -0
  98. package/dist/daily-brief/daily-brief.module.d.ts +2 -0
  99. package/dist/daily-brief/daily-brief.module.js +49 -0
  100. package/dist/daily-brief/daily-brief.module.js.map +1 -0
  101. package/dist/daily-brief/daily-brief.scheduler.d.ts +30 -0
  102. package/dist/daily-brief/daily-brief.scheduler.js +113 -0
  103. package/dist/daily-brief/daily-brief.scheduler.js.map +1 -0
  104. package/dist/daily-brief/daily-brief.service.d.ts +101 -0
  105. package/dist/daily-brief/daily-brief.service.js +412 -0
  106. package/dist/daily-brief/daily-brief.service.js.map +1 -0
  107. package/dist/daily-brief/dto/brief-date-param.dto.d.ts +3 -0
  108. package/dist/daily-brief/dto/brief-date-param.dto.js +23 -0
  109. package/dist/daily-brief/dto/brief-date-param.dto.js.map +1 -0
  110. package/dist/daily-brief/dto/generate-brief.dto.d.ts +6 -0
  111. package/dist/daily-brief/dto/generate-brief.dto.js +39 -0
  112. package/dist/daily-brief/dto/generate-brief.dto.js.map +1 -0
  113. package/dist/daily-brief/dto/list-briefs-query.dto.d.ts +6 -0
  114. package/dist/daily-brief/dto/list-briefs-query.dto.js +42 -0
  115. package/dist/daily-brief/dto/list-briefs-query.dto.js.map +1 -0
  116. package/dist/daily-brief/dto/stock-ranking-query.dto.d.ts +6 -0
  117. package/dist/daily-brief/dto/stock-ranking-query.dto.js +46 -0
  118. package/dist/daily-brief/dto/stock-ranking-query.dto.js.map +1 -0
  119. package/dist/daily-brief/interfaces/daily-brief.interface.d.ts +59 -0
  120. package/dist/daily-brief/interfaces/daily-brief.interface.js +3 -0
  121. package/dist/daily-brief/interfaces/daily-brief.interface.js.map +1 -0
  122. package/dist/daily-brief/interfaces/search-provider.interface.d.ts +11 -0
  123. package/dist/daily-brief/interfaces/search-provider.interface.js +3 -0
  124. package/dist/daily-brief/interfaces/search-provider.interface.js.map +1 -0
  125. package/dist/daily-brief/utils/brief-date.d.ts +2 -0
  126. package/dist/daily-brief/utils/brief-date.js +16 -0
  127. package/dist/daily-brief/utils/brief-date.js.map +1 -0
  128. package/dist/daily-brief/utils/concurrency.d.ts +1 -0
  129. package/dist/daily-brief/utils/concurrency.js +20 -0
  130. package/dist/daily-brief/utils/concurrency.js.map +1 -0
  131. package/dist/database/database.module.d.ts +2 -0
  132. package/dist/database/database.module.js +57 -0
  133. package/dist/database/database.module.js.map +1 -0
  134. package/dist/database/repositories/daily-brief.repository.d.ts +96 -0
  135. package/dist/database/repositories/daily-brief.repository.js +457 -0
  136. package/dist/database/repositories/daily-brief.repository.js.map +1 -0
  137. package/dist/database/repositories/hot-item.repository.d.ts +52 -0
  138. package/dist/database/repositories/hot-item.repository.js +255 -0
  139. package/dist/database/repositories/hot-item.repository.js.map +1 -0
  140. package/dist/database/repositories/source-config.repository.d.ts +15 -0
  141. package/dist/database/repositories/source-config.repository.js +77 -0
  142. package/dist/database/repositories/source-config.repository.js.map +1 -0
  143. package/dist/database/schemas/daily-brief.schema.d.ts +30 -0
  144. package/dist/database/schemas/daily-brief.schema.js +103 -0
  145. package/dist/database/schemas/daily-brief.schema.js.map +1 -0
  146. package/dist/database/schemas/hot-item.schema.d.ts +20 -0
  147. package/dist/database/schemas/hot-item.schema.js +72 -0
  148. package/dist/database/schemas/hot-item.schema.js.map +1 -0
  149. package/dist/database/schemas/source-config.schema.d.ts +15 -0
  150. package/dist/database/schemas/source-config.schema.js +47 -0
  151. package/dist/database/schemas/source-config.schema.js.map +1 -0
  152. package/dist/history/dto/history-response.dto.d.ts +17 -0
  153. package/dist/history/dto/history-response.dto.js +13 -0
  154. package/dist/history/dto/history-response.dto.js.map +1 -0
  155. package/dist/history/dto/search-history.dto.d.ts +10 -0
  156. package/dist/history/dto/search-history.dto.js +72 -0
  157. package/dist/history/dto/search-history.dto.js.map +1 -0
  158. package/dist/history/history.controller.d.ts +13 -0
  159. package/dist/history/history.controller.js +92 -0
  160. package/dist/history/history.controller.js.map +1 -0
  161. package/dist/history/history.module.d.ts +2 -0
  162. package/dist/history/history.module.js +25 -0
  163. package/dist/history/history.module.js.map +1 -0
  164. package/dist/history/history.service.d.ts +15 -0
  165. package/dist/history/history.service.js +68 -0
  166. package/dist/history/history.service.js.map +1 -0
  167. package/dist/host-lists/decorators/hot-source.decorator.d.ts +9 -0
  168. package/dist/host-lists/decorators/hot-source.decorator.js +11 -0
  169. package/dist/host-lists/decorators/hot-source.decorator.js.map +1 -0
  170. package/dist/host-lists/dto/hot-list.dto.d.ts +14 -0
  171. package/dist/host-lists/dto/hot-list.dto.js +94 -0
  172. package/dist/host-lists/dto/hot-list.dto.js.map +1 -0
  173. package/dist/host-lists/hot-lists.controller.d.ts +39 -0
  174. package/dist/host-lists/hot-lists.controller.js +87 -0
  175. package/dist/host-lists/hot-lists.controller.js.map +1 -0
  176. package/dist/host-lists/hot-lists.module.d.ts +2 -0
  177. package/dist/host-lists/hot-lists.module.js +36 -0
  178. package/dist/host-lists/hot-lists.module.js.map +1 -0
  179. package/dist/host-lists/hot-lists.service.d.ts +21 -0
  180. package/dist/host-lists/hot-lists.service.js +115 -0
  181. package/dist/host-lists/hot-lists.service.js.map +1 -0
  182. package/dist/host-lists/interfaces/hot-list-source.interface.d.ts +5 -0
  183. package/dist/host-lists/interfaces/hot-list-source.interface.js +3 -0
  184. package/dist/host-lists/interfaces/hot-list-source.interface.js.map +1 -0
  185. package/dist/host-lists/interfaces/hot-list.interface.d.ts +31 -0
  186. package/dist/host-lists/interfaces/hot-list.interface.js +3 -0
  187. package/dist/host-lists/interfaces/hot-list.interface.js.map +1 -0
  188. package/dist/host-lists/interfaces/router-data.interface.d.ts +19 -0
  189. package/dist/host-lists/interfaces/router-data.interface.js +3 -0
  190. package/dist/host-lists/interfaces/router-data.interface.js.map +1 -0
  191. package/dist/host-lists/sources/36kr.source.d.ts +9 -0
  192. package/dist/host-lists/sources/36kr.source.js +89 -0
  193. package/dist/host-lists/sources/36kr.source.js.map +1 -0
  194. package/dist/host-lists/sources/51cto.source.d.ts +11 -0
  195. package/dist/host-lists/sources/51cto.source.js +71 -0
  196. package/dist/host-lists/sources/51cto.source.js.map +1 -0
  197. package/dist/host-lists/sources/52pojie.source.d.ts +9 -0
  198. package/dist/host-lists/sources/52pojie.source.js +109 -0
  199. package/dist/host-lists/sources/52pojie.source.js.map +1 -0
  200. package/dist/host-lists/sources/acfun.source.d.ts +9 -0
  201. package/dist/host-lists/sources/acfun.source.js +90 -0
  202. package/dist/host-lists/sources/acfun.source.js.map +1 -0
  203. package/dist/host-lists/sources/baidu.source.d.ts +9 -0
  204. package/dist/host-lists/sources/baidu.source.js +85 -0
  205. package/dist/host-lists/sources/baidu.source.js.map +1 -0
  206. package/dist/host-lists/sources/bilibili.source.d.ts +14 -0
  207. package/dist/host-lists/sources/bilibili.source.js +188 -0
  208. package/dist/host-lists/sources/bilibili.source.js.map +1 -0
  209. package/dist/host-lists/sources/caixin.source.d.ts +9 -0
  210. package/dist/host-lists/sources/caixin.source.js +102 -0
  211. package/dist/host-lists/sources/caixin.source.js.map +1 -0
  212. package/dist/host-lists/sources/cls.source.d.ts +9 -0
  213. package/dist/host-lists/sources/cls.source.js +62 -0
  214. package/dist/host-lists/sources/cls.source.js.map +1 -0
  215. package/dist/host-lists/sources/coolapk.source.d.ts +9 -0
  216. package/dist/host-lists/sources/coolapk.source.js +57 -0
  217. package/dist/host-lists/sources/coolapk.source.js.map +1 -0
  218. package/dist/host-lists/sources/csdn.source.d.ts +9 -0
  219. package/dist/host-lists/sources/csdn.source.js +59 -0
  220. package/dist/host-lists/sources/csdn.source.js.map +1 -0
  221. package/dist/host-lists/sources/dgtle.source.d.ts +9 -0
  222. package/dist/host-lists/sources/dgtle.source.js +57 -0
  223. package/dist/host-lists/sources/dgtle.source.js.map +1 -0
  224. package/dist/host-lists/sources/douban-group.source.d.ts +11 -0
  225. package/dist/host-lists/sources/douban-group.source.js +100 -0
  226. package/dist/host-lists/sources/douban-group.source.js.map +1 -0
  227. package/dist/host-lists/sources/douban-movie.source.d.ts +10 -0
  228. package/dist/host-lists/sources/douban-movie.source.js +103 -0
  229. package/dist/host-lists/sources/douban-movie.source.js.map +1 -0
  230. package/dist/host-lists/sources/douyin.d.ts +16 -0
  231. package/dist/host-lists/sources/douyin.js +215 -0
  232. package/dist/host-lists/sources/douyin.js.map +1 -0
  233. package/dist/host-lists/sources/eastmoney-stock.source.d.ts +11 -0
  234. package/dist/host-lists/sources/eastmoney-stock.source.js +151 -0
  235. package/dist/host-lists/sources/eastmoney-stock.source.js.map +1 -0
  236. package/dist/host-lists/sources/eastmoney.source.d.ts +9 -0
  237. package/dist/host-lists/sources/eastmoney.source.js +86 -0
  238. package/dist/host-lists/sources/eastmoney.source.js.map +1 -0
  239. package/dist/host-lists/sources/geekpark.source.d.ts +9 -0
  240. package/dist/host-lists/sources/geekpark.source.js +60 -0
  241. package/dist/host-lists/sources/geekpark.source.js.map +1 -0
  242. package/dist/host-lists/sources/gelonghui.source.d.ts +9 -0
  243. package/dist/host-lists/sources/gelonghui.source.js +139 -0
  244. package/dist/host-lists/sources/gelonghui.source.js.map +1 -0
  245. package/dist/host-lists/sources/github.source.d.ts +12 -0
  246. package/dist/host-lists/sources/github.source.js +171 -0
  247. package/dist/host-lists/sources/github.source.js.map +1 -0
  248. package/dist/host-lists/sources/guokr.source.d.ts +11 -0
  249. package/dist/host-lists/sources/guokr.source.js +98 -0
  250. package/dist/host-lists/sources/guokr.source.js.map +1 -0
  251. package/dist/host-lists/sources/hackernews.source.d.ts +11 -0
  252. package/dist/host-lists/sources/hackernews.source.js +121 -0
  253. package/dist/host-lists/sources/hackernews.source.js.map +1 -0
  254. package/dist/host-lists/sources/hellogithub.source.d.ts +11 -0
  255. package/dist/host-lists/sources/hellogithub.source.js +98 -0
  256. package/dist/host-lists/sources/hellogithub.source.js.map +1 -0
  257. package/dist/host-lists/sources/history.source.d.ts +11 -0
  258. package/dist/host-lists/sources/history.source.js +92 -0
  259. package/dist/host-lists/sources/history.source.js.map +1 -0
  260. package/dist/host-lists/sources/honkai.source.d.ts +9 -0
  261. package/dist/host-lists/sources/honkai.source.js +72 -0
  262. package/dist/host-lists/sources/honkai.source.js.map +1 -0
  263. package/dist/host-lists/sources/hostloc.source.d.ts +9 -0
  264. package/dist/host-lists/sources/hostloc.source.js +75 -0
  265. package/dist/host-lists/sources/hostloc.source.js.map +1 -0
  266. package/dist/host-lists/sources/hupu.source.d.ts +9 -0
  267. package/dist/host-lists/sources/hupu.source.js +73 -0
  268. package/dist/host-lists/sources/hupu.source.js.map +1 -0
  269. package/dist/host-lists/sources/huxiu.source.d.ts +9 -0
  270. package/dist/host-lists/sources/huxiu.source.js +153 -0
  271. package/dist/host-lists/sources/huxiu.source.js.map +1 -0
  272. package/dist/host-lists/sources/ifanr.source.d.ts +9 -0
  273. package/dist/host-lists/sources/ifanr.source.js +57 -0
  274. package/dist/host-lists/sources/ifanr.source.js.map +1 -0
  275. package/dist/host-lists/sources/index.d.ts +2 -0
  276. package/dist/host-lists/sources/index.js +134 -0
  277. package/dist/host-lists/sources/index.js.map +1 -0
  278. package/dist/host-lists/sources/ithome-xijiayi.source.d.ts +9 -0
  279. package/dist/host-lists/sources/ithome-xijiayi.source.js +75 -0
  280. package/dist/host-lists/sources/ithome-xijiayi.source.js.map +1 -0
  281. package/dist/host-lists/sources/ithome.source.d.ts +9 -0
  282. package/dist/host-lists/sources/ithome.source.js +71 -0
  283. package/dist/host-lists/sources/ithome.source.js.map +1 -0
  284. package/dist/host-lists/sources/jd.source.d.ts +9 -0
  285. package/dist/host-lists/sources/jd.source.js +82 -0
  286. package/dist/host-lists/sources/jd.source.js.map +1 -0
  287. package/dist/host-lists/sources/jianshu.source.d.ts +9 -0
  288. package/dist/host-lists/sources/jianshu.source.js +72 -0
  289. package/dist/host-lists/sources/jianshu.source.js.map +1 -0
  290. package/dist/host-lists/sources/jin10.source.d.ts +9 -0
  291. package/dist/host-lists/sources/jin10.source.js +63 -0
  292. package/dist/host-lists/sources/jin10.source.js.map +1 -0
  293. package/dist/host-lists/sources/juejin.source.d.ts +10 -0
  294. package/dist/host-lists/sources/juejin.source.js +81 -0
  295. package/dist/host-lists/sources/juejin.source.js.map +1 -0
  296. package/dist/host-lists/sources/kuaishou.source.d.ts +13 -0
  297. package/dist/host-lists/sources/kuaishou.source.js +179 -0
  298. package/dist/host-lists/sources/kuaishou.source.js.map +1 -0
  299. package/dist/host-lists/sources/linuxdo.source.d.ts +9 -0
  300. package/dist/host-lists/sources/linuxdo.source.js +62 -0
  301. package/dist/host-lists/sources/linuxdo.source.js.map +1 -0
  302. package/dist/host-lists/sources/lol.source.d.ts +9 -0
  303. package/dist/host-lists/sources/lol.source.js +58 -0
  304. package/dist/host-lists/sources/lol.source.js.map +1 -0
  305. package/dist/host-lists/sources/miyoushe.source.d.ts +9 -0
  306. package/dist/host-lists/sources/miyoushe.source.js +88 -0
  307. package/dist/host-lists/sources/miyoushe.source.js.map +1 -0
  308. package/dist/host-lists/sources/netease-news.source.d.ts +9 -0
  309. package/dist/host-lists/sources/netease-news.source.js +56 -0
  310. package/dist/host-lists/sources/netease-news.source.js.map +1 -0
  311. package/dist/host-lists/sources/ngabbs.source.d.ts +9 -0
  312. package/dist/host-lists/sources/ngabbs.source.js +70 -0
  313. package/dist/host-lists/sources/ngabbs.source.js.map +1 -0
  314. package/dist/host-lists/sources/nodeseek.source.d.ts +9 -0
  315. package/dist/host-lists/sources/nodeseek.source.js +62 -0
  316. package/dist/host-lists/sources/nodeseek.source.js.map +1 -0
  317. package/dist/host-lists/sources/nytimes.source.d.ts +9 -0
  318. package/dist/host-lists/sources/nytimes.source.js +77 -0
  319. package/dist/host-lists/sources/nytimes.source.js.map +1 -0
  320. package/dist/host-lists/sources/producthunt.source.d.ts +9 -0
  321. package/dist/host-lists/sources/producthunt.source.js +75 -0
  322. package/dist/host-lists/sources/producthunt.source.js.map +1 -0
  323. package/dist/host-lists/sources/qq-news.source.d.ts +9 -0
  324. package/dist/host-lists/sources/qq-news.source.js +53 -0
  325. package/dist/host-lists/sources/qq-news.source.js.map +1 -0
  326. package/dist/host-lists/sources/sina-news.source.d.ts +9 -0
  327. package/dist/host-lists/sources/sina-news.source.js +98 -0
  328. package/dist/host-lists/sources/sina-news.source.js.map +1 -0
  329. package/dist/host-lists/sources/sina.source.d.ts +9 -0
  330. package/dist/host-lists/sources/sina.source.js +78 -0
  331. package/dist/host-lists/sources/sina.source.js.map +1 -0
  332. package/dist/host-lists/sources/smzdm.source.d.ts +9 -0
  333. package/dist/host-lists/sources/smzdm.source.js +71 -0
  334. package/dist/host-lists/sources/smzdm.source.js.map +1 -0
  335. package/dist/host-lists/sources/sspai.source.d.ts +9 -0
  336. package/dist/host-lists/sources/sspai.source.js +69 -0
  337. package/dist/host-lists/sources/sspai.source.js.map +1 -0
  338. package/dist/host-lists/sources/starrail.source.d.ts +9 -0
  339. package/dist/host-lists/sources/starrail.source.js +72 -0
  340. package/dist/host-lists/sources/starrail.source.js.map +1 -0
  341. package/dist/host-lists/sources/taobao.source.d.ts +10 -0
  342. package/dist/host-lists/sources/taobao.source.js +169 -0
  343. package/dist/host-lists/sources/taobao.source.js.map +1 -0
  344. package/dist/host-lists/sources/thepaper.source.d.ts +9 -0
  345. package/dist/host-lists/sources/thepaper.source.js +56 -0
  346. package/dist/host-lists/sources/thepaper.source.js.map +1 -0
  347. package/dist/host-lists/sources/tieba.source.d.ts +9 -0
  348. package/dist/host-lists/sources/tieba.source.js +58 -0
  349. package/dist/host-lists/sources/tieba.source.js.map +1 -0
  350. package/dist/host-lists/sources/tonghuashun.source.d.ts +9 -0
  351. package/dist/host-lists/sources/tonghuashun.source.js +112 -0
  352. package/dist/host-lists/sources/tonghuashun.source.js.map +1 -0
  353. package/dist/host-lists/sources/toutiao.source.d.ts +9 -0
  354. package/dist/host-lists/sources/toutiao.source.js +56 -0
  355. package/dist/host-lists/sources/toutiao.source.js.map +1 -0
  356. package/dist/host-lists/sources/v2ex.source.d.ts +9 -0
  357. package/dist/host-lists/sources/v2ex.source.js +67 -0
  358. package/dist/host-lists/sources/v2ex.source.js.map +1 -0
  359. package/dist/host-lists/sources/wallstreet.source.d.ts +9 -0
  360. package/dist/host-lists/sources/wallstreet.source.js +59 -0
  361. package/dist/host-lists/sources/wallstreet.source.js.map +1 -0
  362. package/dist/host-lists/sources/weatheralarm.source.d.ts +9 -0
  363. package/dist/host-lists/sources/weatheralarm.source.js +68 -0
  364. package/dist/host-lists/sources/weatheralarm.source.js.map +1 -0
  365. package/dist/host-lists/sources/weibo.source.d.ts +15 -0
  366. package/dist/host-lists/sources/weibo.source.js +180 -0
  367. package/dist/host-lists/sources/weibo.source.js.map +1 -0
  368. package/dist/host-lists/sources/weread.source.d.ts +9 -0
  369. package/dist/host-lists/sources/weread.source.js +82 -0
  370. package/dist/host-lists/sources/weread.source.js.map +1 -0
  371. package/dist/host-lists/sources/xinyu.source.d.ts +9 -0
  372. package/dist/host-lists/sources/xinyu.source.js +151 -0
  373. package/dist/host-lists/sources/xinyu.source.js.map +1 -0
  374. package/dist/host-lists/sources/yicai.source.d.ts +9 -0
  375. package/dist/host-lists/sources/yicai.source.js +113 -0
  376. package/dist/host-lists/sources/yicai.source.js.map +1 -0
  377. package/dist/host-lists/sources/yystv.source.d.ts +9 -0
  378. package/dist/host-lists/sources/yystv.source.js +57 -0
  379. package/dist/host-lists/sources/yystv.source.js.map +1 -0
  380. package/dist/host-lists/sources/zhihu-daily.source.d.ts +9 -0
  381. package/dist/host-lists/sources/zhihu-daily.source.js +60 -0
  382. package/dist/host-lists/sources/zhihu-daily.source.js.map +1 -0
  383. package/dist/host-lists/sources/zhihu.source.d.ts +12 -0
  384. package/dist/host-lists/sources/zhihu.source.js +195 -0
  385. package/dist/host-lists/sources/zhihu.source.js.map +1 -0
  386. package/dist/http/http.module.d.ts +2 -0
  387. package/dist/http/http.module.js +30 -0
  388. package/dist/http/http.module.js.map +1 -0
  389. package/dist/http/http.service.d.ts +53 -0
  390. package/dist/http/http.service.js +277 -0
  391. package/dist/http/http.service.js.map +1 -0
  392. package/dist/main.d.ts +3 -0
  393. package/dist/main.js +70 -0
  394. package/dist/main.js.map +1 -0
  395. package/dist/rss/rss.module.d.ts +2 -0
  396. package/dist/rss/rss.module.js +21 -0
  397. package/dist/rss/rss.module.js.map +1 -0
  398. package/dist/rss/rss.service.d.ts +5 -0
  399. package/dist/rss/rss.service.js +55 -0
  400. package/dist/rss/rss.service.js.map +1 -0
  401. package/dist/scheduler/dto/trigger-fetch.dto.d.ts +3 -0
  402. package/dist/scheduler/dto/trigger-fetch.dto.js +22 -0
  403. package/dist/scheduler/dto/trigger-fetch.dto.js.map +1 -0
  404. package/dist/scheduler/dto/update-source-config.dto.d.ts +4 -0
  405. package/dist/scheduler/dto/update-source-config.dto.js +29 -0
  406. package/dist/scheduler/dto/update-source-config.dto.js.map +1 -0
  407. package/dist/scheduler/scheduler.controller.d.ts +52 -0
  408. package/dist/scheduler/scheduler.controller.js +132 -0
  409. package/dist/scheduler/scheduler.controller.js.map +1 -0
  410. package/dist/scheduler/scheduler.module.d.ts +2 -0
  411. package/dist/scheduler/scheduler.module.js +34 -0
  412. package/dist/scheduler/scheduler.module.js.map +1 -0
  413. package/dist/scheduler/scheduler.service.d.ts +54 -0
  414. package/dist/scheduler/scheduler.service.js +238 -0
  415. package/dist/scheduler/scheduler.service.js.map +1 -0
  416. package/dist/scheduler/tasks/fetch-hot-data.task.d.ts +34 -0
  417. package/dist/scheduler/tasks/fetch-hot-data.task.js +175 -0
  418. package/dist/scheduler/tasks/fetch-hot-data.task.js.map +1 -0
  419. package/dist/token/coolapk.d.ts +11 -0
  420. package/dist/token/coolapk.js +40 -0
  421. package/dist/token/coolapk.js.map +1 -0
  422. package/dist/token/token.module.d.ts +2 -0
  423. package/dist/token/token.module.js +23 -0
  424. package/dist/token/token.module.js.map +1 -0
  425. package/dist/token/token.service.d.ts +19 -0
  426. package/dist/token/token.service.js +115 -0
  427. package/dist/token/token.service.js.map +1 -0
  428. package/dist/token/tools.d.ts +1 -0
  429. package/dist/token/tools.js +15 -0
  430. package/dist/token/tools.js.map +1 -0
  431. package/dist/token/weread.d.ts +2 -0
  432. package/dist/token/weread.js +55 -0
  433. package/dist/token/weread.js.map +1 -0
  434. package/dist/utils/getNum.d.ts +1 -0
  435. package/dist/utils/getNum.js +20 -0
  436. package/dist/utils/getNum.js.map +1 -0
  437. package/dist/utils/getTime.d.ts +11 -0
  438. package/dist/utils/getTime.js +134 -0
  439. package/dist/utils/getTime.js.map +1 -0
  440. package/dist/utils/headers.d.ts +16 -0
  441. package/dist/utils/headers.js +20 -0
  442. package/dist/utils/headers.js.map +1 -0
  443. package/dist/utils/index.d.ts +1 -0
  444. package/dist/utils/index.js +12 -0
  445. package/dist/utils/index.js.map +1 -0
  446. package/dist/utils/parseRSS.d.ts +11 -0
  447. package/dist/utils/parseRSS.js +47 -0
  448. package/dist/utils/parseRSS.js.map +1 -0
  449. package/package.json +148 -4
  450. package/views/home.hbs +65 -0
@@ -0,0 +1,215 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var DouyinSource_1;
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.DouyinSource = void 0;
14
+ const common_1 = require("@nestjs/common");
15
+ const axios_1 = require("@nestjs/axios");
16
+ const rxjs_1 = require("rxjs");
17
+ const hot_source_decorator_1 = require("../decorators/hot-source.decorator");
18
+ const http_service_1 = require("../../http/http.service");
19
+ const getTime_1 = require("../../utils/getTime");
20
+ let DouyinSource = DouyinSource_1 = class DouyinSource {
21
+ constructor(httpService, axios) {
22
+ this.httpService = httpService;
23
+ this.axios = axios;
24
+ this.logger = new common_1.Logger(DouyinSource_1.name);
25
+ }
26
+ async getList(options, noCache) {
27
+ try {
28
+ const result = await this.fetchFromAPI(noCache);
29
+ return {
30
+ data: result.data || [],
31
+ params: {
32
+ type: {
33
+ name: '热榜类型',
34
+ type: {},
35
+ },
36
+ },
37
+ fromCache: result.fromCache,
38
+ updateTime: result.updateTime,
39
+ };
40
+ }
41
+ catch (error) {
42
+ const errorMessage = error instanceof Error ? error.message : 'Unknown error';
43
+ this.logger.error(`Failed to get list: ${errorMessage}`);
44
+ return {
45
+ data: [],
46
+ params: {
47
+ type: {
48
+ name: '热榜类型',
49
+ type: {},
50
+ },
51
+ },
52
+ fromCache: false,
53
+ updateTime: 0,
54
+ };
55
+ }
56
+ }
57
+ genMsToken() {
58
+ const chars = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz23456789';
59
+ return Array.from({ length: 32 }, () => chars[Math.floor(Math.random() * chars.length)]).join('');
60
+ }
61
+ async getDyCookies() {
62
+ const ua = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36';
63
+ const baseHeaders = {
64
+ 'User-Agent': ua,
65
+ Accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8',
66
+ 'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8',
67
+ };
68
+ const extractCsrf = (setCookies) => {
69
+ const list = Array.isArray(setCookies)
70
+ ? setCookies
71
+ : setCookies
72
+ ? [setCookies]
73
+ : [];
74
+ for (const s of list) {
75
+ const m = s.match(/passport_csrf_token=([^;\s]+)/);
76
+ if (m?.[1])
77
+ return m[1];
78
+ }
79
+ return null;
80
+ };
81
+ try {
82
+ await (0, rxjs_1.firstValueFrom)(this.axios.get('https://www.douyin.com/hot', {
83
+ headers: { ...baseHeaders, Referer: 'https://www.douyin.com/' },
84
+ timeout: 8000,
85
+ validateStatus: () => true,
86
+ maxRedirects: 3,
87
+ }));
88
+ }
89
+ catch {
90
+ }
91
+ try {
92
+ const res = await (0, rxjs_1.firstValueFrom)(this.axios.get('https://www.douyin.com/passport/general/login_guiding_strategy/?aid=6383', {
93
+ headers: { ...baseHeaders, Referer: 'https://www.douyin.com/' },
94
+ timeout: 8000,
95
+ validateStatus: () => true,
96
+ }));
97
+ const setCookie = res.headers?.['set-cookie'];
98
+ const csrf = extractCsrf(setCookie);
99
+ if (csrf) {
100
+ return `passport_csrf_token=${csrf}`;
101
+ }
102
+ }
103
+ catch (e) {
104
+ this.logger.warn(`获取抖音 Cookie 出错: ${e instanceof Error ? e.message : String(e)}`);
105
+ }
106
+ return '';
107
+ }
108
+ async fetchFromAPI(noCache) {
109
+ const msToken = this.genMsToken();
110
+ const url = 'https://www.douyin.com/aweme/v1/web/hot/search/list/?device_platform=webapp&aid=6383&channel=channel_pc_web&detail_list=1&msToken=' +
111
+ encodeURIComponent(msToken);
112
+ const cookie = await this.getDyCookies();
113
+ const headers = {
114
+ Referer: 'https://www.douyin.com/hot',
115
+ 'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8',
116
+ };
117
+ if (cookie)
118
+ headers.Cookie = cookie;
119
+ let response;
120
+ try {
121
+ response = await this.httpService.get({
122
+ url,
123
+ headers,
124
+ noCache,
125
+ });
126
+ }
127
+ catch (e) {
128
+ this.logger.warn(`抖音主 API 失败,尝试备用源: ${e instanceof Error ? e.message : String(e)}`);
129
+ return this.fetchFromFallback(noCache);
130
+ }
131
+ const body = response.data;
132
+ if (!body || typeof body !== 'object') {
133
+ this.logger.warn('抖音主 API 返回非对象,尝试备用源');
134
+ return this.fetchFromFallback(noCache);
135
+ }
136
+ const b = body;
137
+ const raw = b.data?.word_list ?? b.word_list;
138
+ const list = Array.isArray(raw) ? raw : [];
139
+ if (list.length === 0) {
140
+ this.logger.warn('抖音主 API 返回空列表,尝试备用源');
141
+ return this.fetchFromFallback(noCache);
142
+ }
143
+ const data = list.map((item, i) => ({
144
+ id: item.sentence_id ?? `item-${i}`,
145
+ title: item.word ?? String(item.sentence_id ?? i),
146
+ timestamp: (0, getTime_1.getTime)(item.event_time ?? 0) ?? 0,
147
+ hot: item.hot_value ?? 0,
148
+ url: `https://www.douyin.com/hot/${item.sentence_id ?? i}`,
149
+ mobileUrl: `https://www.douyin.com/hot/${item.sentence_id ?? i}`,
150
+ }));
151
+ return {
152
+ data,
153
+ fromCache: response.fromCache,
154
+ updateTime: response.updateTime,
155
+ };
156
+ }
157
+ async fetchFromFallback(noCache) {
158
+ const fallbackUrl = 'https://www.tianchenw.com/hot/douyin';
159
+ try {
160
+ const res = await this.httpService.get({
161
+ url: fallbackUrl,
162
+ headers: {
163
+ Referer: 'https://www.douyin.com/',
164
+ 'Accept-Language': 'zh-CN,zh;q=0.9',
165
+ },
166
+ noCache,
167
+ });
168
+ const raw = res.data;
169
+ if (!raw || typeof raw !== 'object') {
170
+ throw new Error('备用 API 返回非对象');
171
+ }
172
+ const arr = raw.data;
173
+ if (!Array.isArray(arr) || arr.length === 0) {
174
+ throw new Error('备用 API 返回空列表');
175
+ }
176
+ const data = arr.map((v, i) => {
177
+ const id = (v.url && /\/hot\/(\d+)/.exec(v.url)?.[1]) ??
178
+ `fallback-${v.index ?? i}`;
179
+ const link = v.url || `https://www.douyin.com/hot/${id}`;
180
+ return {
181
+ id,
182
+ title: v.title ?? String(id),
183
+ timestamp: (0, getTime_1.getTime)(0) ?? 0,
184
+ hot: v.hot ?? 0,
185
+ url: link,
186
+ mobileUrl: link,
187
+ };
188
+ });
189
+ this.logger.log(`抖音使用备用源成功,共 ${data.length} 条`);
190
+ return {
191
+ data,
192
+ fromCache: res.fromCache,
193
+ updateTime: res.updateTime,
194
+ };
195
+ }
196
+ catch (e) {
197
+ this.logger.warn(`抖音备用源失败: ${e instanceof Error ? e.message : String(e)}`);
198
+ throw e;
199
+ }
200
+ }
201
+ };
202
+ exports.DouyinSource = DouyinSource;
203
+ exports.DouyinSource = DouyinSource = DouyinSource_1 = __decorate([
204
+ (0, common_1.Injectable)(),
205
+ (0, hot_source_decorator_1.HotSource)({
206
+ name: 'douyin',
207
+ title: '抖音',
208
+ type: '热榜',
209
+ description: '实时上升热点',
210
+ link: 'https://www.douyin.com',
211
+ }),
212
+ __metadata("design:paramtypes", [http_service_1.HttpClientService,
213
+ axios_1.HttpService])
214
+ ], DouyinSource);
215
+ //# sourceMappingURL=douyin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"douyin.js","sourceRoot":"","sources":["../../../src/host-lists/sources/douyin.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAoD;AACpD,yCAA4C;AAC5C,+BAAsC;AACtC,6EAA+D;AAM/D,0DAA4D;AAE5D,iDAA8C;AA8BvC,IAAM,YAAY,oBAAlB,MAAM,YAAY;IAGvB,YACmB,WAA8B,EAC9B,KAAkB;QADlB,gBAAW,GAAX,WAAW,CAAmB;QAC9B,UAAK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AAK,EAAE,CAAC,CAAC,KAAK,IAAI,MAAM,CAAC,EAAE,CAAC;oBAC5B,SAAS,EAAE,IAAA,iBAAO,EAAC,CAAC,CAAC,IAAI,CAAC;oBAC1B,GAAG,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC;oBACf,GAAG,EAAE,IAAI;oBACT,SAAS,EAAE,IAAI;iBAChB,CAAC;YACJ,CAAC,CAAC,CAAC;YAEH,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,eAAe,IAAI,CAAC,MAAM,IAAI,CAAC,CAAC;YAChD,OAAO;gBACL,IAAI;gBACJ,SAAS,EAAE,GAAG,CAAC,SAAS;gBACxB,UAAU,EAAE,GAAG,CAAC,UAAU;aAC3B,CAAC;QACJ,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,IAAI,CAAC,MAAM,CAAC,IAAI,CACd,YAAY,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CACzD,CAAC;YACF,MAAM,CAAC,CAAC;QACV,CAAC;IACH,CAAC;CACF,CAAA;AAlPY,oCAAY;uBAAZ,YAAY;IARxB,IAAA,mBAAU,GAAE;IACZ,IAAA,gCAAS,EAAC;QACT,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,IAAI;QACX,IAAI,EAAE,IAAI;QACV,WAAW,EAAE,QAAQ;QACrB,IAAI,EAAE,wBAAwB;KAC/B,CAAC;qCAKgC,gCAAiB;QACvB,mBAAW;GAL1B,YAAY,CAkPxB"}
@@ -0,0 +1,11 @@
1
+ import { HotListSource } from '../interfaces/hot-list-source.interface';
2
+ import { HotListGetListResponse } from '../interfaces/hot-list.interface';
3
+ import { HttpClientService } from '../../http/http.service';
4
+ import { GetListOptions } from './source.types';
5
+ export declare class EastmoneyStockSource implements HotListSource {
6
+ private readonly httpService;
7
+ private readonly logger;
8
+ constructor(httpService: HttpClientService);
9
+ getList(options?: GetListOptions, noCache?: boolean): Promise<HotListGetListResponse>;
10
+ private getQuoteByCode;
11
+ }
@@ -0,0 +1,151 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var EastmoneyStockSource_1;
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.EastmoneyStockSource = void 0;
14
+ const common_1 = require("@nestjs/common");
15
+ const hot_source_decorator_1 = require("../decorators/hot-source.decorator");
16
+ const http_service_1 = require("../../http/http.service");
17
+ const RANK_API = 'https://emappdata.eastmoney.com/stockrank/getAllCurrentList';
18
+ const QUOTE_API = 'https://push2.eastmoney.com/api/qt/ulist.np/get';
19
+ const SITE_URL = 'https://guba.eastmoney.com/rank/';
20
+ const DEFAULT_PAGE_SIZE = 100;
21
+ function stockCodeFromSc(sc) {
22
+ return sc.replace(/^[A-Z]+/i, '');
23
+ }
24
+ function secidFromSc(sc) {
25
+ const match = sc.match(/^(SH|SZ|BJ)(\d{6})$/i);
26
+ if (!match)
27
+ return undefined;
28
+ const [, market, code] = match;
29
+ const marketId = market.toUpperCase() === 'SH' ? 1 : 0;
30
+ return `${marketId}.${code}`;
31
+ }
32
+ function stockUrlFromSc(sc) {
33
+ const match = sc.match(/^(SH|SZ|BJ)(\d{6})$/i);
34
+ if (!match)
35
+ return SITE_URL;
36
+ const [, market, code] = match;
37
+ return `https://quote.eastmoney.com/${market.toLowerCase()}${code}.html`;
38
+ }
39
+ function formatNumber(value) {
40
+ if (value === undefined || value === null || value === '-')
41
+ return undefined;
42
+ return String(value);
43
+ }
44
+ function formatPercent(value) {
45
+ const formatted = formatNumber(value);
46
+ return formatted ? `${formatted}%` : undefined;
47
+ }
48
+ function formatRankChange(value) {
49
+ if (!value)
50
+ return '持平';
51
+ return value > 0 ? `上升 ${value}` : `下降 ${Math.abs(value)}`;
52
+ }
53
+ let EastmoneyStockSource = EastmoneyStockSource_1 = class EastmoneyStockSource {
54
+ constructor(httpService) {
55
+ this.httpService = httpService;
56
+ this.logger = new common_1.Logger(EastmoneyStockSource_1.name);
57
+ }
58
+ async getList(options = {}, noCache) {
59
+ const result = await this.httpService.post({
60
+ url: RANK_API,
61
+ noCache: noCache ?? options.noCache,
62
+ timeout: 10000,
63
+ headers: {
64
+ 'Content-Type': 'application/json',
65
+ Referer: 'https://guba.eastmoney.com/',
66
+ },
67
+ data: {
68
+ appId: 'appId01',
69
+ globalId: '786e4c21-70dc-435a-93bb-38',
70
+ marketType: '',
71
+ pageNo: 1,
72
+ pageSize: DEFAULT_PAGE_SIZE,
73
+ },
74
+ });
75
+ const rankItems = result.data.data ?? [];
76
+ const quoteByCode = await this.getQuoteByCode(rankItems, noCache ?? options.noCache);
77
+ const data = rankItems
78
+ .map((item) => {
79
+ const code = stockCodeFromSc(item.sc);
80
+ const quote = quoteByCode.get(code);
81
+ const name = quote?.f14 || item.sc;
82
+ const price = formatNumber(quote?.f2);
83
+ const changePercent = formatPercent(quote?.f3);
84
+ const descParts = [
85
+ code,
86
+ price ? `现价 ${price}` : undefined,
87
+ changePercent ? `涨跌幅 ${changePercent}` : undefined,
88
+ `排名${formatRankChange(item.rc)}`,
89
+ `24小时${formatRankChange(item.hisRc)}`,
90
+ ].filter(Boolean);
91
+ return {
92
+ id: item.sc,
93
+ title: `${name} (${code})`,
94
+ desc: descParts.join(' | '),
95
+ hot: item.rk,
96
+ url: stockUrlFromSc(item.sc),
97
+ mobileUrl: `https://wap.eastmoney.com/quote/stock/${secidFromSc(item.sc) ?? code}.html`,
98
+ };
99
+ })
100
+ .filter((item) => Boolean(item));
101
+ return {
102
+ data,
103
+ type: '财经',
104
+ fromCache: result.fromCache,
105
+ updateTime: result.updateTime,
106
+ };
107
+ }
108
+ async getQuoteByCode(rankItems, noCache) {
109
+ const secids = rankItems
110
+ .map((item) => secidFromSc(item.sc))
111
+ .filter((secid) => Boolean(secid));
112
+ if (secids.length === 0) {
113
+ return new Map();
114
+ }
115
+ try {
116
+ const quoteUrl = new URL(QUOTE_API);
117
+ quoteUrl.searchParams.set('fltt', '2');
118
+ quoteUrl.searchParams.set('invt', '2');
119
+ quoteUrl.searchParams.set('fields', 'f2,f3,f4,f5,f6,f12,f13,f14');
120
+ quoteUrl.searchParams.set('secids', secids.join(','));
121
+ const result = await this.httpService.get({
122
+ url: quoteUrl.toString(),
123
+ noCache,
124
+ timeout: 10000,
125
+ headers: {
126
+ Referer: 'https://guba.eastmoney.com/',
127
+ },
128
+ });
129
+ return new Map((result.data.data?.diff ?? [])
130
+ .filter((item) => Boolean(item.f12))
131
+ .map((item) => [item.f12, item]));
132
+ }
133
+ catch (error) {
134
+ this.logger.warn(`Failed to enrich Eastmoney stock quotes: ${error instanceof Error ? error.message : String(error)}`);
135
+ return new Map();
136
+ }
137
+ }
138
+ };
139
+ exports.EastmoneyStockSource = EastmoneyStockSource;
140
+ exports.EastmoneyStockSource = EastmoneyStockSource = EastmoneyStockSource_1 = __decorate([
141
+ (0, common_1.Injectable)(),
142
+ (0, hot_source_decorator_1.HotSource)({
143
+ name: 'eastmoney-stock',
144
+ title: '东方财富热股排行',
145
+ type: '财经',
146
+ link: SITE_URL,
147
+ description: '东方财富股吧热股人气排行',
148
+ }),
149
+ __metadata("design:paramtypes", [http_service_1.HttpClientService])
150
+ ], EastmoneyStockSource);
151
+ //# sourceMappingURL=eastmoney-stock.source.js.map
@@ -0,0 +1 @@
1
+ {"version":3,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,IAAI,EAAE,IAAI,IAAI,EAAE,CAAC;iBAC3B,MAAM,CAAC,CAAC,IAAI,EAAgD,EAAE,CAC7D,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAClB;iBACA,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CACnC,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,MAAM,CAAC,IAAI,CACd,4CACE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CACvD,EAAE,CACH,CAAC;YACF,OAAO,IAAI,GAAG,EAAE,CAAC;QACnB,CAAC;IACH,CAAC;CACF,CAAA;AA9GY,oDAAoB;+BAApB,oBAAoB;IARhC,IAAA,mBAAU,GAAE;IACZ,IAAA,gCAAS,EAAC;QACT,IAAI,EAAE,iBAAiB;QACvB,KAAK,EAAE,UAAU;QACjB,IAAI,EAAE,IAAI;QACV,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,cAAc;KAC5B,CAAC;qCAI0C,gCAAiB;GAHhD,oBAAoB,CA8GhC"}
@@ -0,0 +1,9 @@
1
+ import { HotListSource } from '../interfaces/hot-list-source.interface';
2
+ import { HotListGetListResponse } from '../interfaces/hot-list.interface';
3
+ import { HttpClientService } from '../../http/http.service';
4
+ import { GetListOptions } from './source.types';
5
+ export declare class EastmoneySource implements HotListSource {
6
+ private readonly httpService;
7
+ constructor(httpService: HttpClientService);
8
+ getList(options?: GetListOptions, noCache?: boolean): Promise<HotListGetListResponse>;
9
+ }
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.EastmoneySource = void 0;
13
+ const common_1 = require("@nestjs/common");
14
+ const cheerio_1 = require("cheerio");
15
+ const hot_source_decorator_1 = require("../decorators/hot-source.decorator");
16
+ const http_service_1 = require("../../http/http.service");
17
+ const getTime_1 = require("../../utils/getTime");
18
+ const headers_1 = require("../../utils/headers");
19
+ const SITE_URL = 'https://www.eastmoney.com/';
20
+ const getArticleId = (url) => {
21
+ return url.match(/\/a\/(\d+)\.html/)?.[1] || url;
22
+ };
23
+ const getDateFromArticleId = (id) => {
24
+ const date = id
25
+ .match(/^(\d{4})(\d{2})(\d{2})/)
26
+ ?.slice(1)
27
+ .join('-');
28
+ return date ? (0, getTime_1.getTime)(date) : undefined;
29
+ };
30
+ let EastmoneySource = class EastmoneySource {
31
+ constructor(httpService) {
32
+ this.httpService = httpService;
33
+ }
34
+ async getList(options = {}, noCache) {
35
+ const result = await this.httpService.get({
36
+ url: SITE_URL,
37
+ noCache: noCache ?? options.noCache,
38
+ headers: {
39
+ ...headers_1.headers,
40
+ Referer: SITE_URL,
41
+ },
42
+ });
43
+ const $ = (0, cheerio_1.load)(result.data);
44
+ const seen = new Set();
45
+ const data = $('.cjdd .cjdd_c .nlist a[href*="finance.eastmoney.com/a/"]')
46
+ .toArray()
47
+ .map((item) => {
48
+ const link = $(item);
49
+ const url = link.attr('href')?.trim() || '';
50
+ const id = getArticleId(url);
51
+ return {
52
+ id,
53
+ title: link.text().replace(/\s+/g, ' ').trim(),
54
+ timestamp: getDateFromArticleId(id),
55
+ hot: undefined,
56
+ url,
57
+ mobileUrl: url,
58
+ };
59
+ })
60
+ .filter((item) => {
61
+ if (!item.title || !item.url || seen.has(item.url)) {
62
+ return false;
63
+ }
64
+ seen.add(item.url);
65
+ return true;
66
+ });
67
+ return {
68
+ data,
69
+ type: '热点',
70
+ fromCache: result.fromCache,
71
+ updateTime: result.updateTime,
72
+ };
73
+ }
74
+ };
75
+ exports.EastmoneySource = EastmoneySource;
76
+ exports.EastmoneySource = EastmoneySource = __decorate([
77
+ (0, common_1.Injectable)(),
78
+ (0, hot_source_decorator_1.HotSource)({
79
+ name: 'eastmoney',
80
+ title: '东方财富',
81
+ type: '热点',
82
+ link: SITE_URL,
83
+ }),
84
+ __metadata("design:paramtypes", [http_service_1.HttpClientService])
85
+ ], EastmoneySource);
86
+ //# sourceMappingURL=eastmoney.source.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eastmoney.source.js","sourceRoot":"","sources":["../../../src/host-lists/sources/eastmoney.source.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,qCAA+B;AAC/B,6EAA+D;AAG/D,0DAA4D;AAE5D,iDAA4C;AAC5C,iDAA4C;AAE5C,MAAM,QAAQ,GAAG,4BAA4B,CAAC;AAE9C,MAAM,YAAY,GAAG,CAAC,GAAW,EAAE,EAAE;IACnC,OAAO,GAAG,CAAC,KAAK,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC;AACnD,CAAC,CAAC;AAEF,MAAM,oBAAoB,GAAG,CAAC,EAAU,EAAE,EAAE;IAC1C,MAAM,IAAI,GAAG,EAAE;SACZ,KAAK,CAAC,wBAAwB,CAAC;QAChC,EAAE,KAAK,CAAC,CAAC,CAAC;SACT,IAAI,CAAC,GAAG,CAAC,CAAC;IAEb,OAAO,IAAI,CAAC,CAAC,CAAC,IAAA,iBAAO,EAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAC1C,CAA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IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;gBACnD,OAAO,KAAK,CAAC;YACf,CAAC;YAED,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACnB,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CAAC;QAEL,OAAO;YACL,IAAI;YACJ,IAAI,EAAE,IAAI;YACV,SAAS,EAAE,MAAM,CAAC,SAAS;YAC3B,UAAU,EAAE,MAAM,CAAC,UAAU;SAC9B,CAAC;IACJ,CAAC;CACF,CAAA;AAlDY,0CAAe;0BAAf,eAAe;IAP3B,IAAA,mBAAU,GAAE;IACZ,IAAA,gCAAS,EAAC;QACT,IAAI,EAAE,WAAW;QACjB,KAAK,EAAE,MAAM;QACb,IAAI,EAAE,IAAI;QACV,IAAI,EAAE,QAAQ;KACf,CAAC;qCAE0C,gCAAiB;GADhD,eAAe,CAkD3B"}
@@ -0,0 +1,9 @@
1
+ import { HotListSource } from '../interfaces/hot-list-source.interface';
2
+ import { HotListGetListResponse } from '../interfaces/hot-list.interface';
3
+ import { HttpClientService } from '../../http/http.service';
4
+ import { GetListOptions } from './source.types';
5
+ export declare class GeekparkSource implements HotListSource {
6
+ private readonly httpService;
7
+ constructor(httpService: HttpClientService);
8
+ getList(options: GetListOptions, noCache?: boolean): Promise<HotListGetListResponse>;
9
+ }
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.GeekparkSource = void 0;
13
+ const common_1 = require("@nestjs/common");
14
+ const hot_source_decorator_1 = require("../decorators/hot-source.decorator");
15
+ const http_service_1 = require("../../http/http.service");
16
+ const getTime_1 = require("../../utils/getTime");
17
+ let GeekparkSource = class GeekparkSource {
18
+ constructor(httpService) {
19
+ this.httpService = httpService;
20
+ }
21
+ async getList(options, noCache) {
22
+ const url = 'https://mainssl.geekpark.net/api/v2';
23
+ const result = await this.httpService.get({
24
+ url,
25
+ noCache,
26
+ });
27
+ const list = result.data?.homepage_posts || [];
28
+ return {
29
+ data: list.map((v) => {
30
+ const post = v.post;
31
+ return {
32
+ id: post.id,
33
+ title: post.title,
34
+ desc: post.abstract,
35
+ cover: post.cover_url,
36
+ author: post?.authors?.[0]?.nickname,
37
+ hot: post.views,
38
+ timestamp: (0, getTime_1.getTime)(post.published_timestamp),
39
+ url: `https://www.geekpark.net/news/${post.id}`,
40
+ mobileUrl: `https://www.geekpark.net/news/${post.id}`,
41
+ };
42
+ }),
43
+ fromCache: result.fromCache,
44
+ updateTime: result.updateTime,
45
+ };
46
+ }
47
+ };
48
+ exports.GeekparkSource = GeekparkSource;
49
+ exports.GeekparkSource = GeekparkSource = __decorate([
50
+ (0, common_1.Injectable)(),
51
+ (0, hot_source_decorator_1.HotSource)({
52
+ name: 'geekpark',
53
+ title: '极客公园',
54
+ type: '热门文章',
55
+ description: '极客公园聚焦互联网领域,跟踪新鲜的科技新闻动态,关注极具创新精神的科技产品。',
56
+ link: 'https://www.geekpark.net/',
57
+ }),
58
+ __metadata("design:paramtypes", [http_service_1.HttpClientService])
59
+ ], GeekparkSource);
60
+ //# sourceMappingURL=geekpark.source.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"geekpark.source.js","sourceRoot":"","sources":["../../../src/host-lists/sources/geekpark.source.ts"],"names":[],"mappings":";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EAAC;QACT,IAAI,EAAE,UAAU;QAChB,KAAK,EAAE,MAAM;QACb,IAAI,EAAE,MAAM;QACZ,WAAW,EACT,wCAAwC;QAC1C,IAAI,EAAE,2BAA2B;KAClC,CAAC;qCAE0C,gCAAiB;GADhD,cAAc,CAmC1B"}
@@ -0,0 +1,9 @@
1
+ import { HotListSource } from '../interfaces/hot-list-source.interface';
2
+ import { HotListGetListResponse } from '../interfaces/hot-list.interface';
3
+ import { HttpClientService } from '../../http/http.service';
4
+ import { GetListOptions } from './source.types';
5
+ export declare class GelonghuiSource implements HotListSource {
6
+ private readonly httpService;
7
+ constructor(httpService: HttpClientService);
8
+ getList(options: GetListOptions, noCache?: boolean): Promise<HotListGetListResponse>;
9
+ }