tiktok-live-api 1.3.1 ā 1.4.1
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/LICENSE +21 -21
- package/README.md +38 -21
- package/package.json +84 -84
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2024 TikTool
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 TikTool
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
[](https://www.npmjs.com/package/tiktok-live-api)
|
|
13
13
|
[](https://www.typescriptlang.org/)
|
|
14
14
|
[](https://github.com/tiktool/tiktok-live-api/blob/main/LICENSE)
|
|
15
|
-
[](https://discord.gg/y8TwuFBAmD)
|
|
16
15
|
|
|
17
16
|
<p align="center">
|
|
18
17
|
<img src="https://raw.githubusercontent.com/tiktool/tiktok-live-api/main/tiktok-live-api.gif" alt="TikTok Live API Demo ā real-time chat, gifts, and viewer events" width="700">
|
|
@@ -67,14 +66,14 @@ That's it. **No complex setup, no protobuf, no reverse engineering, no breakages
|
|
|
67
66
|
|
|
68
67
|
---
|
|
69
68
|
|
|
70
|
-
## š Try It Now ā
|
|
69
|
+
## š Try It Now ā Live Demo
|
|
71
70
|
|
|
72
|
-
Copy-paste this into a file and run it. Connects to a live TikTok stream
|
|
71
|
+
Copy-paste this into a file and run it. Connects to a live TikTok stream and prints every event in real time. Works on the free Community tier ā no time limit, runs as long as the stream is live.
|
|
73
72
|
|
|
74
73
|
**Save as `demo.mjs` and run with `node demo.mjs`:**
|
|
75
74
|
|
|
76
75
|
```javascript
|
|
77
|
-
// demo.mjs ā TikTok LIVE in
|
|
76
|
+
// demo.mjs ā TikTok LIVE in real time
|
|
78
77
|
// npm install tiktok-live-api
|
|
79
78
|
import { TikTokLive } from 'tiktok-live-api';
|
|
80
79
|
|
|
@@ -91,11 +90,11 @@ client.on('member', e => { events++; console.log(`š ${e.user.uniqueId} j
|
|
|
91
90
|
client.on('follow', e => { events++; console.log(`ā ${e.user.uniqueId} followed`); });
|
|
92
91
|
client.on('roomUserSeq', e => { events++; console.log(`š Viewers: ${e.viewerCount}`); });
|
|
93
92
|
|
|
94
|
-
client.on('connected', () => console.log(`\nā
Connected to @${LIVE_USERNAME} ā
|
|
95
|
-
client.on('disconnected', () => console.log(`\nš
|
|
93
|
+
client.on('connected', () => console.log(`\nā
Connected to @${LIVE_USERNAME} ā streaming events...\n`));
|
|
94
|
+
client.on('disconnected', () => console.log(`\nš Disconnected. Received ${events} events.\n`));
|
|
96
95
|
|
|
97
96
|
client.connect();
|
|
98
|
-
|
|
97
|
+
// Press Ctrl+C to stop. Community tier has no per-connection time limit.
|
|
99
98
|
```
|
|
100
99
|
|
|
101
100
|
<details>
|
|
@@ -112,7 +111,7 @@ const LIVE_USERNAME = 'tv_asahi_news';
|
|
|
112
111
|
const ws = new WebSocket(`wss://api.tik.tools?uniqueId=${LIVE_USERNAME}&apiKey=${API_KEY}`);
|
|
113
112
|
let events = 0;
|
|
114
113
|
|
|
115
|
-
ws.on('open', () => console.log(`\nā
Connected to @${LIVE_USERNAME} ā
|
|
114
|
+
ws.on('open', () => console.log(`\nā
Connected to @${LIVE_USERNAME} ā streaming events...\n`));
|
|
116
115
|
ws.on('message', (raw) => {
|
|
117
116
|
const msg = JSON.parse(raw);
|
|
118
117
|
events++;
|
|
@@ -128,9 +127,8 @@ ws.on('message', (raw) => {
|
|
|
128
127
|
default: console.log(`š¦ ${msg.event}`); break;
|
|
129
128
|
}
|
|
130
129
|
});
|
|
131
|
-
ws.on('close', () => console.log(`\nš
|
|
132
|
-
|
|
133
|
-
setTimeout(() => ws.close(), 300_000);
|
|
130
|
+
ws.on('close', () => console.log(`\nš Disconnected. Received ${events} events.\n`));
|
|
131
|
+
// Press Ctrl+C to stop. Community tier has no per-connection time limit.
|
|
134
132
|
```
|
|
135
133
|
|
|
136
134
|
</details>
|
|
@@ -153,7 +151,7 @@ client.connect();
|
|
|
153
151
|
2. Sign up (no credit card required)
|
|
154
152
|
3. Copy your API key
|
|
155
153
|
|
|
156
|
-
The free
|
|
154
|
+
The free **Community** tier gives you 2,500 requests/day and 15 WebSocket connections with no per-connection time limit. Forever free.
|
|
157
155
|
|
|
158
156
|
## Environment Variable
|
|
159
157
|
|
|
@@ -373,24 +371,43 @@ client.on('gift', (event: GiftEvent) => {
|
|
|
373
371
|
| **Maintenance** | ā Zero ā we handle it | ā You fix breakages | ā You fix breakages |
|
|
374
372
|
| **CAPTCHA Solving** | ā Built-in (Pro+) | ā | ā |
|
|
375
373
|
| **Feed Discovery** | ā See who's live | ā | ā |
|
|
376
|
-
| **Free Tier** | ā
|
|
374
|
+
| **Free Tier** | ā 2,500 req/day, 15 WS, no time limit | ā Free (unreliable) | ā Free (unreliable) |
|
|
377
375
|
| **ESM + CJS** | ā Both supported | ā | N/A |
|
|
378
376
|
|
|
379
377
|
## Pricing
|
|
380
378
|
|
|
381
379
|
| Tier | Requests/Day | WebSocket Connections | Price |
|
|
382
380
|
|------|-------------|----------------------|-------|
|
|
383
|
-
|
|
|
384
|
-
|
|
|
385
|
-
|
|
|
386
|
-
|
|
|
381
|
+
| Community | 2,500 | 15 (no time limit) | Free forever |
|
|
382
|
+
| Pro | 75,000 | 50 (8h) | from $59/mo +tax |
|
|
383
|
+
| Ultra | 300,000 | 250 (8h) | from $219/mo +tax |
|
|
384
|
+
| **Global Agency** | 300,000 | 500 (8h) + Firehose | $549/mo +tax |
|
|
387
385
|
|
|
388
386
|
Full plan details at [tik.tools/pricing](https://tik.tools/pricing). Highlights:
|
|
389
387
|
|
|
390
|
-
- **
|
|
391
|
-
- **
|
|
392
|
-
- **
|
|
393
|
-
- **
|
|
388
|
+
- **Community** ($0 forever): 2,500 req/day Ā· 15 WS Ā· no time limit Ā· masked leaderboards. Designed for devs building apps ā upgrade when you need real usernames. No datacenter proxies; calls must come from your own IP.
|
|
389
|
+
- **Pro** (monthly): 75K req/day Ā· 50 WS Ā· unmasked leaderboards Ā· CAPTCHA Solver Ā· Feed Discovery Ā· 5 AI caption streams Ā· priority routing Ā· chat support
|
|
390
|
+
- **Ultra** (monthly): 300K req/day Ā· 250 WS Ā· 20 AI caption streams Ā· **League Rankings API** unmasked Ā· 99.5% uptime SLA Ā· priority chat support
|
|
391
|
+
- **Global Agency** ($549/mo): Everything in Ultra + **Live Gifter Firehose WS** (region/league/global filters, min-diamond threshold) + VIP Telegram alerts + VIP Web Vault (unmasked historical visual access)
|
|
392
|
+
|
|
393
|
+
### Live Gifter Firehose ā Global Agency
|
|
394
|
+
|
|
395
|
+
Real-time gift event stream from our Dragonfly fan-out. Filter by region, league, or globally; cap by minimum diamond threshold. Mid-stream filter updates supported via `update_filter` frame, no reconnect needed.
|
|
396
|
+
|
|
397
|
+
```js
|
|
398
|
+
const ws = new WebSocket(
|
|
399
|
+
`wss://api.tik.tools/firehose/gifters?apiKey=${KEY}&mode=region®ion=US%2B&min_diamonds=1000`
|
|
400
|
+
)
|
|
401
|
+
ws.on('message', (raw) => {
|
|
402
|
+
const evt = JSON.parse(raw)
|
|
403
|
+
// evt: { type:'gifter_alert', ts, gifter:{username,displayName,isAnonymous},
|
|
404
|
+
// creator:{uniqueId}, gift:{name,totalDiamonds}, region }
|
|
405
|
+
})
|
|
406
|
+
// Update filter without reconnect
|
|
407
|
+
ws.send(JSON.stringify({ type: 'update_filter', mode: 'global', min_diamonds: 5000 }))
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
Modes: `global` (all regions), `region` (single region code), `league` (region + league class, e.g. `B2`).
|
|
394
411
|
|
|
395
412
|
## Also Available
|
|
396
413
|
|
package/package.json
CHANGED
|
@@ -1,84 +1,84 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "tiktok-live-api",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "Unofficial TikTok LIVE API Client ā Real-time chat, gifts, viewers, battles, and AI live captions from any TikTok livestream. Managed WebSocket API with 99.9% uptime.",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"module": "dist/index.mjs",
|
|
7
|
-
"types": "dist/index.d.ts",
|
|
8
|
-
"exports": {
|
|
9
|
-
".": {
|
|
10
|
-
"types": "./dist/index.d.ts",
|
|
11
|
-
"import": "./dist/index.mjs",
|
|
12
|
-
"require": "./dist/index.js"
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
"files": [
|
|
16
|
-
"dist",
|
|
17
|
-
"README.md",
|
|
18
|
-
"LICENSE"
|
|
19
|
-
],
|
|
20
|
-
"scripts": {
|
|
21
|
-
"build": "tsup src/index.ts --format cjs,esm --dts --clean",
|
|
22
|
-
"prepublishOnly": "npm run build"
|
|
23
|
-
},
|
|
24
|
-
"keywords": [
|
|
25
|
-
"tiktok",
|
|
26
|
-
"tiktok-live",
|
|
27
|
-
"tiktok-api",
|
|
28
|
-
"tiktok-live-api",
|
|
29
|
-
"tiktok-live-connector",
|
|
30
|
-
"tiktok-live-sdk",
|
|
31
|
-
"tiktok-websocket",
|
|
32
|
-
"tiktok-chat",
|
|
33
|
-
"tiktok-gifts",
|
|
34
|
-
"tiktok-bot",
|
|
35
|
-
"tiktok-data",
|
|
36
|
-
"tiktok-stream",
|
|
37
|
-
"tiktok-events",
|
|
38
|
-
"tiktok-viewer",
|
|
39
|
-
"live-streaming",
|
|
40
|
-
"live-chat",
|
|
41
|
-
"webcast",
|
|
42
|
-
"websocket",
|
|
43
|
-
"real-time",
|
|
44
|
-
"speech-to-text",
|
|
45
|
-
"captions",
|
|
46
|
-
"transcription",
|
|
47
|
-
"translation",
|
|
48
|
-
"tiktok-live-python",
|
|
49
|
-
"tiktok-tools",
|
|
50
|
-
"euler-stream",
|
|
51
|
-
"tiktoklive",
|
|
52
|
-
"tiktok-connector",
|
|
53
|
-
"tiktok-live-node",
|
|
54
|
-
"tiktok-live-js",
|
|
55
|
-
"tiktok-scraper",
|
|
56
|
-
"tiktok-monitoring",
|
|
57
|
-
"livestream-api"
|
|
58
|
-
],
|
|
59
|
-
"author": {
|
|
60
|
-
"name": "TikTool",
|
|
61
|
-
"email": "support@tik.tools",
|
|
62
|
-
"url": "https://tik.tools"
|
|
63
|
-
},
|
|
64
|
-
"license": "MIT",
|
|
65
|
-
"repository": {
|
|
66
|
-
"type": "git",
|
|
67
|
-
"url": "https://github.com/tiktool/tiktok-live-api"
|
|
68
|
-
},
|
|
69
|
-
"bugs": {
|
|
70
|
-
"url": "https://github.com/tiktool/tiktok-live-api/issues"
|
|
71
|
-
},
|
|
72
|
-
"homepage": "https://tik.tools",
|
|
73
|
-
"dependencies": {
|
|
74
|
-
"ws": "^8.16.0"
|
|
75
|
-
},
|
|
76
|
-
"devDependencies": {
|
|
77
|
-
"@types/ws": "^8.5.10",
|
|
78
|
-
"tsup": "^8.0.0",
|
|
79
|
-
"typescript": "^5.3.0"
|
|
80
|
-
},
|
|
81
|
-
"engines": {
|
|
82
|
-
"node": ">=16.0.0"
|
|
83
|
-
}
|
|
84
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "tiktok-live-api",
|
|
3
|
+
"version": "1.4.1",
|
|
4
|
+
"description": "Unofficial TikTok LIVE API Client ā Real-time chat, gifts, viewers, battles, and AI live captions from any TikTok livestream. Managed WebSocket API with 99.9% uptime.",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.mjs",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.mjs",
|
|
12
|
+
"require": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist",
|
|
17
|
+
"README.md",
|
|
18
|
+
"LICENSE"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "tsup src/index.ts --format cjs,esm --dts --clean",
|
|
22
|
+
"prepublishOnly": "npm run build"
|
|
23
|
+
},
|
|
24
|
+
"keywords": [
|
|
25
|
+
"tiktok",
|
|
26
|
+
"tiktok-live",
|
|
27
|
+
"tiktok-api",
|
|
28
|
+
"tiktok-live-api",
|
|
29
|
+
"tiktok-live-connector",
|
|
30
|
+
"tiktok-live-sdk",
|
|
31
|
+
"tiktok-websocket",
|
|
32
|
+
"tiktok-chat",
|
|
33
|
+
"tiktok-gifts",
|
|
34
|
+
"tiktok-bot",
|
|
35
|
+
"tiktok-data",
|
|
36
|
+
"tiktok-stream",
|
|
37
|
+
"tiktok-events",
|
|
38
|
+
"tiktok-viewer",
|
|
39
|
+
"live-streaming",
|
|
40
|
+
"live-chat",
|
|
41
|
+
"webcast",
|
|
42
|
+
"websocket",
|
|
43
|
+
"real-time",
|
|
44
|
+
"speech-to-text",
|
|
45
|
+
"captions",
|
|
46
|
+
"transcription",
|
|
47
|
+
"translation",
|
|
48
|
+
"tiktok-live-python",
|
|
49
|
+
"tiktok-tools",
|
|
50
|
+
"euler-stream",
|
|
51
|
+
"tiktoklive",
|
|
52
|
+
"tiktok-connector",
|
|
53
|
+
"tiktok-live-node",
|
|
54
|
+
"tiktok-live-js",
|
|
55
|
+
"tiktok-scraper",
|
|
56
|
+
"tiktok-monitoring",
|
|
57
|
+
"livestream-api"
|
|
58
|
+
],
|
|
59
|
+
"author": {
|
|
60
|
+
"name": "TikTool",
|
|
61
|
+
"email": "support@tik.tools",
|
|
62
|
+
"url": "https://tik.tools"
|
|
63
|
+
},
|
|
64
|
+
"license": "MIT",
|
|
65
|
+
"repository": {
|
|
66
|
+
"type": "git",
|
|
67
|
+
"url": "https://github.com/tiktool/tiktok-live-api"
|
|
68
|
+
},
|
|
69
|
+
"bugs": {
|
|
70
|
+
"url": "https://github.com/tiktool/tiktok-live-api/issues"
|
|
71
|
+
},
|
|
72
|
+
"homepage": "https://tik.tools",
|
|
73
|
+
"dependencies": {
|
|
74
|
+
"ws": "^8.16.0"
|
|
75
|
+
},
|
|
76
|
+
"devDependencies": {
|
|
77
|
+
"@types/ws": "^8.5.10",
|
|
78
|
+
"tsup": "^8.0.0",
|
|
79
|
+
"typescript": "^5.3.0"
|
|
80
|
+
},
|
|
81
|
+
"engines": {
|
|
82
|
+
"node": ">=16.0.0"
|
|
83
|
+
}
|
|
84
|
+
}
|