{"id":13431177,"url":"https://github.com/eric2788/biligo-live-ws","last_synced_at":"2026-01-14T20:44:47.633Z","repository":{"id":42370924,"uuid":"431940223","full_name":"eric2788/biligo-live-ws","owner":"eric2788","description":"免 binary 处理，包裝成Websocket 的 B站直播 pubsub 監控伺服器","archived":true,"fork":false,"pushed_at":"2023-06-20T15:12:33.000Z","size":296,"stargazers_count":17,"open_issues_count":1,"forks_count":5,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-16T11:34:29.220Z","etag":null,"topics":["bilibili","bilibili-live","bilibili-live-ws","websocket"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eric2788.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2021-11-25T18:20:10.000Z","updated_at":"2024-10-26T13:40:34.000Z","dependencies_parsed_at":"2024-02-26T19:47:29.785Z","dependency_job_id":"943312ef-3067-4343-99f1-513664117325","html_url":"https://github.com/eric2788/biligo-live-ws","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/eric2788/biligo-live-ws","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eric2788%2Fbiligo-live-ws","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eric2788%2Fbiligo-live-ws/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eric2788%2Fbiligo-live-ws/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eric2788%2Fbiligo-live-ws/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eric2788","download_url":"https://codeload.github.com/eric2788/biligo-live-ws/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eric2788%2Fbiligo-live-ws/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28434497,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T18:57:19.464Z","status":"ssl_error","status_checked_at":"2026-01-14T18:52:48.501Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bilibili","bilibili-live","bilibili-live-ws","websocket"],"created_at":"2024-07-31T02:01:01.090Z","updated_at":"2026-01-14T20:44:47.615Z","avatar_url":"https://github.com/eric2788.png","language":"Go","funding_links":[],"categories":["直播相关工具"],"sub_categories":["直播脚本"],"readme":"## **__本项目将不再追加新功能，届时将使用 Rust 重写。__**\n\n# biligo-live-ws\n\n以 [bili-go](https://github.com/iyear/biligo-live) 为核心, 基于 JSON string 序列化 的 B站 WebSocket 监控服务器。\n\n## 简介\n\n根据个人开发经验，每次开发与B站直播WS相关的项目时，都要烦恼自己所使用的编程语言有没有相关的B站WS处理库，如果没有的话更要自己实作一个，当中的 binary 处理和解压程序可谓相当麻烦。\n\n### 连线即用\n\n打开后，透过 POST 请求输入你的订阅房间列表，然后连入WS后即可开始接收JSON数据，**无需binary处理**。\n\n你也可以连入 WebSocket 之后才输入你的订阅\n\n### 即时增减\n\n可以透过 PUT 请求即时新增和删除批量房间号，此举**不需要**透过重连 WebSocket 来刷新\n\n### 无需后端\n\n透过直接存取公共 API 地址，可直接在前端获取B站直播数据而无需自架或开发后端。\n\n## 直接使用\n\n目前的公共 API 地址: \n\n- https://blive.ericlamm.xyz/ (位置: 东京 DigitalOcean)\n- https://blive-jp.ericlamm.xyz/ (位置: 东京 Oracle)\n\n执行 GET / 后 显示\n\n```json\n{\n  \"status\": \"working\"\n}\n\n```\n则代表服务正常运行。\n\n可供测试的前端地址: https://eric2788.github.io/biligo-live-ws\n\n### 使用方式\n\n#### 头规格\n\n| Header        | Value                                     |\n|---------------|-------------------------------------------|\n| Content-Type  | application/x-www-form-urlencoded         |\n| Authorization | 非必填，辨识ID，一个IP多程序用的时候防止混淆；不填则用 `anonymous` |\n\n#### 注意\n\n如果标明了 `Authorization`，则连入 websocket 时需要传入 query string `?id={辨识ID}`\n\n假设你设置订阅时传入头\n\n```json\n{\n  \"Content-Type\": \"application/x-www-form-urlencoded\",\n  \"Authorization\": \"abc\"\n}\n```\n\n连入 WS 则需要使用\n\n``\nwss://blive.ericlamm.xyz/ws?id=abc\n``\n\n此外，现在已新增全局的websocket接口，无需订阅和传入ID，直接传送所有正在监控的房间资料，可使用\n\n``\nwss://blive.ericlamm.xyz/ws/global\n``\n\n但将无法设置订阅。\n\n#### 步骤\n\n1. 透过 POST /subscribe 透过 `subscribes` key 递交你的订阅列表 (数组)\n\n    例如\n    \n    ```bash\n    subscribes=545\u0026subscribes=114514\n    ```\n    \n    成功后将返回**成功订阅**(无效的房间会被忽略)的**真实房间**号列表 (数组)\n    \n    ```json\n    [\n      573893\n    ]\n    ```\n\n   **注意，如果订阅后五分钟内没有连入 WebSocket, 将会自动清除订阅列表数据(断线后也会开始计时)**\n\n\n2. 透过 POST /validate 检查是否一切准备就绪(非必要)\n\n    此请求会检查你的订阅列表是否为空，如果为空将返回 400 错误，否则返回 200\n\n\n3. 开始透过 后缀为 /ws 的请求连入 WebSocket\n\n   如果成功订阅，连入 WebSocket 的几秒后将会开始接收已经 JSON 序列化的 B站直播 数据\n\n### API 参考\n\n| Path 路径           | Method 方法 | Payload 传入   | Response(200) 返回 | Error 错误                   |\n|-------------------|-----------|--------------|------------------|----------------------------|\n| /                 | GET       | 无            | 程序是否运行           | 无                          |\n| /subscribe        | GET       | 无            | 目前的订阅列表(数组)      | 无                          |\n| /subscribe        | POST      | 订阅列表(数组)     | 成功的订阅列表(数组)      | 400 如果輸入列表为空或缺少数值          |\n| /subscribe        | DELETE    | 删除订阅列表       | 无                | 无                          |\n| /validate         | POST      | 无            | 无                | 400 如果准备未就绪                |\n| /subscribe/add    | PUT       | 要新增的批量订阅(数组) | 目前的订阅列表(数组)      | 400 如果輸入列表为空或缺少数值          |\n| /subscribe/remove | PUT       | 要删除的批量订阅(数组) | 目前的订阅列表(数组)      | 400 如果輸入列表为空或缺少数值/之前尚未递交订阅 |\n| /listening        | GET       | 无            | 目前正在监控的所有房间号和总数  | 无                          |\n| /listening/:房间号   | GET       | 无            | 获取该房间号的直播资讯      | 无                          |\n### B站直播数据解析\n\n格式如下\n\n| key       | 数值                 | 类型     |\n|-----------|--------------------|--------|\n| command   | 直播数据指令             | string |\n| live_info | 直播房间资讯             | 详见下方   |\n| content   | 直播数据原始内容(已转换为json) | object |\n\n直播房间资讯\n\n| key              | 数值       | 类型     |\n|------------------|----------|--------|\n| room_id          | 直播房间号    | int64  |\n| uid              | 直播用户ID   | int64  |\n| title            | 直播标题     | int64  |\n| name             | 直播名称     | string |\n| cover            | 直播封面网址   | string |\n| user_face        | 直播用戶头像网址 | string |\n| user_description | 直播用户简介   | string |\n\n**每次开播时都会自动刷新一次直播房间资讯**\n\n### 备注\n\n- 指令为 `HEARTBEAT_REPLY` 的**直播数据原始内容**已被序列化为格式\n\n   ```json\n   {\n      \"popularity\": 999999\n   }\n   ```\n   (999999为人气值)\n\n\n- 直播数据原始内容(content) 如果转换 `object` 失败，将自动转为 `string`\n- 为了防止 B站 API 调用过度频繁，调用 `/subscribe` 或 `/subscribe/add` 时可以傳入 query `?validate=false` 来取消验证房间讯息\n\n## 私人部署\n\n### Docker\n[docker.io](https://hub.docker.com/r/eric1008818/biligo-live-ws) 或 详见 Dockerfile\n\n### Linux / Windows\n\n详见 [Releases](https://github.com/eric2788/biligo-live-ws/releases)\n\n运行参数(非必要)\n\n```bash\n./biligo-live-ws --port 端口 --release\n```\n\n- `port`: 不填则 8080\n- `release`: 添加此参数即等同设置环境参数中 `GIN_MODE` 为 `release` (即 `production mode`)\n\n## 鸣谢\n\n[bili-go](https://github.com/iyear/biligo-live) 作者\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feric2788%2Fbiligo-live-ws","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feric2788%2Fbiligo-live-ws","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feric2788%2Fbiligo-live-ws/lists"}