Socket
Socket
Sign inDemoInstall

tiktok-live-connector

Package Overview
Dependencies
84
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.9.21 to 0.9.22

18

dist/index.js

@@ -66,2 +66,5 @@ "use strict";

};
const CustomEvents = {
SUBSCRIBE: 'subscribe'
};
/**

@@ -444,2 +447,3 @@ * Wrapper class for TikTok's internal Webcast Push Service

_classPrivateFieldGet(this, _clientParams).cursor = '';
_classPrivateFieldGet(this, _clientParams).internal_ext = '';
}

@@ -455,2 +459,3 @@

_classPrivateFieldGet(this, _clientParams).room_id = roomId;
_classPrivateFieldGet(this, _clientParams).msToken = _classPrivateFieldGet(this, _httpClient).cookieJar.getCookieByName('msToken');
} catch (err) {

@@ -499,9 +504,7 @@ throw new Error(`Failed to retrieve room_id from page source. ${err.message}`);

let webcastResponse = await _classPrivateFieldGet(this, _httpClient).getDeserializedObjectFromWebcastApi('im/fetch/', _classPrivateFieldGet(this, _clientParams), 'WebcastResponse');
let upgradeToWsOffered = !!webcastResponse.wsUrl && !!webcastResponse.wsParam; // Set cursor param to continue with the next request
let upgradeToWsOffered = !!webcastResponse.wsUrl && !!webcastResponse.wsParam; // Set cursor and internal_ext param to continue with the next request
if (webcastResponse.cursor) {
_classPrivateFieldGet(this, _clientParams).cursor = webcastResponse.cursor;
} // Upgrade to Websocket offered? => Try upgrade
if (webcastResponse.cursor) _classPrivateFieldGet(this, _clientParams).cursor = webcastResponse.cursor;
if (webcastResponse.internalExt) _classPrivateFieldGet(this, _clientParams).internal_ext = webcastResponse.internalExt; // Upgrade to Websocket offered? => Try upgrade
if (!_classPrivateFieldGet(this, _isWsUpgradeDone) && _classPrivateFieldGet(this, _options).enableWebsocketUpgrade && upgradeToWsOffered) {

@@ -586,2 +589,7 @@ await _classPrivateMethodGet(this, _tryUpgradeToWebsocket, _tryUpgradeToWebsocket2).call(this, webcastResponse);

this.emit(MessageEvents.MEMBER, simplifiedObj);
if (simplifiedObj.actionId === 7) {
this.emit(CustomEvents.SUBSCRIBE, simplifiedObj);
}
break;

@@ -588,0 +596,0 @@

@@ -63,2 +63,6 @@ "use strict";

getCookieByName(cookieName) {
return this.cookies[cookieName];
}
getCookieString() {

@@ -65,0 +69,0 @@ let cookieString = '';

@@ -15,6 +15,12 @@ "use strict";

browser_platform: 'Win32',
browser_version: '5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.99 Safari/537.36',
browser_version: '5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.63 Safari/537.36',
cookie_enabled: true,
cursor: '',
internal_ext: '',
device_platform: 'web',
focus_state: true,
from_page: 'user',
history_len: 4,
is_fullscreen: false,
is_page_visible: true,
did_rule: 3,

@@ -30,3 +36,8 @@ fetch_rule: 1,

tz_name: 'Europe/Berlin',
version_code: 180800
referer: 'https://www.tiktok.com/',
root_referer: 'https://www.tiktok.com/',
msToken: '',
version_code: 180800,
webcast_sdk_version: '1.3.0',
update_version_code: '1.3.0'
},

@@ -36,3 +47,3 @@ DEFAULT_REQUEST_HEADERS: {

'Cache-Control': 'max-age=0',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.99 Safari/537.36',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.63 Safari/537.36',
Accept: 'text/html,application/json,application/protobuf',

@@ -39,0 +50,0 @@ Referer: 'https://www.tiktok.com/',

{
"name": "tiktok-live-connector",
"version": "0.9.21",
"version": "0.9.22",
"description": "Node.js module to receive live stream chat events like comments and gifts from TikTok LIVE",

@@ -5,0 +5,0 @@ "main": "index.js",

# TikTok-Live-Connector
A Node.js library to receive live stream events such as comments and gifts in realtime from [TikTok LIVE](https://www.tiktok.com/live) by connecting to TikTok's internal WebCast push service. The package includes a wrapper that connects to the WebCast service using just the username (`uniqueId`). This allows you to connect to your own live chat as well as the live chat of other streamers. No credentials are required. Besides [Chat Comments](#chat), other events such as [Members Joining](#member), [Gifts](#gift), [Viewers](#roomuser), [Follows](#social), [Shares](#social), [Questions](#questionnew), [Likes](#like) and [Battles](#linkmicbattle) can be tracked. You can also send [automatic messages](#send-chat-messages) into the chat by providing your Session ID.
A Node.js library to receive live stream events such as comments and gifts in realtime from [TikTok LIVE](https://www.tiktok.com/live) by connecting to TikTok's internal WebCast push service. The package includes a wrapper that connects to the WebCast service using just the username (`uniqueId`). This allows you to connect to your own live chat as well as the live chat of other streamers. No credentials are required. Besides [Chat Comments](#chat), other events such as [Members Joining](#member), [Gifts](#gift), [Subscriptions](#subscribe), [Viewers](#roomuser), [Follows](#social), [Shares](#social), [Questions](#questionnew), [Likes](#like) and [Battles](#linkmicbattle) can be tracked. You can also send [automatic messages](#send-chat-messages) into the chat by providing your Session ID.

@@ -9,2 +9,3 @@ ### Demo Project: [https://tiktok-chat-reader.zerody.one/](https://tiktok-chat-reader.zerody.one/)

- **Go** rewrite: [GoTikTokLive](https://github.com/Davincible/gotiktoklive) by [@Davincible](https://github.com/Davincible)
- **C#** rewrite: [TikTokLiveSharp](https://github.com/sebheron/TikTokLiveSharp) by [@sebheron](https://github.com/sebheron)

@@ -137,2 +138,5 @@ **NOTE:** This is not an official API. It's a reverse engineering project.

Other Events:
- [`subscribe`](#subscribe)
### Control Events

@@ -531,2 +535,13 @@

### Other Events
#### `subscribe`
Triggers when a user creates a subscription.
```javascript
tiktokChatConnection.on('subscribe', (data) => {
console.log(data.uniqueId, "subscribed!");
})
```
## Examples

@@ -533,0 +548,0 @@ ### Retrieve Room Info

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc