@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,139 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
|
+
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;
|
|
22
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
|
+
};
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
42
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
43
|
+
};
|
|
44
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
+
exports.GelonghuiSource = void 0;
|
|
46
|
+
const common_1 = require("@nestjs/common");
|
|
47
|
+
const hot_source_decorator_1 = require("../decorators/hot-source.decorator");
|
|
48
|
+
const http_service_1 = require("../../http/http.service");
|
|
49
|
+
const cheerio = __importStar(require("cheerio"));
|
|
50
|
+
const getTime_1 = require("../../utils/getTime");
|
|
51
|
+
const BASE = 'https://www.gelonghui.com';
|
|
52
|
+
function resolveUrl(href) {
|
|
53
|
+
if (!href)
|
|
54
|
+
return '';
|
|
55
|
+
if (href.startsWith('http'))
|
|
56
|
+
return href;
|
|
57
|
+
if (href.startsWith('//'))
|
|
58
|
+
return `https:${href}`;
|
|
59
|
+
return `${BASE}${href.startsWith('/') ? '' : '/'}${href}`;
|
|
60
|
+
}
|
|
61
|
+
function articlePath(href) {
|
|
62
|
+
try {
|
|
63
|
+
if (href.startsWith('http'))
|
|
64
|
+
return new URL(href).pathname;
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
}
|
|
68
|
+
return href.split('?')[0];
|
|
69
|
+
}
|
|
70
|
+
let GelonghuiSource = class GelonghuiSource {
|
|
71
|
+
constructor(httpService) {
|
|
72
|
+
this.httpService = httpService;
|
|
73
|
+
}
|
|
74
|
+
async getList(options, noCache) {
|
|
75
|
+
const url = 'https://www.gelonghui.com/';
|
|
76
|
+
const result = await this.httpService.get({
|
|
77
|
+
url,
|
|
78
|
+
noCache,
|
|
79
|
+
responseType: 'text',
|
|
80
|
+
headers: {
|
|
81
|
+
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36',
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
const $ = cheerio.load(result.data);
|
|
85
|
+
const list = $('ul.article-ul li.article-li')
|
|
86
|
+
.toArray()
|
|
87
|
+
.map((el) => {
|
|
88
|
+
const $li = $(el);
|
|
89
|
+
const $mainLink = $li.find('.detail-right > a').first();
|
|
90
|
+
const rawHref = $mainLink.attr('href') ||
|
|
91
|
+
$li.find('a.detail-left').attr('href') ||
|
|
92
|
+
'';
|
|
93
|
+
const fullUrl = resolveUrl(rawHref);
|
|
94
|
+
const path = articlePath(rawHref);
|
|
95
|
+
const idMatch = path.match(/\/p\/(\d+)/);
|
|
96
|
+
const id = idMatch ? idMatch[1] : fullUrl;
|
|
97
|
+
const title = $mainLink.find('h2').text().replace(/\s+/g, ' ').trim();
|
|
98
|
+
const desc = $mainLink
|
|
99
|
+
.find('summary')
|
|
100
|
+
.text()
|
|
101
|
+
.replace(/\s+/g, ' ')
|
|
102
|
+
.trim();
|
|
103
|
+
const cover = $li.find('.detail-left img').attr('data-src');
|
|
104
|
+
const author = $li
|
|
105
|
+
.find('.source-time .source')
|
|
106
|
+
.text()
|
|
107
|
+
.replace(/\s+/g, ' ')
|
|
108
|
+
.trim();
|
|
109
|
+
return {
|
|
110
|
+
id,
|
|
111
|
+
title,
|
|
112
|
+
desc: desc || undefined,
|
|
113
|
+
cover,
|
|
114
|
+
author: author || undefined,
|
|
115
|
+
url: fullUrl,
|
|
116
|
+
mobileUrl: fullUrl,
|
|
117
|
+
timestamp: (0, getTime_1.getTime)(+new Date()),
|
|
118
|
+
};
|
|
119
|
+
})
|
|
120
|
+
.filter((item) => item.title && item.url);
|
|
121
|
+
return {
|
|
122
|
+
data: list,
|
|
123
|
+
fromCache: result.fromCache,
|
|
124
|
+
updateTime: result.updateTime,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
exports.GelonghuiSource = GelonghuiSource;
|
|
129
|
+
exports.GelonghuiSource = GelonghuiSource = __decorate([
|
|
130
|
+
(0, common_1.Injectable)(),
|
|
131
|
+
(0, hot_source_decorator_1.HotSource)({
|
|
132
|
+
name: 'gelonghui',
|
|
133
|
+
title: '格隆汇',
|
|
134
|
+
type: '财经',
|
|
135
|
+
link: 'https://www.gelonghui.com/',
|
|
136
|
+
}),
|
|
137
|
+
__metadata("design:paramtypes", [http_service_1.HttpClientService])
|
|
138
|
+
], GelonghuiSource);
|
|
139
|
+
//# sourceMappingURL=gelonghui.source.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gelonghui.source.js","sourceRoot":"","sources":["../../../src/host-lists/sources/gelonghui.source.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,2CAA4C;AAC5C,6EAA+D;AAG/D,0DAA4D;AAE5D,iDAAmC;AACnC,iDAA4C;AAE5C,MAAM,IAAI,GAAG,2BAA2B,CAAC;AAEzC,SAAS,UAAU,CAAC,IAAwB;IAC1C,IAAI,CAAC,IAAI;QAAE,OAAO,EAAE,CAAC;IACrB,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;QAAE,OAAO,IAAI,CAAC;IACzC,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;QAAE,OAAO,SAAS,IAAI,EAAE,CAAC;IAClD,OAAO,GAAG,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG,IAAI,EAAE,CAAC;AAC5D,CAAC;AAED,SAAS,WAAW,CAAC,IAAY;IAC/B,IAAI,CAAC;QACH,I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AE;IACZ,IAAA,gCAAS,EAAC;QACT,IAAI,EAAE,WAAW;QACjB,KAAK,EAAE,KAAK;QACZ,IAAI,EAAE,IAAI;QACV,IAAI,EAAE,4BAA4B;KACnC,CAAC;qCAE0C,gCAAiB;GADhD,eAAe,CAiE3B"}
|
|
@@ -0,0 +1,12 @@
|
|
|
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 GitHubSource implements HotListSource {
|
|
6
|
+
private readonly httpService;
|
|
7
|
+
private readonly logger;
|
|
8
|
+
constructor(httpService: HttpClientService);
|
|
9
|
+
getList(options: GetListOptions, noCache?: boolean): Promise<HotListGetListResponse>;
|
|
10
|
+
private getTrendingRepos;
|
|
11
|
+
private parseGitHubTrendingHTML;
|
|
12
|
+
}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
|
+
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;
|
|
22
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
|
+
};
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
42
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
43
|
+
};
|
|
44
|
+
var GitHubSource_1;
|
|
45
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
+
exports.GitHubSource = void 0;
|
|
47
|
+
const common_1 = require("@nestjs/common");
|
|
48
|
+
const hot_source_decorator_1 = require("../decorators/hot-source.decorator");
|
|
49
|
+
const http_service_1 = require("../../http/http.service");
|
|
50
|
+
const cheerio = __importStar(require("cheerio"));
|
|
51
|
+
const typeMap = {
|
|
52
|
+
daily: '日榜',
|
|
53
|
+
weekly: '周榜',
|
|
54
|
+
monthly: '月榜',
|
|
55
|
+
};
|
|
56
|
+
function isTrendingType(value) {
|
|
57
|
+
return ['daily', 'weekly', 'monthly'].includes(value);
|
|
58
|
+
}
|
|
59
|
+
let GitHubSource = GitHubSource_1 = class GitHubSource {
|
|
60
|
+
constructor(httpService) {
|
|
61
|
+
this.httpService = httpService;
|
|
62
|
+
this.logger = new common_1.Logger(GitHubSource_1.name);
|
|
63
|
+
}
|
|
64
|
+
async getList(options, noCache) {
|
|
65
|
+
const typeParam = options?.type || 'daily';
|
|
66
|
+
const type = isTrendingType(typeParam) ? typeParam : 'daily';
|
|
67
|
+
const repos = await this.getTrendingRepos(type, noCache);
|
|
68
|
+
return {
|
|
69
|
+
data: repos.map((repo, index) => ({
|
|
70
|
+
id: index,
|
|
71
|
+
title: repo.repo,
|
|
72
|
+
desc: repo.description,
|
|
73
|
+
cover: '',
|
|
74
|
+
author: repo.owner,
|
|
75
|
+
timestamp: 0,
|
|
76
|
+
hot: repo.stars,
|
|
77
|
+
url: repo.url,
|
|
78
|
+
mobileUrl: repo.url,
|
|
79
|
+
})),
|
|
80
|
+
type: typeMap[type],
|
|
81
|
+
params: {
|
|
82
|
+
type: {
|
|
83
|
+
name: '排行榜分区',
|
|
84
|
+
type: typeMap,
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
async getTrendingRepos(type, noCache) {
|
|
90
|
+
const url = `https://github.com/trending?since=${type}`;
|
|
91
|
+
try {
|
|
92
|
+
const result = await this.httpService.get({
|
|
93
|
+
url,
|
|
94
|
+
noCache,
|
|
95
|
+
ttl: 60 * 60 * 24,
|
|
96
|
+
retries: 3,
|
|
97
|
+
timeout: 20000,
|
|
98
|
+
headers: {
|
|
99
|
+
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36',
|
|
100
|
+
Accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
|
|
101
|
+
'Accept-Language': 'en-US,en;q=0.5',
|
|
102
|
+
'Accept-Encoding': 'gzip, deflate, br',
|
|
103
|
+
Connection: 'keep-alive',
|
|
104
|
+
'Upgrade-Insecure-Requests': '1',
|
|
105
|
+
'Sec-Fetch-Dest': 'document',
|
|
106
|
+
'Sec-Fetch-Mode': 'navigate',
|
|
107
|
+
'Sec-Fetch-Site': 'none',
|
|
108
|
+
'Sec-Fetch-User': '?1',
|
|
109
|
+
'Cache-Control': 'max-age=0',
|
|
110
|
+
},
|
|
111
|
+
});
|
|
112
|
+
this.logger.log(`✅ Successfully fetched GitHub trending for ${type}`);
|
|
113
|
+
return this.parseGitHubTrendingHTML(result.data);
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
this.logger.error(`❌ Failed to fetch GitHub trending`, error);
|
|
117
|
+
throw new Error(`Failed to fetch GitHub trending: ${error.message}`);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
parseGitHubTrendingHTML(html) {
|
|
121
|
+
const $ = cheerio.load(html);
|
|
122
|
+
const results = [];
|
|
123
|
+
$('article.Box-row').each((_, el) => {
|
|
124
|
+
const $el = $(el);
|
|
125
|
+
const $repoAnchor = $el.find('h2 a');
|
|
126
|
+
const fullNameText = $repoAnchor
|
|
127
|
+
.text()
|
|
128
|
+
.trim()
|
|
129
|
+
.replace(/\r?\n/g, '')
|
|
130
|
+
.replace(/\s+/g, ' ')
|
|
131
|
+
.split('/')
|
|
132
|
+
.map((s) => s.trim());
|
|
133
|
+
const owner = fullNameText[0] || '';
|
|
134
|
+
const repoName = fullNameText[1] || '';
|
|
135
|
+
const repoUrl = 'https://github.com' + $repoAnchor.attr('href');
|
|
136
|
+
const description = $el.find('p.col-9.color-fg-muted').text().trim();
|
|
137
|
+
const language = $el
|
|
138
|
+
.find('[itemprop="programmingLanguage"]')
|
|
139
|
+
.text()
|
|
140
|
+
.trim();
|
|
141
|
+
const starsText = $el.find('a[href$="/stargazers"]').text().trim();
|
|
142
|
+
const forksText = $el.find('a[href$="/forks"]').text().trim();
|
|
143
|
+
const todayStarsElement = $el.find('span.d-inline-block.float-sm-right');
|
|
144
|
+
const todayStars = todayStarsElement.text().trim();
|
|
145
|
+
results.push({
|
|
146
|
+
owner,
|
|
147
|
+
repo: repoName,
|
|
148
|
+
url: repoUrl || '',
|
|
149
|
+
description,
|
|
150
|
+
language,
|
|
151
|
+
stars: starsText,
|
|
152
|
+
forks: forksText,
|
|
153
|
+
todayStars: todayStars || undefined,
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
this.logger.log(`📊 Parsed ${results.length} repositories from GitHub trending`);
|
|
157
|
+
return results;
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
exports.GitHubSource = GitHubSource;
|
|
161
|
+
exports.GitHubSource = GitHubSource = GitHubSource_1 = __decorate([
|
|
162
|
+
(0, common_1.Injectable)(),
|
|
163
|
+
(0, hot_source_decorator_1.HotSource)({
|
|
164
|
+
name: 'github',
|
|
165
|
+
title: 'GitHub',
|
|
166
|
+
type: '趋势',
|
|
167
|
+
link: 'https://github.com/trending',
|
|
168
|
+
}),
|
|
169
|
+
__metadata("design:paramtypes", [http_service_1.HttpClientService])
|
|
170
|
+
], GitHubSource);
|
|
171
|
+
//# sourceMappingURL=github.source.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github.source.js","sourceRoot":"","sources":["../../../src/host-lists/sources/github.source.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAAoD;AACpD,6EAA+D;AAG/D,0DAA4D;AAE5D,iDAAmC;AAInC,MAAM,OAAO,GAAiC;IAC5C,KAAK,EAAE,IAAI;IACX,MAAM,EAAE,IAAI;IACZ,OAAO,EAAE,IAAI;CACd,CAAC;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IAAI,EAAE;gBAClB,WAAW;gBACX,QAAQ;gBACR,KAAK,EAAE,SAAS;gBAChB,KAAK,EAAE,SAAS;gBAChB,UAAU,EAAE,UAAU,IAAI,SAAS;aACpC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,MAAM,CAAC,GAAG,CACb,aAAa,OAAO,CAAC,MAAM,oCAAoC,CAChE,CAAC;QACF,OAAO,OAAO,CAAC;IACjB,CAAC;CACF,CAAA;AAtIY,oCAAY;uBAAZ,YAAY;IAPxB,IAAA,mBAAU,GAAE;IACZ,IAAA,gCAAS,EAAC;QACT,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,QAAQ;QACf,IAAI,EAAE,IAAI;QACV,IAAI,EAAE,6BAA6B;KACpC,CAAC;qCAI0C,gCAAiB;GAHhD,YAAY,CAsIxB"}
|
|
@@ -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 GuokrSource implements HotListSource {
|
|
6
|
+
private readonly httpService;
|
|
7
|
+
private readonly logger;
|
|
8
|
+
constructor(httpService: HttpClientService);
|
|
9
|
+
getList(options: GetListOptions, noCache?: boolean): Promise<HotListGetListResponse>;
|
|
10
|
+
private fetchFromAPI;
|
|
11
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
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 GuokrSource_1;
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.GuokrSource = 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 getTime_1 = require("../../utils/getTime");
|
|
18
|
+
let GuokrSource = GuokrSource_1 = class GuokrSource {
|
|
19
|
+
constructor(httpService) {
|
|
20
|
+
this.httpService = httpService;
|
|
21
|
+
this.logger = new common_1.Logger(GuokrSource_1.name);
|
|
22
|
+
}
|
|
23
|
+
async getList(options, noCache) {
|
|
24
|
+
try {
|
|
25
|
+
const result = await this.fetchFromAPI(noCache ?? false);
|
|
26
|
+
return {
|
|
27
|
+
data: result.data,
|
|
28
|
+
params: {
|
|
29
|
+
type: {
|
|
30
|
+
name: '热门文章',
|
|
31
|
+
type: {},
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
fromCache: result.fromCache,
|
|
35
|
+
updateTime: result.updateTime,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
|
|
40
|
+
this.logger.error(`Failed to get list from API: ${errorMessage}`);
|
|
41
|
+
return {
|
|
42
|
+
data: [],
|
|
43
|
+
params: {
|
|
44
|
+
type: {
|
|
45
|
+
name: '热门文章',
|
|
46
|
+
type: {},
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
fromCache: false,
|
|
50
|
+
updateTime: new Date(),
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
async fetchFromAPI(noCache) {
|
|
55
|
+
const url = 'https://www.guokr.com/beta/proxy/science_api/articles';
|
|
56
|
+
const headers = {
|
|
57
|
+
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 Edg/131.0.0.0',
|
|
58
|
+
};
|
|
59
|
+
const response = await this.httpService.get({
|
|
60
|
+
url,
|
|
61
|
+
headers,
|
|
62
|
+
params: {
|
|
63
|
+
limit: '30',
|
|
64
|
+
},
|
|
65
|
+
noCache,
|
|
66
|
+
});
|
|
67
|
+
const apiData = response.data || [];
|
|
68
|
+
const list = apiData.map((v) => ({
|
|
69
|
+
id: v.id,
|
|
70
|
+
title: v.title,
|
|
71
|
+
desc: v.summary,
|
|
72
|
+
cover: v.small_image,
|
|
73
|
+
author: v.author?.nickname,
|
|
74
|
+
hot: undefined,
|
|
75
|
+
timestamp: (0, getTime_1.getTime)(v.date_modified),
|
|
76
|
+
url: `https://www.guokr.com/article/${v.id}`,
|
|
77
|
+
mobileUrl: `https://m.guokr.com/article/${v.id}`,
|
|
78
|
+
}));
|
|
79
|
+
return {
|
|
80
|
+
data: list,
|
|
81
|
+
fromCache: response.fromCache,
|
|
82
|
+
updateTime: response.updateTime,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
exports.GuokrSource = GuokrSource;
|
|
87
|
+
exports.GuokrSource = GuokrSource = GuokrSource_1 = __decorate([
|
|
88
|
+
(0, common_1.Injectable)(),
|
|
89
|
+
(0, hot_source_decorator_1.HotSource)({
|
|
90
|
+
name: 'guokr',
|
|
91
|
+
title: '果壳',
|
|
92
|
+
type: '热门文章',
|
|
93
|
+
description: '科技有意思',
|
|
94
|
+
link: 'https://www.guokr.com/',
|
|
95
|
+
}),
|
|
96
|
+
__metadata("design:paramtypes", [http_service_1.HttpClientService])
|
|
97
|
+
], GuokrSource);
|
|
98
|
+
//# sourceMappingURL=guokr.source.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guokr.source.js","sourceRoot":"","sources":["../../../src/host-lists/sources/guokr.source.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAoD;AACpD,6EAA+D;AAM/D,0DAA4D;AAE5D,iDAA8C;AAsBvC,IAAM,WAAW,mBAAjB,MAAM,WAAW;IAGtB,YAA6B,WAA8B;QAA9B,gBAAW,GAAX,WAAW,CAAmB;QAF1C,WAAM,GAAG,IAAI,eAAM,CAAC,aAAW,CAAC,IAAI,CAAC,CAAC;IAEO,CAAC;IAE/D,KAAK,CAAC,OAAO,CACX,OAAuB,EACvB,OAAiB;QAEjB,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,IAAI,KAAK,CAAC,CAAC;YACzD,OAAO;gBACL,IAAI,EAAE,MAAM,CAAC,IAAI;gBACjB,MAAM,EAAE;oBACN,IAAI,EAAE;wBACJ,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,EAAE;qBACT;iBACF;gBACD,SAAS,EAAE,MAAM,CAAC,SAAS;gBAC3B,UAAU,EAAE,MAAM,CAAC,UAAU;aAC9B,CAAC;QACJ,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,MAAM,YAAY,GAChB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC;YAE3D,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,gCAAgC,YAAY,EAAE,CAAC,CAAC;YAClE,OAAO;gBACL,IAAI,EAAE,EAAE;gBACR,MAAM,EAAE;oBACN,IAAI,EAAE;wBACJ,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,EAAE;qBACT;iBACF;gBACD,SAAS,EAAE,KAAK;gBAChB,UAAU,EAAE,IAAI,IAAI,EAAE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B;KAC/B,CAAC;qCAI0C,gCAAiB;GAHhD,WAAW,CA+EvB"}
|
|
@@ -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 HackerNewsSource implements HotListSource {
|
|
6
|
+
private readonly httpService;
|
|
7
|
+
private readonly logger;
|
|
8
|
+
constructor(httpService: HttpClientService);
|
|
9
|
+
getList(options: GetListOptions, noCache?: boolean): Promise<HotListGetListResponse>;
|
|
10
|
+
private fetchFromAPI;
|
|
11
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
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 HackerNewsSource_1;
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.HackerNewsSource = 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
|
+
let HackerNewsSource = HackerNewsSource_1 = class HackerNewsSource {
|
|
18
|
+
constructor(httpService) {
|
|
19
|
+
this.httpService = httpService;
|
|
20
|
+
this.logger = new common_1.Logger(HackerNewsSource_1.name);
|
|
21
|
+
}
|
|
22
|
+
async getList(options, noCache) {
|
|
23
|
+
try {
|
|
24
|
+
const result = await this.fetchFromAPI(noCache);
|
|
25
|
+
return {
|
|
26
|
+
data: result.data,
|
|
27
|
+
params: {
|
|
28
|
+
type: {
|
|
29
|
+
name: 'Top Stories',
|
|
30
|
+
type: {},
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
fromCache: result.fromCache,
|
|
34
|
+
updateTime: result.updateTime,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
|
|
39
|
+
this.logger.error(`Failed to get HackerNews list: ${errorMessage}`);
|
|
40
|
+
return {
|
|
41
|
+
data: [],
|
|
42
|
+
params: {
|
|
43
|
+
type: {
|
|
44
|
+
name: 'Top Stories',
|
|
45
|
+
type: {},
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
fromCache: false,
|
|
49
|
+
updateTime: new Date(),
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
async fetchFromAPI(noCache) {
|
|
54
|
+
const topStoriesUrl = 'https://hacker-news.firebaseio.com/v0/topstories.json';
|
|
55
|
+
const itemBaseUrl = 'https://hacker-news.firebaseio.com/v0/item/';
|
|
56
|
+
const headers = {
|
|
57
|
+
Accept: 'application/json',
|
|
58
|
+
'User-Agent': 'Mozilla/5.0 (compatible; HackerNewsBot/1.0)',
|
|
59
|
+
};
|
|
60
|
+
const topStoriesResponse = await this.httpService.get({
|
|
61
|
+
url: topStoriesUrl,
|
|
62
|
+
headers,
|
|
63
|
+
noCache,
|
|
64
|
+
});
|
|
65
|
+
const topStoryIds = topStoriesResponse.data.slice(0, 30);
|
|
66
|
+
const stories = [];
|
|
67
|
+
const batchSize = 10;
|
|
68
|
+
for (let i = 0; i < topStoryIds.length; i += batchSize) {
|
|
69
|
+
const batch = topStoryIds.slice(i, i + batchSize);
|
|
70
|
+
const batchPromises = batch.map(async (id) => {
|
|
71
|
+
try {
|
|
72
|
+
const itemResponse = await this.httpService.get({
|
|
73
|
+
url: `${itemBaseUrl}${id}.json`,
|
|
74
|
+
headers,
|
|
75
|
+
noCache,
|
|
76
|
+
});
|
|
77
|
+
const item = itemResponse.data;
|
|
78
|
+
if (item && item.title && item.type === 'story') {
|
|
79
|
+
const baseUrl = 'https://news.ycombinator.com';
|
|
80
|
+
const finalUrl = item.url || `${baseUrl}/item?id=${item.id}`;
|
|
81
|
+
const hotListItem = {
|
|
82
|
+
id: item.id.toString(),
|
|
83
|
+
title: item.title,
|
|
84
|
+
hot: item.score || 0,
|
|
85
|
+
timestamp: item.time ? item.time * 1000 : Date.now(),
|
|
86
|
+
url: finalUrl,
|
|
87
|
+
mobileUrl: finalUrl,
|
|
88
|
+
author: item.by,
|
|
89
|
+
};
|
|
90
|
+
return hotListItem;
|
|
91
|
+
}
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
catch (error) {
|
|
95
|
+
this.logger.warn(`Failed to fetch item ${id}: ${error}`);
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
const batchResults = await Promise.all(batchPromises);
|
|
100
|
+
stories.push(...batchResults.filter((item) => item !== null));
|
|
101
|
+
}
|
|
102
|
+
return {
|
|
103
|
+
data: stories,
|
|
104
|
+
fromCache: topStoriesResponse.fromCache,
|
|
105
|
+
updateTime: topStoriesResponse.updateTime,
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
exports.HackerNewsSource = HackerNewsSource;
|
|
110
|
+
exports.HackerNewsSource = HackerNewsSource = HackerNewsSource_1 = __decorate([
|
|
111
|
+
(0, common_1.Injectable)(),
|
|
112
|
+
(0, hot_source_decorator_1.HotSource)({
|
|
113
|
+
name: 'hackernews',
|
|
114
|
+
title: 'Hacker News',
|
|
115
|
+
type: 'Popular',
|
|
116
|
+
description: 'News about hacking and startups',
|
|
117
|
+
link: 'https://news.ycombinator.com/',
|
|
118
|
+
}),
|
|
119
|
+
__metadata("design:paramtypes", [http_service_1.HttpClientService])
|
|
120
|
+
], HackerNewsSource);
|
|
121
|
+
//# sourceMappingURL=hackernews.source.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hackernews.source.js","sourceRoot":"","sources":["../../../src/host-lists/sources/hackernews.source.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAoD;AACpD,6EAA+D;AAM/D,0DAA4D;AAsBrD,IAAM,gBAAgB,wBAAtB,MAAM,gBAAgB;IAG3B,YAA6B,WAA8B;QAA9B,gBAAW,GAAX,WAAW,CAAmB;QAF1C,WAAM,GAAG,IAAI,eAAM,CAAC,kBAAgB,CAAC,IAAI,CAAC,CAAC;IAEE,CAAC;IAE/D,KAAK,CAAC,OAAO,CACX,OAAuB,EACvB,OAAiB;QAEjB,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;YAChD,OAAO;gBACL,IAAI,EAAE,MAAM,CAAC,IAAI;gBACjB,MAAM,EAAE;oBACN,IAAI,EAAE;wBACJ,IAAI,EAAE,aAAa;wBACnB,IAAI,EAAE,EAAE;qBACT;iBACF;gBACD,SAAS,EAAE,MAAM,CAAC,SAAS;gBAC3B,UAAU,EAAE,MAAM,CAAC,UAAU;aAC9B,CAAC;QACJ,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,MAAM,YAAY,GAChB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC;YAE3D,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,kCAAkC,YAAY,EAAE,CAAC,CAAC;YACpE,OAAO;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;CACF,CAAA;AAnHY,4CAAgB;2BAAhB,gBAAgB;IAR5B,IAAA,mBAAU,GAAE;IACZ,IAAA,gCAAS,EAAC;QACT,IAAI,EAAE,YAAY;QAClB,KAAK,EAAE,aAAa;QACpB,IAAI,EAAE,SAAS;QACf,WAAW,EAAE,iCAAiC;QAC9C,IAAI,EAAE,+BAA+B;KACtC,CAAC;qCAI0C,gCAAiB;GAHhD,gBAAgB,CAmH5B"}
|
|
@@ -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 HelloGitHubSource implements HotListSource {
|
|
6
|
+
private readonly httpService;
|
|
7
|
+
private readonly logger;
|
|
8
|
+
constructor(httpService: HttpClientService);
|
|
9
|
+
getList(options: GetListOptions, noCache?: boolean): Promise<HotListGetListResponse>;
|
|
10
|
+
private fetchFromAPI;
|
|
11
|
+
}
|