# Station-Radar **Repository Path**: CovD/Station-Radar ## Basic Information - **Project Name**: Station-Radar - **Description**: No description available - **Primary Language**: JavaScript - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-06-26 - **Last Updated**: 2026-06-26 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Station Radar 一个面向 AI 中转站推荐与对比的轻量原型站。 当前版本重点解决三件事: 1. 把 `sub2api` 和 `new-api` 的价格、倍率、稳定性接口抽象成统一适配层。 2. 首页直接给出“便宜好用榜”,让用户先看到推荐结果,再看细节。 3. 支持 `snapshot` / `hybrid` / `live` 三种数据模式,方便先做原型,再逐步接入真实账号数据。 现在还额外支持一条“沉淀脚本”的工作流: 4. 用一份带认证信息的本地抓取配置,直接批量产出不带账号密码的快照配置。 5. 后面新增一批站点时,可以先批量导入域名,再统一补认证并抓取。 ## 启动 ```bash npm start ``` 默认监听 `http://127.0.0.1:8787`。 ## 配置 先复制一份配置: ```bash cp config/stations.example.json config/stations.local.json ``` 然后按需修改 `config/stations.local.json`。 ## 批量抓真实数据 如果你后面要不断新增站点,推荐用下面这套方式: 1. 复制抓取配置模板 ```bash cp config/stations.capture.example.json config/stations.capture.local.json ``` 2. 在 `config/stations.capture.local.json` 里填站点地址和认证信息 如果你想把账密单独管理,也可以把统一凭据放到 `config/credentials.local.json`,然后只在 `stations.capture.local.json` 里保留站点和认证类型。 3. 运行抓取脚本 ```bash npm run capture ``` 默认行为: - 输入:`config/stations.capture.local.json` - 输出:`config/stations.local.json` 也可以额外把完整聚合结果导出出来: ```bash node scripts/capture-stations.js --dataset-out data/stations.latest.json ``` 说明: - 抓取输入文件会包含账号令牌,所以默认不会进 Git。 - 输出文件是去敏后的 `snapshot` 配置,适合直接给站点前端读取。 - 如果某个站没有开放 `/monitor`、`/uptime/status` 之类的稳定性接口,脚本会尽量继续抓倍率、分组和价格,而不是整站失败。 - `sub2api` 密码登录现在会自动读取 `/api/v1/settings/public`,并在需要时补上 `login_agreement_revision`。 - `sub2api` 现在也会把 `/api/v1/groups/available` 当成正式倍率来源,所以像 `huozz` 这种“渠道列表空、但分组倍率真实存在”的站也能直接抓。 ## 快速新增一个站点 如果你只是想先把新站点塞进抓取配置,不想手写 JSON,可以直接用脚手架: ```bash npm run new:station -- --auth-type sub2api_token --name "My Station" --id my-station --url https://example.com ``` 支持四种认证模板: - `sub2api_token` - `sub2api_password` - `newapi_cookie` - `newapi_password` 示例: ```bash npm run new:station -- --auth-type sub2api_password --name "Another Sub2API" --url https://demo.com ``` ```bash npm run new:station -- --auth-type newapi_cookie --name "Cookie Site" --url https://cookie-site.com ``` 脚本会把站点追加到 `config/stations.capture.local.json`,然后你只需要把占位的 `token / cookie / email / password` 填掉。 ## 批量新增站点 如果你一次要录很多站点,现在可以直接批量导入。 方式一:重复传 `--url` ```bash npm run new:station -- \ --auth-type sub2api_password \ --url https://panel.hanhegufei.online \ --url https://ai-pixel.online \ --url https://huozz.cn ``` 方式二:从文本文件导入 ```bash npm run new:station -- \ --auth-type sub2api_password \ --from-file config/station-urls.example.txt ``` 文本文件格式: - 一行一个域名 - 支持空行 - 支持 `#` 注释 也可以顺手带标签: ```bash npm run new:station -- \ --auth-type sub2api_password \ --from-file config/station-urls.example.txt \ --tag 脚本测试 \ --tag 待补认证 ``` 批量模式下脚本会自动: - 用域名生成默认 `id` - 用域名生成默认站点名 - 自动避开已有 `id` 冲突 - 统一写入 `config/stations.capture.local.json` ## 抓取前校验 抓取脚本现在会先检查: - `id / name / kind / mode / baseUrl` 是否完整 - 认证类型和对应字段是否匹配 - 是否有重复的站点 `id` 这样能在真正抓取前就把大部分配置错误拦下来。 ### 支持的站点类型 - `sub2api` - `newapi` ### 支持的数据模式 - `snapshot`: 只用本地快照,适合做页面原型。 - `hybrid`: 优先实时抓取,失败后回退本地快照。 - `live`: 只用实时抓取,失败直接报错。 ### 推荐的认证方式 `sub2api`: - 优先使用 `sub2api_token` - 其次使用 `sub2api_password` `new-api`: - 优先使用 `newapi_cookie` - 其次使用 `newapi_password` 说明: - 很多站点会开验证码、Turnstile、条款确认或 2FA,直接密码登录不一定稳定。 - 现在脚本已经自动兼容一部分 `sub2api` 的登录条款确认,但如果站点还有更重的验证码或额外风控,`token / cookie` 仍然最稳。 - 所以聚合站已经支持直接塞登录后的 `access_token` 或 `cookie`,这通常比密码抓取更稳。 - `config/stations.local.json` 已被 `.gitignore` 忽略,不会默认进仓库。 - 建议真实抓取时优先用 `config/stations.capture.local.json` 存认证信息,再由脚本生成 `config/stations.local.json`。 - 如果你使用 `config/credentials.local.json`,记得也不要提交它。 ## 已接入的真实接口形态 `sub2api` 适配器当前按这些接口实现: - `GET /api/v1/settings/public` - `POST /api/v1/auth/login` - `GET /api/v1/channels/available` - `GET /api/v1/groups/available` - `GET /api/v1/groups/rates` - `GET /api/v1/channel-monitors` `new-api` 适配器当前按这些接口实现: - `POST /api/user/login` - `GET /api/pricing` - `GET /api/perf-metrics/summary` - `GET /api/user/self/groups` - `GET /api/uptime/status` ## 备注 - 示例配置默认使用快照数据,便于直接打开页面看布局和推荐逻辑。 - 推荐长期维护方式是:先维护 `config/stations.capture.local.json`,再用 `npm run capture` 生成 `config/stations.local.json`。