tiktok-live-api 1.0.1 → 1.1.0

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 CHANGED
@@ -6,6 +6,7 @@
6
6
  [![npm downloads](https://img.shields.io/npm/dm/tiktok-live-api)](https://www.npmjs.com/package/tiktok-live-api)
7
7
  [![TypeScript](https://img.shields.io/badge/TypeScript-Ready-blue)](https://www.typescriptlang.org/)
8
8
  [![License](https://img.shields.io/npm/l/tiktok-live-api)](https://github.com/tiktool/tiktok-live-api/blob/main/LICENSE)
9
+ [![Discord](https://img.shields.io/discord/1482387222912172159?logo=discord&label=Discord&color=5865F2)](https://discord.gg/y8TwuFBAmD)
9
10
 
10
11
  > This package is **not affiliated with or endorsed by TikTok**. It connects to the [TikTool Live](https://tik.tools) managed API service — 99.9% uptime, no reverse engineering, no maintenance required. Also available for [Python](https://pypi.org/project/tiktok-live-api/) and [any language via WebSocket](https://tik.tools/docs).
11
12
 
@@ -56,14 +57,14 @@ That's it. **No complex setup, no protobuf, no reverse engineering, no breakages
56
57
 
57
58
  ---
58
59
 
59
- ## šŸš€ Try It Now — 60-Second Live Demo
60
+ ## šŸš€ Try It Now — 5-Minute Live Demo
60
61
 
61
- Copy-paste this into a file and run it. Connects to a live TikTok stream, prints every event for 60 seconds, then exits. Works on the free Sandbox tier.
62
+ Copy-paste this into a file and run it. Connects to a live TikTok stream, prints every event for 5 minutes, then exits. Works on the free Sandbox tier.
62
63
 
63
64
  **Save as `demo.mjs` and run with `node demo.mjs`:**
64
65
 
65
66
  ```javascript
66
- // demo.mjs — TikTok LIVE in 60 seconds
67
+ // demo.mjs — TikTok LIVE in 5 minutes
67
68
  // npm install tiktok-live-api
68
69
  import { TikTokLive } from 'tiktok-live-api';
69
70
 
@@ -80,11 +81,11 @@ client.on('member', e => { events++; console.log(`šŸ‘‹ ${e.user.uniqueId} j
80
81
  client.on('follow', e => { events++; console.log(`āž• ${e.user.uniqueId} followed`); });
81
82
  client.on('roomUserSeq', e => { events++; console.log(`šŸ‘€ Viewers: ${e.viewerCount}`); });
82
83
 
83
- client.on('connected', () => console.log(`\nāœ… Connected to @${LIVE_USERNAME} — listening for 60s...\n`));
84
+ client.on('connected', () => console.log(`\nāœ… Connected to @${LIVE_USERNAME} — listening for 5 min...\n`));
84
85
  client.on('disconnected', () => console.log(`\nšŸ“Š Done! Received ${events} events.\n`));
85
86
 
86
87
  client.connect();
87
- setTimeout(() => { client.disconnect(); }, 60_000);
88
+ setTimeout(() => { client.disconnect(); }, 300_000);
88
89
  ```
89
90
 
90
91
  <details>
@@ -101,7 +102,7 @@ const LIVE_USERNAME = 'tv_asahi_news';
101
102
  const ws = new WebSocket(`wss://api.tik.tools?uniqueId=${LIVE_USERNAME}&apiKey=${API_KEY}`);
102
103
  let events = 0;
103
104
 
104
- ws.on('open', () => console.log(`\nāœ… Connected to @${LIVE_USERNAME} — listening for 60s...\n`));
105
+ ws.on('open', () => console.log(`\nāœ… Connected to @${LIVE_USERNAME} — listening for 5 min...\n`));
105
106
  ws.on('message', (raw) => {
106
107
  const msg = JSON.parse(raw);
107
108
  events++;
@@ -119,7 +120,7 @@ ws.on('message', (raw) => {
119
120
  });
120
121
  ws.on('close', () => console.log(`\nšŸ“Š Done! Received ${events} events.\n`));
121
122
 
122
- setTimeout(() => ws.close(), 60_000);
123
+ setTimeout(() => ws.close(), 300_000);
123
124
  ```
124
125
 
125
126
  </details>
@@ -181,6 +182,7 @@ client.connect();
181
182
  | `subscribe` | New subscriber | `user` |
182
183
  | `roomUserSeq` | Viewer count | `viewerCount`, `topViewers` |
183
184
  | `battle` | Battle event | `type`, `teams`, `scores` |
185
+ | `roomPin` | Pinned/starred message | `user`, `comment`, `action`, `durationSeconds` |
184
186
  | `envelope` | Treasure chest | `diamonds`, `user` |
185
187
  | `streamEnd` | Stream ended | `reason` |
186
188
  | `connected` | Connected | `uniqueId` |
@@ -339,7 +341,7 @@ client.on('gift', (event: GiftEvent) => {
339
341
 
340
342
  | Tier | Requests/Day | WebSocket Connections | Price |
341
343
  |------|-------------|----------------------|-------|
342
- | Sandbox | 50 | 1 (60s) | Free |
344
+ | Sandbox | 50 | 1 (5 min) | Free |
343
345
  | Basic | 10,000 | 3 (8h) | $7/week |
344
346
  | Pro | 75,000 | 50 (8h) | $15/week |
345
347
  | Ultra | 300,000 | 500 (8h) | $45/week |
package/dist/index.d.mts CHANGED
@@ -60,6 +60,25 @@ interface BattleEvent {
60
60
  teams: Array<Record<string, unknown>>;
61
61
  scores: number[];
62
62
  }
63
+ /** Payload for `roomPin` (starred/pinned message) events. */
64
+ interface RoomPinEvent {
65
+ /** User who wrote the pinned message. */
66
+ user: TikTokUser;
67
+ /** The pinned comment text. */
68
+ comment: string;
69
+ /** Pin action: 1 = pin, 2 = unpin. */
70
+ action: number;
71
+ /** How long the message stays pinned (seconds). */
72
+ durationSeconds: number;
73
+ /** Timestamp when the message was pinned (ms). */
74
+ pinnedAt: number;
75
+ /** Original message type (e.g. "WebcastChatMessage"). */
76
+ originalMsgType: string;
77
+ /** Original message ID that was pinned. */
78
+ originalMsgId: string;
79
+ /** User ID of the operator who pinned the message. */
80
+ operatorUserId: string;
81
+ }
63
82
  /** Payload for `caption` events from {@link TikTokCaptions}. */
64
83
  interface CaptionEvent {
65
84
  text: string;
@@ -104,6 +123,7 @@ interface TikTokLiveEventMap {
104
123
  subscribe: SocialEvent;
105
124
  roomUserSeq: RoomUserSeqEvent;
106
125
  battle: BattleEvent;
126
+ roomPin: RoomPinEvent;
107
127
  envelope: Record<string, unknown>;
108
128
  streamEnd: Record<string, unknown>;
109
129
  roomInfo: Record<string, unknown>;
package/dist/index.d.ts CHANGED
@@ -60,6 +60,25 @@ interface BattleEvent {
60
60
  teams: Array<Record<string, unknown>>;
61
61
  scores: number[];
62
62
  }
63
+ /** Payload for `roomPin` (starred/pinned message) events. */
64
+ interface RoomPinEvent {
65
+ /** User who wrote the pinned message. */
66
+ user: TikTokUser;
67
+ /** The pinned comment text. */
68
+ comment: string;
69
+ /** Pin action: 1 = pin, 2 = unpin. */
70
+ action: number;
71
+ /** How long the message stays pinned (seconds). */
72
+ durationSeconds: number;
73
+ /** Timestamp when the message was pinned (ms). */
74
+ pinnedAt: number;
75
+ /** Original message type (e.g. "WebcastChatMessage"). */
76
+ originalMsgType: string;
77
+ /** Original message ID that was pinned. */
78
+ originalMsgId: string;
79
+ /** User ID of the operator who pinned the message. */
80
+ operatorUserId: string;
81
+ }
63
82
  /** Payload for `caption` events from {@link TikTokCaptions}. */
64
83
  interface CaptionEvent {
65
84
  text: string;
@@ -104,6 +123,7 @@ interface TikTokLiveEventMap {
104
123
  subscribe: SocialEvent;
105
124
  roomUserSeq: RoomUserSeqEvent;
106
125
  battle: BattleEvent;
126
+ roomPin: RoomPinEvent;
107
127
  envelope: Record<string, unknown>;
108
128
  streamEnd: Record<string, unknown>;
109
129
  roomInfo: Record<string, unknown>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tiktok-live-api",
3
- "version": "1.0.1",
3
+ "version": "1.1.0",
4
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
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",