diff --git a/.travis.yml b/.travis.yml index 3092075b..303ae5a1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: go sudo: required go: - - "1.13" + - "1.14" env: - GO111MODULE=on services: docker diff --git a/README.md b/README.md index 20d2f482..dc93d4fd 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ [![Docker Pulls](https://img.shields.io/docker/pulls/chigusa/bililive-go.svg)](https://hub.docker.com/r/chigusa/bililive-go/) [![Bilibili](https://img.shields.io/badge/%E5%93%94%E5%93%A9%E5%93%94%E5%93%A9-%E6%9C%AA%E6%9D%A5%E7%A7%91%E6%8A%80%E7%8E%8B%E8%80%81%E8%8F%8A%E5%BD%95%E6%92%AD%E7%BB%84-ebb8d0.svg)](https://space.bilibili.com/18578203/) -Bililive-go是一个支持多种直播平台的直播录制工具,运行在 CLI 上 +Bililive-go是一个支持多种直播平台的直播录制工具 ![image](https://github.com/hr3lxphr6j/bililive-go/raw/master/docs/screenshot.png) @@ -103,4 +103,4 @@ $ make ## 参考 - [you-get](https://github.com/soimort/you-get) - [ykdl](https://github.com/zhangn1985/ykdl) -- [youtube-dl](https://github.com/ytdl-org/youtube-dl) \ No newline at end of file +- [youtube-dl](https://github.com/ytdl-org/youtube-dl) diff --git a/docs/API.md b/docs/API.md index 80775c99..2df0e5e1 100644 --- a/docs/API.md +++ b/docs/API.md @@ -1,250 +1,196 @@ # Bililive-go API -## About Token -你可以在配置中指定token来保证API的安全性,token可以以两种方式提供 - - HTTP Basic: `http://token:114514@127.0.0.1:8080/lives` - - Url Parameter: `http://127.0.0.1:8080/lives?token=114514` ----------------------------------------------------------------- -* `GET /info` Get app info - - Request: - ```text - method: GET - path: http://token:114514@127.0.0.1:8080/info - ``` - - Response: - ```json - { - "err_no": 0, - "err_msg": "", - "data": { - "app_name": "BiliLive-go", - "app_version": "0.22.7-2-gd853192", - "build_time": "2018-08-01_21:58:04", - "git_hash": "d853192083ed880998175ba60eb528f5e1ded0e5", - "pid": 44783, - "platform": "darwin/amd64", - "go_version": "go1.10.3" - } - } - ``` -* `GET /lives` Get all live info - - Request: - ```text - method: GET - path: http://token:114514@127.0.0.1:8080/lives - ``` - - Response: - ```json - { - "err_no": 0, - "err_msg": "", - "data": [ - { - "id": "94d6fe233dc6f184d3dd78b6a73ee571", - "live_url": "https://live.bilibili.com/1010", - "platform_cn_name": "哔哩哔哩", - "host_name": "KB呆又呆", - "room_name": "老菊蚊香初体验【KBDYD】", - "status": true, - "listening": true, - "recoding": true - }, - { - "id": "8cfc58ff74b31970899c0fe69345c222", - "live_url": "https://www.panda.tv/10300", - "platform_cn_name": "熊猫", - "host_name": "司机王老菊", - "room_name": "王老菊未来科技演播室", - "status": true, - "listening": true, - "recoding": true - } - ] - } - ``` +## `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 /lives/{id}` Get live info by id - - Request: - ```text - method: GET - path: http://token:114514@127.0.0.1:8080/lives/8cfc58ff74b31970899c0fe69345c222 - ``` - - Response: - ```json - { - "err_no": 0, - "err_msg": "", - "data": { - "id": "8cfc58ff74b31970899c0fe69345c222", - "live_url": "https://www.panda.tv/10300", - "platform_cn_name": "熊猫", - "host_name": "司机王老菊", - "room_name": "王老菊未来科技演播室", - "status": true, - "listening": true, - "recoding": true - } - } - ``` +## `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 + } + ] + ``` -* `POST /lives` Add live - - Request: - ```text - method: POST - path: http://token:114514@127.0.0.1:8080/lives - body: - { - "lives": [ - { - "url": "https://www.douyu.com/6655", - "listen": true - } - ] - } - ``` - - Response: - ```json - { - "err_no": 0, - "err_msg": "", - "data": [ - { - "id": "780c675e3e39fbeff6c10344b6c164e0", - "live_url": "https://www.douyu.com/6655", - "platform_cn_name": "斗鱼", - "host_name": "ywwuyi", - "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 + } + ``` -* `DELETE /lives/{id}` Delete live by id - - Request: - ```text - method: DELETE - path: http://token:114514@127.0.0.1:8080/lives/8cfc58ff74b31970899c0fe69345c222 - ``` - - Response: - ```json +## `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 + [ { - "err_no": 0, - "err_msg": "", - "data": "OK" + "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 /lives/{id}/start` Start listen live by id - - Request: - ```text - method: GET - path: http://token:114514@127.0.0.1:8080/lives/8cfc58ff74b31970899c0fe69345c222/start - ``` - - Response: - ```json - { - "err_no": 0, - "err_msg": "", - "data": { - "id": "8cfc58ff74b31970899c0fe69345c222", - "live_url": "https://www.panda.tv/10300", - "platform_cn_name": "熊猫", - "host_name": "司机王老菊", - "room_name": "王老菊未来科技演播室", - "status": true, - "listening": true, - "recoding": false - } - } - ``` +## `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 /lives/{id}/stop` Stop listen and record live by id - - Request: - ```text - method: GET - path: http://token:114514@127.0.0.1:8080/lives/8cfc58ff74b31970899c0fe69345c222/stop - ``` - - Response: - ```json - { - "err_no": 0, - "err_msg": "", - "data": { - "id": "8cfc58ff74b31970899c0fe69345c222", - "live_url": "https://www.panda.tv/10300", - "platform_cn_name": "熊猫", - "host_name": "司机王老菊", - "room_name": "王老菊未来科技演播室", - "status": true, - "listening": false, - "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 /config` Get config info - - Request: - ```text - method: GET - path: http://token:114514@127.0.0.1:8080/config - ``` - - Response: - ```json - { - "err_no": 0, - "err_msg": "", - "data": { - "RPC": { - "Enable": true, - "Port": "127.0.0.1:8080", - "Token": "", - "TLS": { - "Enable": false, - "CertFile": "", - "KeyFile": "" - } - }, - "Debug": true, - "Interval": 15, - "OutPutPath": "/Users/chigusa/Movies", - "LiveRooms": [ - "https://www.panda.tv/10300", - "https://live.bilibili.com/1010" - ] - } - } - ``` +## `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 /config` Save lives info to config file - - Request: - ```text - method: PUT - path: http://token:114514@127.0.0.1:8080/config - ``` - - Response: - ```json - { - "err_no": 0, - "err_msg": "", - "data": "OK" - } - ``` - -* `GET /files/` A basic file server for out put path - - Request: - ```text - method: GET - path: http://token:114514@127.0.0.1:8080/files - ``` - - Response: - ```html -
- [2018-05-12 21-47-52][真·凤舞九天][尬聊].flv - [2018-05-12 21-54-27][真·凤舞九天][尬聊].flv - [2018-05-12 21-56-22][真·凤舞九天][尬聊].flv - [2018-05-12 22-19-15][真·凤舞九天][尬聊].flv -- ``` \ No newline at end of file +## `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 + ``` diff --git a/docs/screenshot.png b/docs/screenshot.png index 98edfa1c..298cc9ff 100644 Binary files a/docs/screenshot.png and b/docs/screenshot.png differ