# Bililive-go API ## `GET /api/info` Get app info - Request: ```text method: GET path: http://127.0.0.1:8080/api/info ``` - Response: ```json { "app_name": "BiliLive-go", "app_version": "0.5.0-rc.3-3-g31ceeda", "build_time": "2020-05-05_01:07:16", "git_hash": "31ceeda8f508ba5546cfdefef5f3945828a87651", "pid": 33295, "platform": "darwin/amd64", "go_version": "go1.14.2" } ``` ## `GET /api/lives` Get all live info - Request: ```text method: GET path: http://127.0.0.1:8080/api/lives ``` - Response: ```json [ { "id": "212d9c98c7b376b730d4336bb49f6d3f", "live_url": "https://live.bilibili.com/14917277", "platform_cn_name": "哔哩哔哩", "host_name": "湊-阿库娅Official", "room_name": "【B站限定】棉花糖&唱歌!!!!", "status": false, "listening": true, "recoding": false }, { "id": "63dc965c77d3d81058c92c3e38822256", "live_url": "https://live.bilibili.com/11588230", "platform_cn_name": "哔哩哔哩", "host_name": "白上吹雪Official", "room_name": "古老niconico老人会with☆乐园", "status": false, "listening": true, "recoding": false }, { "id": "dfb964a56725bbad165cb9ea1ef8ac5b", "live_url": "https://live.bilibili.com/1030", "platform_cn_name": "哔哩哔哩", "host_name": "怕上火暴王老菊", "room_name": "直播做饭", "status": false, "listening": true, "recoding": false } ] ``` ## `GET /api/lives/{id}` Get live info by id - Request: ```text method: GET path: http://127.0.0.1:8080/api/lives/212d9c98c7b376b730d4336bb49f6d3f ``` - Response: ```json { "id": "212d9c98c7b376b730d4336bb49f6d3f", "live_url": "https://live.bilibili.com/14917277", "platform_cn_name": "哔哩哔哩", "host_name": "湊-阿库娅Official", "room_name": "【B站限定】棉花糖&唱歌!!!!", "status": false, "listening": true, "recoding": false } ``` ## `POST /api/lives` Add live - Request: ```text method: POST path: http://127.0.0.1:8080/api/lives body: [ { "url": "https://live.bilibili.com/14917277", "listen": true } ] ``` - Response: ```json [ { "id": "212d9c98c7b376b730d4336bb49f6d3f", "live_url": "https://live.bilibili.com/14917277", "platform_cn_name": "哔哩哔哩", "host_name": "湊-阿库娅Official", "room_name": "【B站限定】棉花糖&唱歌!!!!", "status": false, "listening": true, "recoding": false } ] ``` ## `DELETE /api/lives/{id}` Delete live by id - Request: ```text method: DELETE path: http://127.0.0.1:8080/api/lives/212d9c98c7b376b730d4336bb49f6d3f ``` - Response: ```text OK ``` ## `GET /api/lives/{id}/start` Start listen live by id - Request: ```text method: GET path: http://127.0.0.1:8080/api/lives/212d9c98c7b376b730d4336bb49f6d3f/start ``` - Response: ```json { "id": "212d9c98c7b376b730d4336bb49f6d3f", "live_url": "https://live.bilibili.com/14917277", "platform_cn_name": "哔哩哔哩", "host_name": "湊-阿库娅Official", "room_name": "【B站限定】棉花糖&唱歌!!!!", "status": false, "listening": true, "recoding": false } ``` ## `GET /api/lives/{id}/stop` Stop listen and record live by id - Request: ```text method: GET path: http://127.0.0.1:8080/api/lives/212d9c98c7b376b730d4336bb49f6d3f/stop ``` - Response: ```json { "id": "212d9c98c7b376b730d4336bb49f6d3f", "live_url": "https://live.bilibili.com/14917277", "platform_cn_name": "哔哩哔哩", "host_name": "湊-阿库娅Official", "room_name": "【B站限定】棉花糖&唱歌!!!!", "status": false, "listening": false, "recoding": false } ``` ## `GET /api/config` Get config info - Request: ```text method: GET path: http://127.0.0.1:8080/api/config ``` - Response: ```json { "RPC": { "Enable": true, "Bind": "127.0.0.1:8080" }, "Debug": false, "Interval": 15, "OutPutPath": "/tmp", "Feature": { "UseNativeFlvParser": false }, "LiveRooms": null } ``` ## `PUT /api/config` Save lives info to config file - Request: ```text method: PUT path: http://127.0.0.1:8080/api/config ``` - Response: ```text OK ```