@ttkit/daily-hot-api 0.0.0-stage → 0.1.0
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.
- package/.env.example +77 -0
- package/LICENSE +21 -0
- package/README.md +315 -2
- package/bin/daily-hot-api.js +25 -0
- package/dist/app.controller.d.ts +41 -0
- package/dist/app.controller.js +91 -0
- package/dist/app.controller.js.map +1 -0
- package/dist/app.module.d.ts +4 -0
- package/dist/app.module.js +44 -0
- package/dist/app.module.js.map +1 -0
- package/dist/app.service.d.ts +19 -0
- package/dist/app.service.js +57 -0
- package/dist/app.service.js.map +1 -0
- package/dist/cache/cache.module.d.ts +2 -0
- package/dist/cache/cache.module.js +52 -0
- package/dist/cache/cache.module.js.map +1 -0
- package/dist/cache/cache.service.d.ts +26 -0
- package/dist/cache/cache.service.js +163 -0
- package/dist/cache/cache.service.js.map +1 -0
- package/dist/cli/args.d.ts +24 -0
- package/dist/cli/args.js +261 -0
- package/dist/cli/args.js.map +1 -0
- package/dist/cli/commands/logs.d.ts +3 -0
- package/dist/cli/commands/logs.js +55 -0
- package/dist/cli/commands/logs.js.map +1 -0
- package/dist/cli/commands/restart.d.ts +3 -0
- package/dist/cli/commands/restart.js +62 -0
- package/dist/cli/commands/restart.js.map +1 -0
- package/dist/cli/commands/start.d.ts +3 -0
- package/dist/cli/commands/start.js +280 -0
- package/dist/cli/commands/start.js.map +1 -0
- package/dist/cli/commands/status.d.ts +3 -0
- package/dist/cli/commands/status.js +78 -0
- package/dist/cli/commands/status.js.map +1 -0
- package/dist/cli/commands/stop.d.ts +12 -0
- package/dist/cli/commands/stop.js +135 -0
- package/dist/cli/commands/stop.js.map +1 -0
- package/dist/cli/context.d.ts +4 -0
- package/dist/cli/context.js +3 -0
- package/dist/cli/context.js.map +1 -0
- package/dist/cli/env.d.ts +2 -0
- package/dist/cli/env.js +80 -0
- package/dist/cli/env.js.map +1 -0
- package/dist/cli/errors.d.ts +14 -0
- package/dist/cli/errors.js +25 -0
- package/dist/cli/errors.js.map +1 -0
- package/dist/cli/health.d.ts +2 -0
- package/dist/cli/health.js +44 -0
- package/dist/cli/health.js.map +1 -0
- package/dist/cli/help.d.ts +3 -0
- package/dist/cli/help.js +158 -0
- package/dist/cli/help.js.map +1 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.js +94 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/log-file.d.ts +8 -0
- package/dist/cli/log-file.js +58 -0
- package/dist/cli/log-file.js.map +1 -0
- package/dist/cli/output.d.ts +7 -0
- package/dist/cli/output.js +46 -0
- package/dist/cli/output.js.map +1 -0
- package/dist/cli/paths.d.ts +33 -0
- package/dist/cli/paths.js +76 -0
- package/dist/cli/paths.js.map +1 -0
- package/dist/cli/run-state.d.ts +25 -0
- package/dist/cli/run-state.js +159 -0
- package/dist/cli/run-state.js.map +1 -0
- package/dist/common/middlewares/logger.middleware.d.ts +7 -0
- package/dist/common/middlewares/logger.middleware.js +29 -0
- package/dist/common/middlewares/logger.middleware.js.map +1 -0
- package/dist/config/config.module.d.ts +2 -0
- package/dist/config/config.module.js +47 -0
- package/dist/config/config.module.js.map +1 -0
- package/dist/config/configuration.d.ts +3 -0
- package/dist/config/configuration.js +5 -0
- package/dist/config/configuration.js.map +1 -0
- package/dist/config/validation.schema.d.ts +114 -0
- package/dist/config/validation.schema.js +69 -0
- package/dist/config/validation.schema.js.map +1 -0
- package/dist/daily-brief/clients/ai-analysis.client.d.ts +20 -0
- package/dist/daily-brief/clients/ai-analysis.client.js +217 -0
- package/dist/daily-brief/clients/ai-analysis.client.js.map +1 -0
- package/dist/daily-brief/clients/brief-search.service.d.ts +11 -0
- package/dist/daily-brief/clients/brief-search.service.js +52 -0
- package/dist/daily-brief/clients/brief-search.service.js.map +1 -0
- package/dist/daily-brief/clients/deepseek-search.client.d.ts +11 -0
- package/dist/daily-brief/clients/deepseek-search.client.js +70 -0
- package/dist/daily-brief/clients/deepseek-search.client.js.map +1 -0
- package/dist/daily-brief/clients/tavily-search.client.d.ts +11 -0
- package/dist/daily-brief/clients/tavily-search.client.js +72 -0
- package/dist/daily-brief/clients/tavily-search.client.js.map +1 -0
- package/dist/daily-brief/daily-brief.config.d.ts +31 -0
- package/dist/daily-brief/daily-brief.config.js +108 -0
- package/dist/daily-brief/daily-brief.config.js.map +1 -0
- package/dist/daily-brief/daily-brief.controller.d.ts +72 -0
- package/dist/daily-brief/daily-brief.controller.js +169 -0
- package/dist/daily-brief/daily-brief.controller.js.map +1 -0
- package/dist/daily-brief/daily-brief.module.d.ts +2 -0
- package/dist/daily-brief/daily-brief.module.js +49 -0
- package/dist/daily-brief/daily-brief.module.js.map +1 -0
- package/dist/daily-brief/daily-brief.scheduler.d.ts +30 -0
- package/dist/daily-brief/daily-brief.scheduler.js +113 -0
- package/dist/daily-brief/daily-brief.scheduler.js.map +1 -0
- package/dist/daily-brief/daily-brief.service.d.ts +101 -0
- package/dist/daily-brief/daily-brief.service.js +412 -0
- package/dist/daily-brief/daily-brief.service.js.map +1 -0
- package/dist/daily-brief/dto/brief-date-param.dto.d.ts +3 -0
- package/dist/daily-brief/dto/brief-date-param.dto.js +23 -0
- package/dist/daily-brief/dto/brief-date-param.dto.js.map +1 -0
- package/dist/daily-brief/dto/generate-brief.dto.d.ts +6 -0
- package/dist/daily-brief/dto/generate-brief.dto.js +39 -0
- package/dist/daily-brief/dto/generate-brief.dto.js.map +1 -0
- package/dist/daily-brief/dto/list-briefs-query.dto.d.ts +6 -0
- package/dist/daily-brief/dto/list-briefs-query.dto.js +42 -0
- package/dist/daily-brief/dto/list-briefs-query.dto.js.map +1 -0
- package/dist/daily-brief/dto/stock-ranking-query.dto.d.ts +6 -0
- package/dist/daily-brief/dto/stock-ranking-query.dto.js +46 -0
- package/dist/daily-brief/dto/stock-ranking-query.dto.js.map +1 -0
- package/dist/daily-brief/interfaces/daily-brief.interface.d.ts +59 -0
- package/dist/daily-brief/interfaces/daily-brief.interface.js +3 -0
- package/dist/daily-brief/interfaces/daily-brief.interface.js.map +1 -0
- package/dist/daily-brief/interfaces/search-provider.interface.d.ts +11 -0
- package/dist/daily-brief/interfaces/search-provider.interface.js +3 -0
- package/dist/daily-brief/interfaces/search-provider.interface.js.map +1 -0
- package/dist/daily-brief/utils/brief-date.d.ts +2 -0
- package/dist/daily-brief/utils/brief-date.js +16 -0
- package/dist/daily-brief/utils/brief-date.js.map +1 -0
- package/dist/daily-brief/utils/concurrency.d.ts +1 -0
- package/dist/daily-brief/utils/concurrency.js +20 -0
- package/dist/daily-brief/utils/concurrency.js.map +1 -0
- package/dist/database/database.module.d.ts +2 -0
- package/dist/database/database.module.js +57 -0
- package/dist/database/database.module.js.map +1 -0
- package/dist/database/repositories/daily-brief.repository.d.ts +96 -0
- package/dist/database/repositories/daily-brief.repository.js +457 -0
- package/dist/database/repositories/daily-brief.repository.js.map +1 -0
- package/dist/database/repositories/hot-item.repository.d.ts +52 -0
- package/dist/database/repositories/hot-item.repository.js +255 -0
- package/dist/database/repositories/hot-item.repository.js.map +1 -0
- package/dist/database/repositories/source-config.repository.d.ts +15 -0
- package/dist/database/repositories/source-config.repository.js +77 -0
- package/dist/database/repositories/source-config.repository.js.map +1 -0
- package/dist/database/schemas/daily-brief.schema.d.ts +30 -0
- package/dist/database/schemas/daily-brief.schema.js +103 -0
- package/dist/database/schemas/daily-brief.schema.js.map +1 -0
- package/dist/database/schemas/hot-item.schema.d.ts +20 -0
- package/dist/database/schemas/hot-item.schema.js +72 -0
- package/dist/database/schemas/hot-item.schema.js.map +1 -0
- package/dist/database/schemas/source-config.schema.d.ts +15 -0
- package/dist/database/schemas/source-config.schema.js +47 -0
- package/dist/database/schemas/source-config.schema.js.map +1 -0
- package/dist/history/dto/history-response.dto.d.ts +17 -0
- package/dist/history/dto/history-response.dto.js +13 -0
- package/dist/history/dto/history-response.dto.js.map +1 -0
- package/dist/history/dto/search-history.dto.d.ts +10 -0
- package/dist/history/dto/search-history.dto.js +72 -0
- package/dist/history/dto/search-history.dto.js.map +1 -0
- package/dist/history/history.controller.d.ts +13 -0
- package/dist/history/history.controller.js +92 -0
- package/dist/history/history.controller.js.map +1 -0
- package/dist/history/history.module.d.ts +2 -0
- package/dist/history/history.module.js +25 -0
- package/dist/history/history.module.js.map +1 -0
- package/dist/history/history.service.d.ts +15 -0
- package/dist/history/history.service.js +68 -0
- package/dist/history/history.service.js.map +1 -0
- package/dist/host-lists/decorators/hot-source.decorator.d.ts +9 -0
- package/dist/host-lists/decorators/hot-source.decorator.js +11 -0
- package/dist/host-lists/decorators/hot-source.decorator.js.map +1 -0
- package/dist/host-lists/dto/hot-list.dto.d.ts +14 -0
- package/dist/host-lists/dto/hot-list.dto.js +94 -0
- package/dist/host-lists/dto/hot-list.dto.js.map +1 -0
- package/dist/host-lists/hot-lists.controller.d.ts +39 -0
- package/dist/host-lists/hot-lists.controller.js +87 -0
- package/dist/host-lists/hot-lists.controller.js.map +1 -0
- package/dist/host-lists/hot-lists.module.d.ts +2 -0
- package/dist/host-lists/hot-lists.module.js +36 -0
- package/dist/host-lists/hot-lists.module.js.map +1 -0
- package/dist/host-lists/hot-lists.service.d.ts +21 -0
- package/dist/host-lists/hot-lists.service.js +115 -0
- package/dist/host-lists/hot-lists.service.js.map +1 -0
- package/dist/host-lists/interfaces/hot-list-source.interface.d.ts +5 -0
- package/dist/host-lists/interfaces/hot-list-source.interface.js +3 -0
- package/dist/host-lists/interfaces/hot-list-source.interface.js.map +1 -0
- package/dist/host-lists/interfaces/hot-list.interface.d.ts +31 -0
- package/dist/host-lists/interfaces/hot-list.interface.js +3 -0
- package/dist/host-lists/interfaces/hot-list.interface.js.map +1 -0
- package/dist/host-lists/interfaces/router-data.interface.d.ts +19 -0
- package/dist/host-lists/interfaces/router-data.interface.js +3 -0
- package/dist/host-lists/interfaces/router-data.interface.js.map +1 -0
- package/dist/host-lists/sources/36kr.source.d.ts +9 -0
- package/dist/host-lists/sources/36kr.source.js +89 -0
- package/dist/host-lists/sources/36kr.source.js.map +1 -0
- package/dist/host-lists/sources/51cto.source.d.ts +11 -0
- package/dist/host-lists/sources/51cto.source.js +71 -0
- package/dist/host-lists/sources/51cto.source.js.map +1 -0
- package/dist/host-lists/sources/52pojie.source.d.ts +9 -0
- package/dist/host-lists/sources/52pojie.source.js +109 -0
- package/dist/host-lists/sources/52pojie.source.js.map +1 -0
- package/dist/host-lists/sources/acfun.source.d.ts +9 -0
- package/dist/host-lists/sources/acfun.source.js +90 -0
- package/dist/host-lists/sources/acfun.source.js.map +1 -0
- package/dist/host-lists/sources/baidu.source.d.ts +9 -0
- package/dist/host-lists/sources/baidu.source.js +85 -0
- package/dist/host-lists/sources/baidu.source.js.map +1 -0
- package/dist/host-lists/sources/bilibili.source.d.ts +14 -0
- package/dist/host-lists/sources/bilibili.source.js +188 -0
- package/dist/host-lists/sources/bilibili.source.js.map +1 -0
- package/dist/host-lists/sources/caixin.source.d.ts +9 -0
- package/dist/host-lists/sources/caixin.source.js +102 -0
- package/dist/host-lists/sources/caixin.source.js.map +1 -0
- package/dist/host-lists/sources/cls.source.d.ts +9 -0
- package/dist/host-lists/sources/cls.source.js +62 -0
- package/dist/host-lists/sources/cls.source.js.map +1 -0
- package/dist/host-lists/sources/coolapk.source.d.ts +9 -0
- package/dist/host-lists/sources/coolapk.source.js +57 -0
- package/dist/host-lists/sources/coolapk.source.js.map +1 -0
- package/dist/host-lists/sources/csdn.source.d.ts +9 -0
- package/dist/host-lists/sources/csdn.source.js +59 -0
- package/dist/host-lists/sources/csdn.source.js.map +1 -0
- package/dist/host-lists/sources/dgtle.source.d.ts +9 -0
- package/dist/host-lists/sources/dgtle.source.js +57 -0
- package/dist/host-lists/sources/dgtle.source.js.map +1 -0
- package/dist/host-lists/sources/douban-group.source.d.ts +11 -0
- package/dist/host-lists/sources/douban-group.source.js +100 -0
- package/dist/host-lists/sources/douban-group.source.js.map +1 -0
- package/dist/host-lists/sources/douban-movie.source.d.ts +10 -0
- package/dist/host-lists/sources/douban-movie.source.js +103 -0
- package/dist/host-lists/sources/douban-movie.source.js.map +1 -0
- package/dist/host-lists/sources/douyin.d.ts +16 -0
- package/dist/host-lists/sources/douyin.js +215 -0
- package/dist/host-lists/sources/douyin.js.map +1 -0
- package/dist/host-lists/sources/eastmoney-stock.source.d.ts +11 -0
- package/dist/host-lists/sources/eastmoney-stock.source.js +151 -0
- package/dist/host-lists/sources/eastmoney-stock.source.js.map +1 -0
- package/dist/host-lists/sources/eastmoney.source.d.ts +9 -0
- package/dist/host-lists/sources/eastmoney.source.js +86 -0
- package/dist/host-lists/sources/eastmoney.source.js.map +1 -0
- package/dist/host-lists/sources/geekpark.source.d.ts +9 -0
- package/dist/host-lists/sources/geekpark.source.js +60 -0
- package/dist/host-lists/sources/geekpark.source.js.map +1 -0
- package/dist/host-lists/sources/gelonghui.source.d.ts +9 -0
- package/dist/host-lists/sources/gelonghui.source.js +139 -0
- package/dist/host-lists/sources/gelonghui.source.js.map +1 -0
- package/dist/host-lists/sources/github.source.d.ts +12 -0
- package/dist/host-lists/sources/github.source.js +171 -0
- package/dist/host-lists/sources/github.source.js.map +1 -0
- package/dist/host-lists/sources/guokr.source.d.ts +11 -0
- package/dist/host-lists/sources/guokr.source.js +98 -0
- package/dist/host-lists/sources/guokr.source.js.map +1 -0
- package/dist/host-lists/sources/hackernews.source.d.ts +11 -0
- package/dist/host-lists/sources/hackernews.source.js +121 -0
- package/dist/host-lists/sources/hackernews.source.js.map +1 -0
- package/dist/host-lists/sources/hellogithub.source.d.ts +11 -0
- package/dist/host-lists/sources/hellogithub.source.js +98 -0
- package/dist/host-lists/sources/hellogithub.source.js.map +1 -0
- package/dist/host-lists/sources/history.source.d.ts +11 -0
- package/dist/host-lists/sources/history.source.js +92 -0
- package/dist/host-lists/sources/history.source.js.map +1 -0
- package/dist/host-lists/sources/honkai.source.d.ts +9 -0
- package/dist/host-lists/sources/honkai.source.js +72 -0
- package/dist/host-lists/sources/honkai.source.js.map +1 -0
- package/dist/host-lists/sources/hostloc.source.d.ts +9 -0
- package/dist/host-lists/sources/hostloc.source.js +75 -0
- package/dist/host-lists/sources/hostloc.source.js.map +1 -0
- package/dist/host-lists/sources/hupu.source.d.ts +9 -0
- package/dist/host-lists/sources/hupu.source.js +73 -0
- package/dist/host-lists/sources/hupu.source.js.map +1 -0
- package/dist/host-lists/sources/huxiu.source.d.ts +9 -0
- package/dist/host-lists/sources/huxiu.source.js +153 -0
- package/dist/host-lists/sources/huxiu.source.js.map +1 -0
- package/dist/host-lists/sources/ifanr.source.d.ts +9 -0
- package/dist/host-lists/sources/ifanr.source.js +57 -0
- package/dist/host-lists/sources/ifanr.source.js.map +1 -0
- package/dist/host-lists/sources/index.d.ts +2 -0
- package/dist/host-lists/sources/index.js +134 -0
- package/dist/host-lists/sources/index.js.map +1 -0
- package/dist/host-lists/sources/ithome-xijiayi.source.d.ts +9 -0
- package/dist/host-lists/sources/ithome-xijiayi.source.js +75 -0
- package/dist/host-lists/sources/ithome-xijiayi.source.js.map +1 -0
- package/dist/host-lists/sources/ithome.source.d.ts +9 -0
- package/dist/host-lists/sources/ithome.source.js +71 -0
- package/dist/host-lists/sources/ithome.source.js.map +1 -0
- package/dist/host-lists/sources/jd.source.d.ts +9 -0
- package/dist/host-lists/sources/jd.source.js +82 -0
- package/dist/host-lists/sources/jd.source.js.map +1 -0
- package/dist/host-lists/sources/jianshu.source.d.ts +9 -0
- package/dist/host-lists/sources/jianshu.source.js +72 -0
- package/dist/host-lists/sources/jianshu.source.js.map +1 -0
- package/dist/host-lists/sources/jin10.source.d.ts +9 -0
- package/dist/host-lists/sources/jin10.source.js +63 -0
- package/dist/host-lists/sources/jin10.source.js.map +1 -0
- package/dist/host-lists/sources/juejin.source.d.ts +10 -0
- package/dist/host-lists/sources/juejin.source.js +81 -0
- package/dist/host-lists/sources/juejin.source.js.map +1 -0
- package/dist/host-lists/sources/kuaishou.source.d.ts +13 -0
- package/dist/host-lists/sources/kuaishou.source.js +179 -0
- package/dist/host-lists/sources/kuaishou.source.js.map +1 -0
- package/dist/host-lists/sources/linuxdo.source.d.ts +9 -0
- package/dist/host-lists/sources/linuxdo.source.js +62 -0
- package/dist/host-lists/sources/linuxdo.source.js.map +1 -0
- package/dist/host-lists/sources/lol.source.d.ts +9 -0
- package/dist/host-lists/sources/lol.source.js +58 -0
- package/dist/host-lists/sources/lol.source.js.map +1 -0
- package/dist/host-lists/sources/miyoushe.source.d.ts +9 -0
- package/dist/host-lists/sources/miyoushe.source.js +88 -0
- package/dist/host-lists/sources/miyoushe.source.js.map +1 -0
- package/dist/host-lists/sources/netease-news.source.d.ts +9 -0
- package/dist/host-lists/sources/netease-news.source.js +56 -0
- package/dist/host-lists/sources/netease-news.source.js.map +1 -0
- package/dist/host-lists/sources/ngabbs.source.d.ts +9 -0
- package/dist/host-lists/sources/ngabbs.source.js +70 -0
- package/dist/host-lists/sources/ngabbs.source.js.map +1 -0
- package/dist/host-lists/sources/nodeseek.source.d.ts +9 -0
- package/dist/host-lists/sources/nodeseek.source.js +62 -0
- package/dist/host-lists/sources/nodeseek.source.js.map +1 -0
- package/dist/host-lists/sources/nytimes.source.d.ts +9 -0
- package/dist/host-lists/sources/nytimes.source.js +77 -0
- package/dist/host-lists/sources/nytimes.source.js.map +1 -0
- package/dist/host-lists/sources/producthunt.source.d.ts +9 -0
- package/dist/host-lists/sources/producthunt.source.js +75 -0
- package/dist/host-lists/sources/producthunt.source.js.map +1 -0
- package/dist/host-lists/sources/qq-news.source.d.ts +9 -0
- package/dist/host-lists/sources/qq-news.source.js +53 -0
- package/dist/host-lists/sources/qq-news.source.js.map +1 -0
- package/dist/host-lists/sources/sina-news.source.d.ts +9 -0
- package/dist/host-lists/sources/sina-news.source.js +98 -0
- package/dist/host-lists/sources/sina-news.source.js.map +1 -0
- package/dist/host-lists/sources/sina.source.d.ts +9 -0
- package/dist/host-lists/sources/sina.source.js +78 -0
- package/dist/host-lists/sources/sina.source.js.map +1 -0
- package/dist/host-lists/sources/smzdm.source.d.ts +9 -0
- package/dist/host-lists/sources/smzdm.source.js +71 -0
- package/dist/host-lists/sources/smzdm.source.js.map +1 -0
- package/dist/host-lists/sources/sspai.source.d.ts +9 -0
- package/dist/host-lists/sources/sspai.source.js +69 -0
- package/dist/host-lists/sources/sspai.source.js.map +1 -0
- package/dist/host-lists/sources/starrail.source.d.ts +9 -0
- package/dist/host-lists/sources/starrail.source.js +72 -0
- package/dist/host-lists/sources/starrail.source.js.map +1 -0
- package/dist/host-lists/sources/taobao.source.d.ts +10 -0
- package/dist/host-lists/sources/taobao.source.js +169 -0
- package/dist/host-lists/sources/taobao.source.js.map +1 -0
- package/dist/host-lists/sources/thepaper.source.d.ts +9 -0
- package/dist/host-lists/sources/thepaper.source.js +56 -0
- package/dist/host-lists/sources/thepaper.source.js.map +1 -0
- package/dist/host-lists/sources/tieba.source.d.ts +9 -0
- package/dist/host-lists/sources/tieba.source.js +58 -0
- package/dist/host-lists/sources/tieba.source.js.map +1 -0
- package/dist/host-lists/sources/tonghuashun.source.d.ts +9 -0
- package/dist/host-lists/sources/tonghuashun.source.js +112 -0
- package/dist/host-lists/sources/tonghuashun.source.js.map +1 -0
- package/dist/host-lists/sources/toutiao.source.d.ts +9 -0
- package/dist/host-lists/sources/toutiao.source.js +56 -0
- package/dist/host-lists/sources/toutiao.source.js.map +1 -0
- package/dist/host-lists/sources/v2ex.source.d.ts +9 -0
- package/dist/host-lists/sources/v2ex.source.js +67 -0
- package/dist/host-lists/sources/v2ex.source.js.map +1 -0
- package/dist/host-lists/sources/wallstreet.source.d.ts +9 -0
- package/dist/host-lists/sources/wallstreet.source.js +59 -0
- package/dist/host-lists/sources/wallstreet.source.js.map +1 -0
- package/dist/host-lists/sources/weatheralarm.source.d.ts +9 -0
- package/dist/host-lists/sources/weatheralarm.source.js +68 -0
- package/dist/host-lists/sources/weatheralarm.source.js.map +1 -0
- package/dist/host-lists/sources/weibo.source.d.ts +15 -0
- package/dist/host-lists/sources/weibo.source.js +180 -0
- package/dist/host-lists/sources/weibo.source.js.map +1 -0
- package/dist/host-lists/sources/weread.source.d.ts +9 -0
- package/dist/host-lists/sources/weread.source.js +82 -0
- package/dist/host-lists/sources/weread.source.js.map +1 -0
- package/dist/host-lists/sources/xinyu.source.d.ts +9 -0
- package/dist/host-lists/sources/xinyu.source.js +151 -0
- package/dist/host-lists/sources/xinyu.source.js.map +1 -0
- package/dist/host-lists/sources/yicai.source.d.ts +9 -0
- package/dist/host-lists/sources/yicai.source.js +113 -0
- package/dist/host-lists/sources/yicai.source.js.map +1 -0
- package/dist/host-lists/sources/yystv.source.d.ts +9 -0
- package/dist/host-lists/sources/yystv.source.js +57 -0
- package/dist/host-lists/sources/yystv.source.js.map +1 -0
- package/dist/host-lists/sources/zhihu-daily.source.d.ts +9 -0
- package/dist/host-lists/sources/zhihu-daily.source.js +60 -0
- package/dist/host-lists/sources/zhihu-daily.source.js.map +1 -0
- package/dist/host-lists/sources/zhihu.source.d.ts +12 -0
- package/dist/host-lists/sources/zhihu.source.js +195 -0
- package/dist/host-lists/sources/zhihu.source.js.map +1 -0
- package/dist/http/http.module.d.ts +2 -0
- package/dist/http/http.module.js +30 -0
- package/dist/http/http.module.js.map +1 -0
- package/dist/http/http.service.d.ts +53 -0
- package/dist/http/http.service.js +277 -0
- package/dist/http/http.service.js.map +1 -0
- package/dist/main.d.ts +3 -0
- package/dist/main.js +70 -0
- package/dist/main.js.map +1 -0
- package/dist/rss/rss.module.d.ts +2 -0
- package/dist/rss/rss.module.js +21 -0
- package/dist/rss/rss.module.js.map +1 -0
- package/dist/rss/rss.service.d.ts +5 -0
- package/dist/rss/rss.service.js +55 -0
- package/dist/rss/rss.service.js.map +1 -0
- package/dist/scheduler/dto/trigger-fetch.dto.d.ts +3 -0
- package/dist/scheduler/dto/trigger-fetch.dto.js +22 -0
- package/dist/scheduler/dto/trigger-fetch.dto.js.map +1 -0
- package/dist/scheduler/dto/update-source-config.dto.d.ts +4 -0
- package/dist/scheduler/dto/update-source-config.dto.js +29 -0
- package/dist/scheduler/dto/update-source-config.dto.js.map +1 -0
- package/dist/scheduler/scheduler.controller.d.ts +52 -0
- package/dist/scheduler/scheduler.controller.js +132 -0
- package/dist/scheduler/scheduler.controller.js.map +1 -0
- package/dist/scheduler/scheduler.module.d.ts +2 -0
- package/dist/scheduler/scheduler.module.js +34 -0
- package/dist/scheduler/scheduler.module.js.map +1 -0
- package/dist/scheduler/scheduler.service.d.ts +54 -0
- package/dist/scheduler/scheduler.service.js +238 -0
- package/dist/scheduler/scheduler.service.js.map +1 -0
- package/dist/scheduler/tasks/fetch-hot-data.task.d.ts +34 -0
- package/dist/scheduler/tasks/fetch-hot-data.task.js +175 -0
- package/dist/scheduler/tasks/fetch-hot-data.task.js.map +1 -0
- package/dist/token/coolapk.d.ts +11 -0
- package/dist/token/coolapk.js +40 -0
- package/dist/token/coolapk.js.map +1 -0
- package/dist/token/token.module.d.ts +2 -0
- package/dist/token/token.module.js +23 -0
- package/dist/token/token.module.js.map +1 -0
- package/dist/token/token.service.d.ts +19 -0
- package/dist/token/token.service.js +115 -0
- package/dist/token/token.service.js.map +1 -0
- package/dist/token/tools.d.ts +1 -0
- package/dist/token/tools.js +15 -0
- package/dist/token/tools.js.map +1 -0
- package/dist/token/weread.d.ts +2 -0
- package/dist/token/weread.js +55 -0
- package/dist/token/weread.js.map +1 -0
- package/dist/utils/getNum.d.ts +1 -0
- package/dist/utils/getNum.js +20 -0
- package/dist/utils/getNum.js.map +1 -0
- package/dist/utils/getTime.d.ts +11 -0
- package/dist/utils/getTime.js +134 -0
- package/dist/utils/getTime.js.map +1 -0
- package/dist/utils/headers.d.ts +16 -0
- package/dist/utils/headers.js +20 -0
- package/dist/utils/headers.js.map +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +12 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/parseRSS.d.ts +11 -0
- package/dist/utils/parseRSS.js +47 -0
- package/dist/utils/parseRSS.js.map +1 -0
- package/package.json +148 -4
- package/views/home.hbs +65 -0
|
@@ -0,0 +1,87 @@
|
|
|
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 __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.HotListsController = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const hot_lists_service_1 = require("./hot-lists.service");
|
|
18
|
+
const config_1 = require("@nestjs/config");
|
|
19
|
+
const hot_list_dto_1 = require("./dto/hot-list.dto");
|
|
20
|
+
const rss_service_1 = require("../rss/rss.service");
|
|
21
|
+
let HotListsController = class HotListsController {
|
|
22
|
+
constructor(hotListsService, configService, rssService) {
|
|
23
|
+
this.hotListsService = hotListsService;
|
|
24
|
+
this.configService = configService;
|
|
25
|
+
this.rssService = rssService;
|
|
26
|
+
}
|
|
27
|
+
getAllSources() {
|
|
28
|
+
const sources = this.hotListsService.getAllSourcesWithMetadata();
|
|
29
|
+
return {
|
|
30
|
+
code: 200,
|
|
31
|
+
count: sources.length,
|
|
32
|
+
routes: sources.map(({ name, title }) => ({
|
|
33
|
+
name,
|
|
34
|
+
title,
|
|
35
|
+
path: `/${name}`,
|
|
36
|
+
})),
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
async getHotList(source, query, res) {
|
|
40
|
+
const { limit, rss, ...otherParams } = query;
|
|
41
|
+
let { noCache = false } = query;
|
|
42
|
+
const notAllowedRefreshSource = this.configService.get('NOT_ALLOWED_REFRESH_SOURCE', '');
|
|
43
|
+
const hasNotRefresh = notAllowedRefreshSource.split(',').includes(source);
|
|
44
|
+
if (hasNotRefresh) {
|
|
45
|
+
noCache = false;
|
|
46
|
+
}
|
|
47
|
+
const listData = await this.hotListsService.getHotList(source, {
|
|
48
|
+
limit: limit ? parseInt(limit, 10) : undefined,
|
|
49
|
+
rss,
|
|
50
|
+
...otherParams,
|
|
51
|
+
}, noCache);
|
|
52
|
+
if (limit && listData?.data?.length > parseInt(limit)) {
|
|
53
|
+
listData.total = parseInt(limit);
|
|
54
|
+
listData.data = listData.data.slice(0, parseInt(limit));
|
|
55
|
+
}
|
|
56
|
+
const rssEnabled = rss || this.configService.get('RSS_MODE');
|
|
57
|
+
if (rssEnabled) {
|
|
58
|
+
const rssContent = this.rssService.generateRss(listData);
|
|
59
|
+
res.header('Content-Type', 'application/xml; charset=utf-8');
|
|
60
|
+
return rssContent;
|
|
61
|
+
}
|
|
62
|
+
return { code: 200, ...listData };
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
exports.HotListsController = HotListsController;
|
|
66
|
+
__decorate([
|
|
67
|
+
(0, common_1.Get)('all'),
|
|
68
|
+
__metadata("design:type", Function),
|
|
69
|
+
__metadata("design:paramtypes", []),
|
|
70
|
+
__metadata("design:returntype", void 0)
|
|
71
|
+
], HotListsController.prototype, "getAllSources", null);
|
|
72
|
+
__decorate([
|
|
73
|
+
(0, common_1.Get)(':source'),
|
|
74
|
+
__param(0, (0, common_1.Param)('source')),
|
|
75
|
+
__param(1, (0, common_1.Query)()),
|
|
76
|
+
__param(2, (0, common_1.Res)({ passthrough: true })),
|
|
77
|
+
__metadata("design:type", Function),
|
|
78
|
+
__metadata("design:paramtypes", [String, hot_list_dto_1.HotListQueryDto, Object]),
|
|
79
|
+
__metadata("design:returntype", Promise)
|
|
80
|
+
], HotListsController.prototype, "getHotList", null);
|
|
81
|
+
exports.HotListsController = HotListsController = __decorate([
|
|
82
|
+
(0, common_1.Controller)('hot-lists'),
|
|
83
|
+
__metadata("design:paramtypes", [hot_lists_service_1.HotListsService,
|
|
84
|
+
config_1.ConfigService,
|
|
85
|
+
rss_service_1.RssService])
|
|
86
|
+
], HotListsController);
|
|
87
|
+
//# sourceMappingURL=hot-lists.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hot-lists.controller.js","sourceRoot":"","sources":["../../src/host-lists/hot-lists.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAoE;AACpE,2DAAsD;AACtD,2CAA+C;AAC/C,qDAAqD;AAErD,oDAAgD;AAGzC,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAC7B,YACmB,eAAgC,EAChC,aAA4B,EAC5B,UAAsB;QAFtB,oBAAe,GAAf,eAAe,CAAiB;QAChC,kBAAa,GAAb,aAAa,CAAe;QAC5B,eAAU,GAAV,UAAU,CAAY;IACtC,CAAC;IAGJ,aAAa;QACX,MAAM,OAAO,GAAG,IAAI,CAAC,eAAe,CAAC,yBAAyB,EAAE,CAAC;QACjE,OAAO;YACL,IAAI,EAAE,GAAG;YACT,KAAK,EAAE,OAAO,CAAC,MAAM;YACrB,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;gBACxC,IAAI;gBACJ,KAAK;gBACL,IAAI,EAAE,IAAI,IAAI,EAAE;aACjB,CAAC,CAAC;SACJ,CAAC;IACJ,CAAC;IAGK,AAAN,KAAK,CAAC,UAAU,CACG,MAAc,EACtB,KAAsB,EACH,GAAa;QAEzC,MAAM,EAAE,KAAK,EA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I,EAAE,GAAG,EAAE,GAAG,QAAQ,EAAE,CAAC;IACpC,CAAC;CACF,CAAA;AApEY,gDAAkB;AAQ7B;IADC,IAAA,YAAG,EAAC,KAAK,CAAC;;;;uDAYV;AAGK;IADL,IAAA,YAAG,EAAC,SAAS,CAAC;IAEZ,WAAA,IAAA,cAAK,EAAC,QAAQ,CAAC,CAAA;IACf,WAAA,IAAA,cAAK,GAAE,CAAA;IACP,WAAA,IAAA,YAAG,EAAC,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAA;;6CADX,8BAAe;;oDA2ChC;6BAnEU,kBAAkB;IAD9B,IAAA,mBAAU,EAAC,WAAW,CAAC;qCAGc,mCAAe;QACjB,sBAAa;QAChB,wBAAU;GAJ9B,kBAAkB,CAoE9B"}
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.HotListsModule = void 0;
|
|
10
|
+
const common_1 = require("@nestjs/common");
|
|
11
|
+
const axios_1 = require("@nestjs/axios");
|
|
12
|
+
const core_1 = require("@nestjs/core");
|
|
13
|
+
const hot_lists_controller_1 = require("./hot-lists.controller");
|
|
14
|
+
const hot_lists_service_1 = require("./hot-lists.service");
|
|
15
|
+
const sources_1 = require("./sources");
|
|
16
|
+
const http_module_1 = require("../http/http.module");
|
|
17
|
+
const token_module_1 = require("../token/token.module");
|
|
18
|
+
const rss_module_1 = require("../rss/rss.module");
|
|
19
|
+
let HotListsModule = class HotListsModule {
|
|
20
|
+
};
|
|
21
|
+
exports.HotListsModule = HotListsModule;
|
|
22
|
+
exports.HotListsModule = HotListsModule = __decorate([
|
|
23
|
+
(0, common_1.Module)({
|
|
24
|
+
imports: [
|
|
25
|
+
core_1.DiscoveryModule,
|
|
26
|
+
http_module_1.HttpClientModule,
|
|
27
|
+
axios_1.HttpModule.register({ timeout: 8000 }),
|
|
28
|
+
token_module_1.TokenModule,
|
|
29
|
+
rss_module_1.RssModule,
|
|
30
|
+
],
|
|
31
|
+
controllers: [hot_lists_controller_1.HotListsController],
|
|
32
|
+
providers: [hot_lists_service_1.HotListsService, ...sources_1.HOT_LIST_SOURCES],
|
|
33
|
+
exports: [hot_lists_service_1.HotListsService],
|
|
34
|
+
})
|
|
35
|
+
], HotListsModule);
|
|
36
|
+
//# sourceMappingURL=hot-lists.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hot-lists.module.js","sourceRoot":"","sources":["../../src/host-lists/hot-lists.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,yCAA2C;AAC3C,uCAA+C;AAC/C,iEAA4D;AAC5D,2DAAsD;AACtD,uCAA6C;AAC7C,qDAAuD;AACvD,wDAAoD;AACpD,kDAA8C;AAmBvC,IAAM,cAAc,GAApB,MAAM,cAAc;CAAG,CAAA;AAAjB,wCAAc;yBAAd,cAAc;IAjB1B,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YAEP,sBAAe;YAEf,8BAAgB;YAEhB,kBAAU,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;YAEtC,0BAAW;YAEX,sBAAS;SACV;QACD,WAAW,EAAE,CAAC,yCAAkB,CAAC;QACjC,SAAS,EAAE,CAAC,mCAAe,EAAE,GAAG,0BAAgB,CAAC;QACjD,OAAO,EAAE,CAAC,mCAAe,CAAC;KAC3B,CAAC;GACW,cAAc,CAAG"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { OnModuleInit } from '@nestjs/common';
|
|
2
|
+
import { DiscoveryService } from '@nestjs/core';
|
|
3
|
+
import { RouterData } from './interfaces/router-data.interface';
|
|
4
|
+
import { GetListOptions } from './sources/source.types';
|
|
5
|
+
export declare class HotListsService implements OnModuleInit {
|
|
6
|
+
private readonly discoveryService;
|
|
7
|
+
private readonly sources;
|
|
8
|
+
private readonly sourceMetadata;
|
|
9
|
+
private readonly logger;
|
|
10
|
+
constructor(discoveryService: DiscoveryService);
|
|
11
|
+
onModuleInit(): Promise<void>;
|
|
12
|
+
private discoverSources;
|
|
13
|
+
private isHotListSource;
|
|
14
|
+
getAllSources(): string[];
|
|
15
|
+
getAllSourcesWithMetadata(): Array<{
|
|
16
|
+
name: string;
|
|
17
|
+
title: string;
|
|
18
|
+
}>;
|
|
19
|
+
getHotList(sourceName: string, options: GetListOptions, noCache?: boolean): Promise<RouterData>;
|
|
20
|
+
fetchSource(sourceName: string, options: GetListOptions, noCache?: boolean): Promise<RouterData>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
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 HotListsService_1;
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.HotListsService = void 0;
|
|
14
|
+
const common_1 = require("@nestjs/common");
|
|
15
|
+
const core_1 = require("@nestjs/core");
|
|
16
|
+
const hot_source_decorator_1 = require("./decorators/hot-source.decorator");
|
|
17
|
+
const common_2 = require("@nestjs/common");
|
|
18
|
+
let HotListsService = HotListsService_1 = class HotListsService {
|
|
19
|
+
constructor(discoveryService) {
|
|
20
|
+
this.discoveryService = discoveryService;
|
|
21
|
+
this.sources = new Map();
|
|
22
|
+
this.sourceMetadata = new Map();
|
|
23
|
+
this.logger = new common_2.Logger(HotListsService_1.name);
|
|
24
|
+
}
|
|
25
|
+
async onModuleInit() {
|
|
26
|
+
await this.discoverSources();
|
|
27
|
+
}
|
|
28
|
+
async discoverSources() {
|
|
29
|
+
const providers = this.discoveryService.getProviders();
|
|
30
|
+
await Promise.all(providers.map((provider) => {
|
|
31
|
+
if (provider.instance && provider.metatype) {
|
|
32
|
+
const metadata = Reflect.getMetadata(hot_source_decorator_1.HOT_SOURCE_METADATA, provider.metatype);
|
|
33
|
+
if (metadata && this.isHotListSource(provider.instance)) {
|
|
34
|
+
const { name, title, type, link, description } = metadata;
|
|
35
|
+
if (this.sources.has(name)) {
|
|
36
|
+
throw new Error(`Duplicate hot list source name: ${name}`);
|
|
37
|
+
}
|
|
38
|
+
this.sources.set(name, provider.instance);
|
|
39
|
+
this.sourceMetadata.set(name, {
|
|
40
|
+
title,
|
|
41
|
+
type: type ?? '热榜',
|
|
42
|
+
link,
|
|
43
|
+
description,
|
|
44
|
+
});
|
|
45
|
+
this.logger.log(`Registered hot list source: ${name} - ${title}`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return Promise.resolve();
|
|
49
|
+
}));
|
|
50
|
+
}
|
|
51
|
+
isHotListSource(instance) {
|
|
52
|
+
return (instance !== null &&
|
|
53
|
+
typeof instance === 'object' &&
|
|
54
|
+
'getList' in instance &&
|
|
55
|
+
typeof instance.getList === 'function');
|
|
56
|
+
}
|
|
57
|
+
getAllSources() {
|
|
58
|
+
return Array.from(this.sources.keys());
|
|
59
|
+
}
|
|
60
|
+
getAllSourcesWithMetadata() {
|
|
61
|
+
return Array.from(this.sources.keys()).map((name) => ({
|
|
62
|
+
name,
|
|
63
|
+
title: this.sourceMetadata.get(name)?.title ?? name,
|
|
64
|
+
}));
|
|
65
|
+
}
|
|
66
|
+
async getHotList(sourceName, options, noCache = false) {
|
|
67
|
+
try {
|
|
68
|
+
return await this.fetchSource(sourceName, options, noCache);
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
if (error instanceof common_1.NotFoundException)
|
|
72
|
+
throw error;
|
|
73
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
|
|
74
|
+
this.logger.error(`Failed to get data from ${sourceName}: ${errorMessage}`);
|
|
75
|
+
const metadata = this.sourceMetadata.get(sourceName);
|
|
76
|
+
return {
|
|
77
|
+
name: sourceName,
|
|
78
|
+
title: metadata?.title || sourceName,
|
|
79
|
+
type: metadata?.type || '热榜',
|
|
80
|
+
link: metadata?.link,
|
|
81
|
+
description: metadata?.description,
|
|
82
|
+
total: 0,
|
|
83
|
+
data: [],
|
|
84
|
+
fromCache: false,
|
|
85
|
+
updateTime: new Date().toISOString(),
|
|
86
|
+
message: `Failed to get data: ${errorMessage}`,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
async fetchSource(sourceName, options, noCache = false) {
|
|
91
|
+
const source = this.sources.get(sourceName);
|
|
92
|
+
if (!source)
|
|
93
|
+
throw new common_1.NotFoundException(`Source '${sourceName}' not found`);
|
|
94
|
+
const result = await source.getList(options, noCache);
|
|
95
|
+
const metadata = this.sourceMetadata.get(sourceName);
|
|
96
|
+
return {
|
|
97
|
+
name: sourceName,
|
|
98
|
+
title: metadata?.title || sourceName,
|
|
99
|
+
type: result.type || metadata?.type || '热榜',
|
|
100
|
+
link: metadata?.link,
|
|
101
|
+
description: metadata?.description,
|
|
102
|
+
total: result.data.length,
|
|
103
|
+
data: result.data,
|
|
104
|
+
fromCache: result.fromCache ?? false,
|
|
105
|
+
updateTime: result.updateTime ?? new Date().toISOString(),
|
|
106
|
+
params: result.params,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
exports.HotListsService = HotListsService;
|
|
111
|
+
exports.HotListsService = HotListsService = HotListsService_1 = __decorate([
|
|
112
|
+
(0, common_1.Injectable)(),
|
|
113
|
+
__metadata("design:paramtypes", [core_1.DiscoveryService])
|
|
114
|
+
], HotListsService);
|
|
115
|
+
//# sourceMappingURL=hot-lists.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hot-lists.service.js","sourceRoot":"","sources":["../../src/host-lists/hot-lists.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAA6E;AAC7E,uCAAgD;AAGhD,4EAG2C;AAC3C,2CAAwC;AAIjC,IAAM,eAAe,uBAArB,MAAM,eAAe;IAQ1B,YAA6B,gBAAkC;QAAlC,qBAAgB,GAAhB,gBAAgB,CAAkB;QAP9C,YAAO,GAA+B,IAAI,GAAG,EAAE,CAAC;QAChD,mBAAc,GAG3B,IAAI,GAAG,EAAE,CAAC;QACG,WAAM,GAAG,IAAI,eAAM,CAAC,iBAAe,CAAC,IAAI,CAAC,CAAC;IAEO,CAAC;IAEnE,KAAK,CAAC,YAAY;QAChB,MAAM,IAAI,CAAC,eAAe,EAAE,CAAC;IAC/B,CAAC;IAKO,KAAK,CAAC,eAAe;QAE3B,MAAM,SAAS,GAAG,IAAI,CAAC,gBAAgB,CAAC,YAAY,EAAE,CAAC;QAGvD,MAAM,OAAO,CAAC,GAAG,CACf,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE;YAEzB,IAAI,QAAQ,CAAC,QAAQ,IAAI,QAAQ,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AW,CACf,UAAkB,EAClB,OAAuB,EACvB,OAAO,GAAG,KAAK;QAEf,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QAC5C,IAAI,CAAC,MAAM;YACT,MAAM,IAAI,0BAAiB,CAAC,WAAW,UAAU,aAAa,CAAC,CAAC;QAElE,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACtD,MAAM,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QACrD,OAAO;YACL,IAAI,EAAE,UAAU;YAChB,KAAK,EAAE,QAAQ,EAAE,KAAK,IAAI,UAAU;YACpC,IAAI,EAAE,MAAM,CAAC,IAAI,IAAI,QAAQ,EAAE,IAAI,IAAI,IAAI;YAC3C,IAAI,EAAE,QAAQ,EAAE,IAAI;YACpB,WAAW,EAAE,QAAQ,EAAE,WAAW;YAClC,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM;YACzB,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,SAAS,EAAE,MAAM,CAAC,SAAS,IAAI,KAAK;YACpC,UAAU,EAAE,MAAM,CAAC,UAAU,IAAI,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACzD,MAAM,EAAE,MAAM,CAAC,MAAM;SACtB,CAAC;IACJ,CAAC;CACF,CAAA;AApJY,0CAAe;0BAAf,eAAe;IAD3B,IAAA,mBAAU,GAAE;qCASoC,uBAAgB;GARpD,eAAe,CAoJ3B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hot-list-source.interface.js","sourceRoot":"","sources":["../../../src/host-lists/interfaces/hot-list-source.interface.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export interface HotListItem {
|
|
2
|
+
id: string | number;
|
|
3
|
+
title: string;
|
|
4
|
+
desc?: string;
|
|
5
|
+
cover?: string;
|
|
6
|
+
author?: string;
|
|
7
|
+
hot?: number | string;
|
|
8
|
+
timestamp?: number;
|
|
9
|
+
url: string;
|
|
10
|
+
mobileUrl: string;
|
|
11
|
+
}
|
|
12
|
+
export interface HotListGetListResponse {
|
|
13
|
+
data: HotListItem[];
|
|
14
|
+
type?: string;
|
|
15
|
+
fromCache?: boolean;
|
|
16
|
+
params?: {
|
|
17
|
+
type: {
|
|
18
|
+
name: string;
|
|
19
|
+
type: Record<string, string>;
|
|
20
|
+
};
|
|
21
|
+
range?: {
|
|
22
|
+
name: string;
|
|
23
|
+
type: Record<string, string>;
|
|
24
|
+
};
|
|
25
|
+
[key: string]: {
|
|
26
|
+
name: string;
|
|
27
|
+
type: Record<string, string>;
|
|
28
|
+
} | undefined;
|
|
29
|
+
};
|
|
30
|
+
[key: string]: any;
|
|
31
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hot-list.interface.js","sourceRoot":"","sources":["../../../src/host-lists/interfaces/hot-list.interface.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { HotListItem } from './hot-list.interface';
|
|
2
|
+
export interface RouterData {
|
|
3
|
+
name: string;
|
|
4
|
+
title: string;
|
|
5
|
+
type: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
link?: string;
|
|
8
|
+
total: number;
|
|
9
|
+
data: HotListItem[];
|
|
10
|
+
fromCache?: boolean;
|
|
11
|
+
updateTime?: string;
|
|
12
|
+
message?: string;
|
|
13
|
+
params?: {
|
|
14
|
+
type: {
|
|
15
|
+
name: string;
|
|
16
|
+
type: Record<string, string>;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"router-data.interface.js","sourceRoot":"","sources":["../../../src/host-lists/interfaces/router-data.interface.ts"],"names":[],"mappings":""}
|
|
@@ -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 Kr36Source implements HotListSource {
|
|
6
|
+
private readonly httpService;
|
|
7
|
+
constructor(httpService: HttpClientService);
|
|
8
|
+
getList(options: GetListOptions, noCache?: boolean): Promise<HotListGetListResponse>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
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.Kr36Source = 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
|
+
const typeMap = {
|
|
18
|
+
hot: '人气榜',
|
|
19
|
+
video: '视频榜',
|
|
20
|
+
comment: '热议榜',
|
|
21
|
+
collect: '收藏榜',
|
|
22
|
+
};
|
|
23
|
+
let Kr36Source = class Kr36Source {
|
|
24
|
+
constructor(httpService) {
|
|
25
|
+
this.httpService = httpService;
|
|
26
|
+
}
|
|
27
|
+
async getList(options, noCache) {
|
|
28
|
+
const type = options?.type ?? 'hot';
|
|
29
|
+
const url = `https://gateway.36kr.com/api/mis/nav/home/nav/rank/${type}`;
|
|
30
|
+
const result = await this.httpService.post({
|
|
31
|
+
url,
|
|
32
|
+
noCache,
|
|
33
|
+
headers: {
|
|
34
|
+
'Content-Type': 'application/json; charset=utf-8',
|
|
35
|
+
},
|
|
36
|
+
data: {
|
|
37
|
+
partner_id: 'wap',
|
|
38
|
+
param: {
|
|
39
|
+
siteId: 1,
|
|
40
|
+
platformId: 2,
|
|
41
|
+
},
|
|
42
|
+
timestamp: new Date().getTime(),
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
const listType = {
|
|
46
|
+
hot: 'hotRankList',
|
|
47
|
+
video: 'videoList',
|
|
48
|
+
comment: 'remarkList',
|
|
49
|
+
collect: 'collectList',
|
|
50
|
+
};
|
|
51
|
+
const list = result.data.data[listType[type || 'hot']] || [];
|
|
52
|
+
return {
|
|
53
|
+
data: list.map((v) => {
|
|
54
|
+
const item = v.templateMaterial;
|
|
55
|
+
return {
|
|
56
|
+
id: v.itemId,
|
|
57
|
+
title: item.widgetTitle,
|
|
58
|
+
cover: item.widgetImage,
|
|
59
|
+
author: item.authorName,
|
|
60
|
+
timestamp: (0, getTime_1.getTime)(v.publishTime),
|
|
61
|
+
hot: item.statCollect || undefined,
|
|
62
|
+
url: `https://www.36kr.com/${type === 'video' ? 'video' : 'p'}/${v.itemId}`,
|
|
63
|
+
mobileUrl: `https://m.36kr.com/${type === 'video' ? 'video' : 'p'}/${v.itemId}`,
|
|
64
|
+
};
|
|
65
|
+
}),
|
|
66
|
+
type: typeMap[type] || '热搜',
|
|
67
|
+
params: {
|
|
68
|
+
type: {
|
|
69
|
+
name: '热搜类别',
|
|
70
|
+
type: typeMap,
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
fromCache: result.fromCache,
|
|
74
|
+
updateTime: result.updateTime,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
exports.Kr36Source = Kr36Source;
|
|
79
|
+
exports.Kr36Source = Kr36Source = __decorate([
|
|
80
|
+
(0, common_1.Injectable)(),
|
|
81
|
+
(0, hot_source_decorator_1.HotSource)({
|
|
82
|
+
name: '36kr',
|
|
83
|
+
title: '36氪',
|
|
84
|
+
type: '热榜',
|
|
85
|
+
link: 'https://m.36kr.com/hot-list-m',
|
|
86
|
+
}),
|
|
87
|
+
__metadata("design:paramtypes", [http_service_1.HttpClientService])
|
|
88
|
+
], Kr36Source);
|
|
89
|
+
//# sourceMappingURL=36kr.source.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"36kr.source.js","sourceRoot":"","sources":["../../../src/host-lists/sources/36kr.source.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,6EAA+D;AAG/D,0DAA4D;AAE5D,iDAA4C;AAW5C,MAAM,OAAO,GAA2B;IACtC,GAAG,EAAE,KAAK;IACV,KAAK,EAAE,KAAK;IACZ,OAAO,EAAE,KAAK;IACd,OAAO,EAAE,KAAK;CACf,CAAC;AASK,IAAM,UAAU,GAAhB,MAAM,UAAU;IACrB,YAA6B,WAA8B;QAA9B,gBAAW,GAAX,WAAW,CAAmB;IAAG,CAAC;IAE/D,KAAK,CAAC,OAAO,CACX,OAAuB,EACvB,OAAiB;QAEjB,MAAM,IAAI,GAAG,OAAO,EAAE,IAAI,IAAI,KAAK,CAAC;QAEpC,MAAM,GAAG,GAAG,sDAAsD,IAAI,EAAE,CAAC;QACzE,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,IAAI,CAAkB;YAC1D,GAAG;YACH,OAAO;YACP,OAAO,EAAE;gBACP,cAAc,EAAE,iCAAiC;aAClD;YACD,IAAI,EAAE;gBACJ,UAAU,EAAE,KAAK;gBACjB,KAA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SAAS,EAAE,MAAM,CAAC,SAAS;YAC3B,UAAU,EAAE,MAAM,CAAC,UAAU;SAC9B,CAAC;IACJ,CAAC;CACF,CAAA;AA3DY,gCAAU;qBAAV,UAAU;IAPtB,IAAA,mBAAU,GAAE;IACZ,IAAA,gCAAS,EAAC;QACT,IAAI,EAAE,MAAM;QACZ,KAAK,EAAE,KAAK;QACZ,IAAI,EAAE,IAAI;QACV,IAAI,EAAE,+BAA+B;KACtC,CAAC;qCAE0C,gCAAiB;GADhD,UAAU,CA2DtB"}
|
|
@@ -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
|
+
import { TokenService } from 'src/token/token.service';
|
|
6
|
+
export declare class _51ctoSource implements HotListSource {
|
|
7
|
+
private readonly httpService;
|
|
8
|
+
private readonly tokenService;
|
|
9
|
+
constructor(httpService: HttpClientService, tokenService: TokenService);
|
|
10
|
+
getList(options: GetListOptions, noCache?: boolean): Promise<HotListGetListResponse>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
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._51ctoSource = 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 token_service_1 = require("../../token/token.service");
|
|
17
|
+
const tools_1 = require("../../token/tools");
|
|
18
|
+
let _51ctoSource = class _51ctoSource {
|
|
19
|
+
constructor(httpService, tokenService) {
|
|
20
|
+
this.httpService = httpService;
|
|
21
|
+
this.tokenService = tokenService;
|
|
22
|
+
}
|
|
23
|
+
async getList(options, noCache) {
|
|
24
|
+
const url = `https://api-media.51cto.com/index/index/recommend`;
|
|
25
|
+
const params = {
|
|
26
|
+
page: 1,
|
|
27
|
+
page_size: 50,
|
|
28
|
+
limit_time: 0,
|
|
29
|
+
name_en: '',
|
|
30
|
+
};
|
|
31
|
+
const timestamp = Date.now();
|
|
32
|
+
const token = await this.tokenService.get51ctoToken();
|
|
33
|
+
const result = await this.httpService.get({
|
|
34
|
+
url,
|
|
35
|
+
noCache,
|
|
36
|
+
params: {
|
|
37
|
+
...params,
|
|
38
|
+
timestamp,
|
|
39
|
+
token,
|
|
40
|
+
sign: (0, tools_1.sign)('index/index/recommend', params, timestamp, token),
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
const list = result.data?.data?.data?.list || [];
|
|
44
|
+
return {
|
|
45
|
+
data: list.map((v) => ({
|
|
46
|
+
id: v.source_id,
|
|
47
|
+
title: v.title,
|
|
48
|
+
cover: v.cover,
|
|
49
|
+
desc: v.abstract,
|
|
50
|
+
hot: undefined,
|
|
51
|
+
url: v.url,
|
|
52
|
+
mobileUrl: v.url,
|
|
53
|
+
})),
|
|
54
|
+
fromCache: result.fromCache,
|
|
55
|
+
updateTime: result.updateTime,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
exports._51ctoSource = _51ctoSource;
|
|
60
|
+
exports._51ctoSource = _51ctoSource = __decorate([
|
|
61
|
+
(0, common_1.Injectable)(),
|
|
62
|
+
(0, hot_source_decorator_1.HotSource)({
|
|
63
|
+
name: '51cto',
|
|
64
|
+
title: '51CTO',
|
|
65
|
+
type: '热榜',
|
|
66
|
+
link: 'https://www.51cto.com/',
|
|
67
|
+
}),
|
|
68
|
+
__metadata("design:paramtypes", [http_service_1.HttpClientService,
|
|
69
|
+
token_service_1.TokenService])
|
|
70
|
+
], _51ctoSource);
|
|
71
|
+
//# sourceMappingURL=51cto.source.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"51cto.source.js","sourceRoot":"","sources":["../../../src/host-lists/sources/51cto.source.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,6EAA+D;AAG/D,0DAA4D;AAE5D,6DAAuD;AACvD,6CAAuC;AAiBhC,IAAM,YAAY,GAAlB,MAAM,YAAY;IACvB,YACmB,WAA8B,EAC9B,YAA0B;QAD1B,gBAAW,GAAX,WAAW,CAAmB;QAC9B,iBAAY,GAAZ,YAAY,CAAc;IAC1C,CAAC;IAEJ,KAAK,CAAC,OAAO,CACX,OAAuB,EACvB,OAAiB;QAEjB,MAAM,GAAG,GAAG,mDAAmD,CAAC;QAChE,MAAM,MAAM,GAAG;YACb,IAAI,EAAE,CAAC;YACP,SAAS,EAAE,EAAE;YACb,UAAU,EAAE,CAAC;YACb,OAAO,EAAE,EAAE;SACZ,CAAC;QACF,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAC7B,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,aAAa,EAAE,CAAC;QACtD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,GAAG,CAAoB;YAC3D,GAAG;YACH,OAAO;YACP,MAAM,EAAE;gBACN,GAAG,MAAM;gBACT,SAAS;gBACT,KAAK;gBACL,IAAI,EAAE,IAAA,YAAI,EAAC,uBAAuB,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,CAAC;aAC9D;SACF,CAAC,CAAC;QACH,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,IAAI,EAAE,CAAC;QACjD,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;gBACrB,EAAE,EAAE,CAAC,CAAC,SAAS;gBACf,KAAK,EAAE,CAAC,CAAC,KAAK;gBACd,KAAK,EAAE,CAAC,CAAC,KAAK;gBACd,IAAI,EAAE,CAAC,CAAC,QAAQ;gBAChB,GAAG,EAAE,SAAS;gBACd,GAAG,EAAE,CAAC,CAAC,GAAG;gBACV,SAAS,EAAE,CAAC,CAAC,GAAG;aACjB,CAAC,CAAC;YACH,SAAS,EAAE,MAAM,CAAC,SAAS;YAC3B,UAAU,EAAE,MAAM,CAAC,UAAU;SAC9B,CAAC;IACJ,CAAC;CACF,CAAA;AA5CY,oCAAY;uBAAZ,YAAY;IAPxB,IAAA,mBAAU,GAAE;IACZ,IAAA,gCAAS,EAAC;QACT,IAAI,EAAE,OAAO;QACb,KAAK,EAAE,OAAO;QACd,IAAI,EAAE,IAAI;QACV,IAAI,EAAE,wBAAwB;KAC/B,CAAC;qCAGgC,gCAAiB;QAChB,4BAAY;GAHlC,YAAY,CA4CxB"}
|
|
@@ -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 PojieSource implements HotListSource {
|
|
6
|
+
private readonly httpService;
|
|
7
|
+
constructor(httpService: HttpClientService);
|
|
8
|
+
getList(options: GetListOptions, noCache?: boolean): Promise<HotListGetListResponse>;
|
|
9
|
+
}
|