Olive is a powerful engine which monitors streamers status and automatically records when they're online. Helps you catch every live stream.
- Small
- Easy-to-use
- Efficient
- Extensible
- Customizable
- Cross-platform
-
build from source
go install github.com/go-olive/olive/src/cmd/olive@latest
-
download from releases
Get olive to work simply by passing the live url.
$ olive -u https://www.huya.com/518512
Start olive by using config file, provide you more options.
template file to reference config.toml
$ olive -f /path/to/config.toml
[[Shows]]
# platform name
Platform = "bilibili"
# room id
RoomID = "21852"
# streamer name
StreamerName = "old-tomato"
Add config OutTmpl
-
Date:
{{ now | date \"2006-01-02 15-04-05\"}}
-
Streame Name:
{{ .StreamerName }}
-
Stream Title:
{{ .RoomName }}
[[Shows]]
Platform = "bilibili"
RoomID = "21852"
StreamerName = "old-tomato"
# The file name will be `[2022-04-24 02-02-32][old-tomato][Hi!]`
OutTmpl = "[{{ now | date \"2006-01-02 15-04-05\"}}][{{ .StreamerName }}][{{ .RoomName }}]"
Add config SaveDir
[[Shows]]
Platform = "bilibili"
RoomID = "21852"
StreamerName = "old-tomato"
SaveDir = "/Users/luxcgo/Videos"
Add config Parser
[[Shows]]
Platform = "bilibili"
RoomID = "21852"
StreamerName = "old-tomato"
# Use `ffmpeg` as video downloader
Parser = "ffmpeg"
reference table
Parser | Type | Platform |
---|---|---|
streamlink | third-party | YouTube/Twitch |
yt-dlp | third-party | YouTube |
ffmpeg | third-party | Other than YouTube/Twitch |
Flv | Native | Other than YouTube/Twitch |
You have to manually download the third-party
Parser
locally in order to use them.The deault
Parser
useflv
which has already beed embedded into the olive , no need to download.
Add config Shows.PostCmds
, you can add a series of commands under any [[Shows]]
.
The commands will be executed automatically when the live ends , and if any command fails to execute in the middle, it will exit early.
olive provides several out-of-box commands that have been implemented internally. (set config Path
under [[Shows.PostCmds]]
)
olivearchive
: Move the file to the archive folder under the current directory.olivetrash
: Delete the file (unrecoverable).olivebiliup
: IfUploadConfig
is configured, it will automatically upload tobilibili
according to the configuration, if the upload fails it will executeolivearchive
.- this requires to install biliup-rs locally, and set
ExecPath
as the excutable filepath.
- this requires to install biliup-rs locally, and set
oliveshell
: split normal shell commands as an array of strings, and put them in configArgs
.- embed video file path as env variable. Can be used by
$FILE_PATH
- embed video file path as env variable. Can be used by
Config example:
[UploadConfig]
Enable = true
ExecPath = "/xxx/biliup"
Filepath = ""
[[Shows]]
Platform = "bilibili"
RoomID = "21852"
StreamerName = "test"
OutTmpl = "[test][{{ now | date \"2006-01-02 15-04-05\"}}].flv"
[[Shows.PostCmds]]
Path = "oliveshell"
Args = ["/bin/sh", "-c", "echo $FILE_PATH"]
[[Shows.PostCmds]]
Path = "olivebiliup"
[[Shows.PostCmds]]
Path = "olivetrash"
Simulation:
- Live ends.
- Execute the custom command
/bin/sh -c "echo $FILE_PATH"
. - If the last command is executed successfully, execute the built-in command
olivebiliup
. - If the last command is executed successfully, execute the built-in command
olivetrash
.
When any of the following condition is met, olive will start a new file.
- maximum video duration:
Duration
- 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".
- Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
- maximum video filesize (byte):
Filesize
[[Shows]]
Platform = "huya"
RoomID = "518512"
StreamerName = "250"
[Shows.SplitRule]
# 10 MB
FileSize = 10000000
# 1 minute
Duration = "1m"
[[Shows.PostCmds]]
Path = "oliveshell"
Args = ["/bin/sh", "-c", "echo $FILE_PATH"]
Platform |
---|
bilibili |
douyin |
huya |
kuaishou |
tiktok |
twitch |
youtube |
olive relies on olivetv to support above sites. If yours is not on the list above, welcome to submit an issue or a pr at olivetv.
A config file with every feature involved.
LogLevel = 5
SnapRestSeconds = 15
SplitRestSeconds = 60
CommanderPoolSize = 1
[UploadConfig]
Enable = true
ExecPath = "biliup"
Filepath = ""
[PlatformConfig]
DouyinCookie = "__ac_nonce=06245c89100e7ab2dd536; __ac_signature=_02B4Z6wo00f01LjBMSAAAIDBwA.aJ.c4z1C44TWAAEx696;"
KuaishouCookie = "did=web_d86297aa2f579589b8abc2594b0ea985"
[[Shows]]
Platform = "huya"
RoomID = "518512"
StreamerName = "250"
[[Shows]]
Platform = "bilibili"
RoomID = "21852"
StreamerName = "old-tomato"
SaveDir = "/Users/luxcgo/Videos"
Parser = "flv"
OutTmpl = "[{{ now | date \"2006-01-02 15-04-05\"}}][{{ .StreamerName }}]"
[Shows.SplitRule]
# 1 GB
FileSize = 1024000000
# 1 hour
Duration = "1h"
[[Shows.PostCmds]]
Path = "oliveshell"
Args = ["/bin/sh", "-c", "echo $FILE_PATH"]
[[Shows.PostCmds]]
Path = "olivebiliup"
[[Shows.PostCmds]]
Path = "olivetrash"
- Add docker image
- Add mock test
- Add web ui
- Add prometheus and grafana
This project is under the MIT License. See the LICENSE file for the full license text.