|
1 | | -# olive |
| 1 | +<p align="center"> |
| 2 | + <img src="https://raw.githubusercontent.com/go-olive/brand-kit/main/banner/banner-01.png" /> |
| 3 | +</p> |
2 | 4 |
|
3 | 5 | [](https://pkg.go.dev/github.com/go-olive/olive?tab=doc) |
4 | 6 | [](https://github.com/go-olive/olive/actions/workflows/release.yml) |
5 | 7 | [](https://sourcegraph.com/github.com/go-olive/olive) |
| 8 | +[](https://github.com/go-olive/olive/releases) |
6 | 9 |
|
7 | | -## Intro |
| 10 | +Olive is a powerful engine which monitors streamers status and automatically records when they're online. Helps you catch every live stream. |
8 | 11 |
|
9 | | -Lives are delicate and fleeting creatures, waiting to be captured by us. ❤ |
| 12 | +## Feature |
10 | 13 |
|
11 | | -> 全自动录播、投稿工具 |
12 | | -> |
13 | | -> 支持抖音直播、快手直播、虎牙直播、B站直播、油管直播、twitch直播、tiktok直播 |
14 | | -> |
15 | | -> 支持B站投稿 |
| 14 | +* Small |
| 15 | +* Easy-to-use |
| 16 | +* Efficient |
| 17 | +* Extensible |
| 18 | +* Customizable |
| 19 | +* Cross-platform |
16 | 20 |
|
17 | | -## Feature |
| 21 | +## Installation |
18 | 22 |
|
19 | | -* 小巧 |
20 | | -* 易用 |
21 | | -* 高效 |
22 | | -* 定制化 |
23 | | -* go 原生 |
24 | | -* 跨平台 |
| 23 | +* build from source |
25 | 24 |
|
26 | | -## Usage |
| 25 | + `go install github.com/go-olive/olive/src/cmd/olive@latest` |
27 | 26 |
|
28 | | -1. 安装 **[streamlink](https://streamlink.github.io/)**(若不录制 YouTube、twitch 直播无需安装) |
29 | | -2. 安装 **[biliup-rs](https://github.com/ForgQi/biliup-rs)**(若不上传至哔哩哔哩无需安装) |
30 | | -3. 安装 [**olive**](https://github.com/go-olive/olive) |
31 | | - * 可直接在 [**releases**](https://github.com/go-olive/olive/releases) 中下载相应平台的执行文件 |
32 | | - * 或者本地构建`go install github.com/go-olive/olive/src/cmd/olive@latest` |
33 | | -4. 命令行中运行 |
34 | | - * 直接下载可执行文件`/path/to/olive -c /path/to/config.toml` |
35 | | - * 本地构建`olive -c /path/to/config.toml` |
| 27 | +* download from [**releases**](https://github.com/go-olive/olive/releases) |
36 | 28 |
|
37 | | -## Config.toml |
| 29 | +## Quickstart |
| 30 | + |
| 31 | +Get **olive** to work simply by passing the live url. |
| 32 | + |
| 33 | +```sh |
| 34 | +$ olive -u https://www.huya.com/518512 |
| 35 | +``` |
| 36 | + |
| 37 | +## Usage |
| 38 | + |
| 39 | +Start **olive** by using config file, provide you more options. |
38 | 40 |
|
39 | 41 | template file to reference [config.toml](src/tmpl/config.toml) |
40 | 42 |
|
| 43 | +```sh |
| 44 | +$ olive -f /path/to/config.toml |
| 45 | +``` |
| 46 | + |
| 47 | +### Minimal configuration |
| 48 | + |
| 49 | +```toml |
| 50 | +[[Shows]] |
| 51 | +# platform name |
| 52 | +Platform = "bilibili" |
| 53 | +# room id |
| 54 | +RoomID = "21852" |
| 55 | +# streamer name |
| 56 | +StreamerName = "old-tomato" |
| 57 | +``` |
| 58 | + |
| 59 | +### Custom video file name |
| 60 | + |
| 61 | +Add config `OutTmpl` |
| 62 | + |
| 63 | +* Date: `{{ now | date \"2006-01-02 15-04-05\"}}` |
| 64 | + |
| 65 | +* Streame Name: `{{ .StreamerName }}` |
| 66 | + |
| 67 | +* Stream Title: `{{ .RoomName }}` |
| 68 | + |
| 69 | +```toml |
| 70 | +[[Shows]] |
| 71 | +Platform = "bilibili" |
| 72 | +RoomID = "21852" |
| 73 | +StreamerName = "old-tomato" |
| 74 | +# The file name will be `[2022-04-24 02-02-32][old-tomato][Hi!]` |
| 75 | +OutTmpl = "[{{ now | date \"2006-01-02 15-04-05\"}}][{{ .StreamerName }}][{{ .RoomName }}]" |
| 76 | +``` |
| 77 | + |
| 78 | +### Custom video save location |
| 79 | + |
| 80 | +Add config `SaveDir` |
| 81 | + |
| 82 | +```toml |
| 83 | +[[Shows]] |
| 84 | +Platform = "bilibili" |
| 85 | +RoomID = "21852" |
| 86 | +StreamerName = "old-tomato" |
| 87 | +SaveDir = "/Users/luxcgo/Videos" |
| 88 | +``` |
| 89 | + |
| 90 | +### Custom video downloader |
| 91 | + |
| 92 | +Add config `Parser` |
| 93 | + |
| 94 | +```toml |
| 95 | +[[Shows]] |
| 96 | +Platform = "bilibili" |
| 97 | +RoomID = "21852" |
| 98 | +StreamerName = "old-tomato" |
| 99 | +# Use `ffmpeg` as video downloader |
| 100 | +Parser = "ffmpeg" |
| 101 | +``` |
| 102 | + |
| 103 | +reference table |
| 104 | + |
| 105 | +| Parser | Type | Platform | |
| 106 | +| ---------- | ----------- | ------------------------- | |
| 107 | +| streamlink | third-party | YouTube/Twitch | |
| 108 | +| yt-dlp | third-party | YouTube | |
| 109 | +| ffmpeg | third-party | Other than YouTube/Twitch | |
| 110 | +| Flv | Native | Other than YouTube/Twitch | |
| 111 | + |
| 112 | +> You have to manually download the third-party `Parser` locally in order to use them. |
| 113 | +> |
| 114 | +> The deault `Parser` use `flv` which has already beed embedded into the olive , no need to download. |
| 115 | +
|
| 116 | +### Exec cmds after recording |
| 117 | + |
| 118 | +Add config `Shows.PostCmds`, you can add a series of commands under any `[[Shows]]`. |
| 119 | + |
| 120 | +The commands will be executed automatically when the live ends , and if any command fails to execute in the middle, it will exit early. |
| 121 | + |
| 122 | +**olive** provides several out-of-box commands that have been implemented internally. (set config `Path` under `[[Shows.PostCmds]]`) |
| 123 | + |
| 124 | +* `olivearchive`: Move the file to the archive folder under the current directory. |
| 125 | +* `olivetrash`: Delete the file (unrecoverable). |
| 126 | +* `olivebiliup`: If `UploadConfig` is configured, it will automatically upload to `bilibili` according to the configuration, if the upload fails it will execute `olivearchive`. |
| 127 | + * this requires to install [biliup-rs](https://github.com/ForgQi/biliup-rs) locally, and set `ExecPath` as the excutable filepath. |
| 128 | +* `oliveshell`: split normal shell commands as an array of strings, and put them in config `Args` . |
| 129 | + * embed video file path as env variable. Can be used by `$FILE_PATH` |
| 130 | + |
| 131 | +Config example: |
| 132 | + |
41 | 133 | ```toml |
42 | 134 | [UploadConfig] |
43 | | -# 是否上传到 bilibili |
44 | | -Enable = false |
45 | | -# biliup-rs 可执行文件的路径 |
46 | | -ExecPath = "biliup" |
47 | | -# biliup-rs 配置文件路径,为空的话走默认配置 |
| 135 | +Enable = true |
| 136 | +ExecPath = "/xxx/biliup" |
48 | 137 | Filepath = "" |
49 | 138 |
|
50 | | -[PlatformConfig] |
51 | | -# 若有录制抖音直播,可在无痕模式非登录状态下找下面的 cookie 填入即可 |
52 | | -DouyinCookie = "__ac_nonce=06245c89100e7ab2dd536; __ac_signature=_02B4Z6wo00f01LjBMSAAAIDBwA.aJ.c4z1C44TWAAEx696;" |
53 | | -# 若有录制快手直播,可在无痕模式非登录状态下找下面的 cookie 填入即可 |
54 | | -KuaishouCookie = "did=web_d86297aa2f579589b8abc2594b0ea985" |
55 | | - |
56 | 139 | [[Shows]] |
57 | | -# 平台名,目前支持: |
58 | | -# "bilibili" |
59 | | -# "douyin" |
60 | | -# "kuaishou" |
61 | | -# "huya" |
62 | | -# "youtube" |
63 | | -# "twitch" |
64 | | -# "tiktok" |
65 | 140 | Platform = "bilibili" |
66 | | -# 房间号,支持字符串类型的房间号 |
67 | 141 | RoomID = "21852" |
68 | | -# 主播名称 |
69 | | -StreamerName = "老番茄" |
70 | | -# 文件保存路径,默认为当前文件夹 |
71 | | -SaveDir = "" |
| 142 | +StreamerName = "test" |
| 143 | +OutTmpl = "[test][{{ now | date \"2006-01-02 15-04-05\"}}].flv" |
| 144 | +[[Shows.PostCmds]] |
| 145 | +Path = "oliveshell" |
| 146 | +Args = ["/bin/sh", "-c", "echo $FILE_PATH"] |
| 147 | +[[Shows.PostCmds]] |
| 148 | +Path = "olivebiliup" |
| 149 | +[[Shows.PostCmds]] |
| 150 | +Path = "olivetrash" |
72 | 151 | ``` |
73 | 152 |
|
74 | | -## Advanced |
| 153 | +Simulation: |
75 | 154 |
|
76 | | -* **自定义视频文件名称** |
| 155 | +1. Live ends. |
| 156 | +2. Execute the custom command `/bin/sh -c "echo $FILE_PATH" `. |
| 157 | +3. If the last command is executed successfully, execute the built-in command `olivebiliup `. |
| 158 | +4. If the last command is executed successfully, execute the built-in command `olivetrash `. |
77 | 159 |
|
78 | | - 增加 OutTmpl 配置项 |
| 160 | +### Split video files |
79 | 161 |
|
80 | | - `{{ now | date \"2006-01-02 15-04-05\"}}`代表日期 |
| 162 | +When any of the following condition is met, **olive** will start a new file. |
81 | 163 |
|
82 | | - `{{ .StreamerName }}`代表主播名称 |
| 164 | +* maximum video duration: `Duration` |
| 165 | + * A duration string is a possibly signed sequence of decimal numbers, each with optional fraction and a unit suffix, such as "300ms", "-1.5h" or "2h45m". |
| 166 | + * Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". |
| 167 | +* maximum video filesize (byte): `Filesize` |
83 | 168 |
|
84 | | - `{{ .RoomName }}`代表直播标题 |
| 169 | +```toml |
| 170 | +[[Shows]] |
| 171 | +Platform = "huya" |
| 172 | +RoomID = "518512" |
| 173 | +StreamerName = "250" |
| 174 | +[Shows.SplitRule] |
| 175 | +# 10 MB |
| 176 | +FileSize = 10000000 |
| 177 | +# 1 minute |
| 178 | +Duration = "1m" |
| 179 | +[[Shows.PostCmds]] |
| 180 | +Path = "oliveshell" |
| 181 | +Args = ["/bin/sh", "-c", "echo $FILE_PATH"] |
| 182 | +``` |
85 | 183 |
|
86 | | - ```toml |
87 | | - [[Shows]] |
88 | | - Platform = "bilibili" |
89 | | - RoomID = "21852" |
90 | | - StreamerName = "老番茄" |
91 | | - # 输出的效果是 [2022-04-24 02-02-32][老番茄][嗨嗨嗨!] |
92 | | - OutTmpl = "[{{ now | date \"2006-01-02 15-04-05\"}}][{{ .StreamerName }}][{{ .RoomName }}]" |
93 | | - ``` |
| 184 | +## Supported platforms |
94 | 185 |
|
95 | | -* **自定义视频下载器** |
| 186 | +| Platform | |
| 187 | +| -------- | |
| 188 | +| bilibili | |
| 189 | +| douyin | |
| 190 | +| huya | |
| 191 | +| kuaishou | |
| 192 | +| tiktok | |
| 193 | +| twitch | |
| 194 | +| youtube | |
96 | 195 |
|
97 | | - | 下载器 | 类型 | 支持平台 | |
98 | | - | ---------- | ------- | --------------------------------------------- | |
99 | | - | streamlink | 第三方 | 油管<br />twitch | |
100 | | - | yt-dlp | 第三方 | 油管 | |
101 | | - | flv | go 原生 | 抖音<br />tiktok<br />快手<br />虎牙<br />B站 | |
102 | | - | ffmpeg | 第三方 | 抖音<br />tiktok<br />快手<br />虎牙<br />B站 | |
| 196 | +**olive** relies on **[olivetv](https://github.com/go-olive/tv)** to support above sites. If yours is not on the list above, welcome to submit an issue or a pr at **[olivetv](https://github.com/go-olive/tv)**. |
103 | 197 |
|
104 | | - 油管、twitch 默认使用 streamlink |
105 | 198 |
|
106 | | - 其他平台默认使用 flv |
107 | | - |
108 | | - ```toml |
109 | | - [[Shows]] |
110 | | - Platform = "bilibili" |
111 | | - RoomID = "21852" |
112 | | - StreamerName = "老番茄" |
113 | | - # 指定下载器为 ffmpeg |
114 | | - Parser = "ffmpeg" |
115 | | - ``` |
| 199 | +## Config.toml |
116 | 200 |
|
117 | | -## RoadMap |
| 201 | +A config file with every feature involved. |
118 | 202 |
|
119 | | -* 支持 go 原生对 bilibili 的投稿 |
120 | | -* 支持上传至云盘 |
121 | | -* 支持更多的平台 |
122 | | -* 增加 docker image |
123 | | -* 增加 mock test |
124 | | -* 增加 YouTube 投稿 |
125 | | -* 增加对程序运行状况的监控 |
126 | | -* 增加网页端 |
| 203 | +```toml |
| 204 | +LogLevel = 5 |
| 205 | +SnapRestSeconds = 15 |
| 206 | +SplitRestSeconds = 60 |
| 207 | +CommanderPoolSize = 1 |
| 208 | + |
| 209 | +[UploadConfig] |
| 210 | +Enable = true |
| 211 | +ExecPath = "biliup" |
| 212 | +Filepath = "" |
| 213 | + |
| 214 | +[PlatformConfig] |
| 215 | +DouyinCookie = "__ac_nonce=06245c89100e7ab2dd536; __ac_signature=_02B4Z6wo00f01LjBMSAAAIDBwA.aJ.c4z1C44TWAAEx696;" |
| 216 | +KuaishouCookie = "did=web_d86297aa2f579589b8abc2594b0ea985" |
| 217 | + |
| 218 | +[[Shows]] |
| 219 | +Platform = "huya" |
| 220 | +RoomID = "518512" |
| 221 | +StreamerName = "250" |
| 222 | + |
| 223 | +[[Shows]] |
| 224 | +Platform = "bilibili" |
| 225 | +RoomID = "21852" |
| 226 | +StreamerName = "old-tomato" |
| 227 | +SaveDir = "/Users/luxcgo/Videos" |
| 228 | +Parser = "flv" |
| 229 | +OutTmpl = "[{{ now | date \"2006-01-02 15-04-05\"}}][{{ .StreamerName }}]" |
| 230 | +[Shows.SplitRule] |
| 231 | +# 1 GB |
| 232 | +FileSize = 1024000000 |
| 233 | +# 1 hour |
| 234 | +Duration = "1h" |
| 235 | +[[Shows.PostCmds]] |
| 236 | +Path = "oliveshell" |
| 237 | +Args = ["/bin/sh", "-c", "echo $FILE_PATH"] |
| 238 | +[[Shows.PostCmds]] |
| 239 | +Path = "olivebiliup" |
| 240 | +[[Shows.PostCmds]] |
| 241 | +Path = "olivetrash" |
| 242 | +``` |
| 243 | + |
| 244 | +## RoadMap |
127 | 245 |
|
128 | | -## Credits |
| 246 | +* Add docker image |
| 247 | +* Add mock test |
| 248 | +* Add web ui |
| 249 | +* Add prometheus and grafana |
129 | 250 |
|
130 | | -* [OliveTV](https://github.com/go-olive/tv) |
131 | | -* [bililive-go](https://github.com/hr3lxphr6j/bililive-go) |
132 | | -* [biliup-rs](https://github.com/ForgQi/biliup-rs) |
133 | | -* [streamlink](https://streamlink.github.io/) |
| 251 | +## License |
134 | 252 |
|
| 253 | +This project is under the MIT License. See the [LICENSE](https://github.com/go-olive/olive/blob/main/LICENSE) file for the full license text. |
0 commit comments