@zfadhli/tokrec-cli 0.15.1 → 0.15.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +91 -0
- package/dist/package.mjs +1 -1
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# @zfadhli/tokrec-cli
|
|
2
|
+
|
|
3
|
+
`tokrec` — records a TikTok live stream to MP4 from the terminal. Polls until the
|
|
4
|
+
user goes live, downloads the stream (FLV or HLS), and remuxes it with FFmpeg.
|
|
5
|
+
|
|
6
|
+
[](https://www.npmjs.com/package/@zfadhli/tokrec-cli)
|
|
7
|
+
[](https://github.com/zfadhli/tokrec/actions/workflows/ci.yml)
|
|
8
|
+
[](https://github.com/zfadhli/tokrec/blob/main/LICENSE)
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
bun add -g @zfadhli/tokrec-cli # then: tokrec -u <user>
|
|
14
|
+
bunx @zfadhli/tokrec-cli -u <user>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Requirements: **Bun ≥ 1.2** (the published entry point runs on Bun), **FFmpeg**
|
|
18
|
+
on `PATH`, and **tmux** only for background recording.
|
|
19
|
+
|
|
20
|
+
## Quick start
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# Record a live stream (Ctrl+C to stop)
|
|
24
|
+
tokrec -u somebody
|
|
25
|
+
|
|
26
|
+
# Record for 10 minutes, split into 5-minute segments
|
|
27
|
+
tokrec -u somebody -d 10 -s 5
|
|
28
|
+
|
|
29
|
+
# Custom output directory and proxy
|
|
30
|
+
tokrec -u somebody -o ./videos -p http://127.0.0.1:8080
|
|
31
|
+
|
|
32
|
+
# Normalize loudness (EBU R128)
|
|
33
|
+
tokrec -u somebody --normalize
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Output lands in the current directory (or `-o <dir>`) as
|
|
37
|
+
`<user>=YYYYMMDD_HHMMSS.mp4`; segments are `<name>_partN.mp4`. Ctrl+C stops
|
|
38
|
+
cleanly: the download aborts, the partial file is still converted to MP4.
|
|
39
|
+
|
|
40
|
+
## Commands
|
|
41
|
+
|
|
42
|
+
| Command | Purpose |
|
|
43
|
+
| --- | --- |
|
|
44
|
+
| `tokrec -u <user>` | Record in the foreground |
|
|
45
|
+
| `tokrec start -u <user>` | Record inside a tmux session; survives terminal close |
|
|
46
|
+
| `tokrec stop [-u <user>]` | Stop one background session, or all of them |
|
|
47
|
+
| `tokrec status [-u <user>]` | List running background sessions |
|
|
48
|
+
| `tokrec setup` | Check cookie status, or create `cookies.json` interactively |
|
|
49
|
+
|
|
50
|
+
Background sessions are named `tokrec-<user>`; reattach with
|
|
51
|
+
`tmux attach -t tokrec-<user>` and detach with `Ctrl+B`, `D`.
|
|
52
|
+
|
|
53
|
+
## Options
|
|
54
|
+
|
|
55
|
+
`-u, --user <name>` is required for recording; it can also be passed as the
|
|
56
|
+
first argument.
|
|
57
|
+
|
|
58
|
+
| Flag | Default | Meaning |
|
|
59
|
+
| --- | --- | --- |
|
|
60
|
+
| `-o, --output <dir>` | `.` | Output directory |
|
|
61
|
+
| `-i, --interval <minutes>` | `3` | Polling interval |
|
|
62
|
+
| `-d, --duration <minutes>` | unlimited | Max recording duration |
|
|
63
|
+
| `-s, --segment-minutes <minutes>` | off | Split the recording into segments of this length |
|
|
64
|
+
| `-p, --proxy <url>` | — | HTTP proxy, e.g. `http://127.0.0.1:8080` |
|
|
65
|
+
| `-l, --log-level <level>` | `info` | `debug`, `info`, `warn`, `error` |
|
|
66
|
+
| `-c, --cookies <path>` | `./cookies.json` | Path to a cookies file |
|
|
67
|
+
| `--normalize` | off | Normalize audio loudness (EBU R128) |
|
|
68
|
+
| `--normalize-loudness <num>` | `-14` | Target loudness in LUFS |
|
|
69
|
+
| `--normalize-codec <name>` | `libopus` | Audio codec for normalized output |
|
|
70
|
+
| `--normalize-bitrate <str>` | `96k` | Audio bitrate for normalized output |
|
|
71
|
+
| `--rate <n>` | `5` | Max API requests per second; `0` disables the limiter |
|
|
72
|
+
| `--debug` | off | API debug logging on stderr |
|
|
73
|
+
|
|
74
|
+
`-d` and `-s` take **minutes**. Both are rejected if they are not numbers ≥ 0.
|
|
75
|
+
|
|
76
|
+
## Authentication
|
|
77
|
+
|
|
78
|
+
TikTok only serves some streams to logged-in sessions.
|
|
79
|
+
|
|
80
|
+
- **Firefox (automatic)** — `tokrec` reads `sessionid_ss` and the Slardar WAF
|
|
81
|
+
cookie from Firefox's cookie store when it exists. No configuration needed.
|
|
82
|
+
- **`cookies.json`** — pass `-c path/to/cookies.json`. The file must contain at
|
|
83
|
+
least `sessionid_ss`; other TikTok cookies may be included.
|
|
84
|
+
|
|
85
|
+
Age-restricted lives need an account that is allowed to view them.
|
|
86
|
+
|
|
87
|
+
## Links
|
|
88
|
+
|
|
89
|
+
- [Library package](https://www.npmjs.com/package/@zfadhli/tokrec) — same engine, embeddable
|
|
90
|
+
- [Repository](https://github.com/zfadhli/tokrec) · [Changelog](https://github.com/zfadhli/tokrec/blob/main/CHANGELOG.md)
|
|
91
|
+
- [MIT License](https://github.com/zfadhli/tokrec/blob/main/LICENSE)
|
package/dist/package.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zfadhli/tokrec-cli",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.2",
|
|
4
4
|
"description": "TikTok live stream recorder CLI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"typecheck": "tsc --noEmit"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@zfadhli/tokrec": "^0.15.
|
|
17
|
+
"@zfadhli/tokrec": "^0.15.2",
|
|
18
18
|
"cac": "^7.0.0",
|
|
19
19
|
"execa": "^9.6.1",
|
|
20
20
|
"yocto-spinner": "^1.2.2",
|