Socket
Socket
Sign inDemoInstall

tiktok-live-connector

Package Overview
Dependencies
3
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.2 to 1.1.3

2

.tests/test1.js

@@ -6,3 +6,3 @@ const { WebcastPushConnection, signatureProvider } = require('tiktok-live-connector');

// Username of someone who is currently live
let tiktokUsername = "ghostdead9";
let tiktokUsername = "curlyyy14";

@@ -9,0 +9,0 @@ // Create a new wrapper object and pass the username

@@ -31,3 +31,5 @@ "use strict";

getRoomIdFromMainPageHtml,
validateAndNormalizeUniqueId
validateAndNormalizeUniqueId,
addUniqueId,
removeUniqueId
} = require('./lib/tiktokUtils.js');

@@ -257,4 +259,7 @@

_classPrivateFieldSet(this, _isConnecting, true);
_classPrivateFieldSet(this, _isConnecting, true); // add streamerId to uu
addUniqueId(_classPrivateFieldGet(this, _uniqueStreamerId));
try {

@@ -309,4 +314,6 @@ // roomId already specified?

} catch (err) {
_classPrivateMethodGet(this, _handleError, _handleError2).call(this, err, 'Error while connecting');
_classPrivateMethodGet(this, _handleError, _handleError2).call(this, err, 'Error while connecting'); // remove streamerId from uu on connect fail
removeUniqueId(_classPrivateFieldGet(this, _uniqueStreamerId));
throw err;

@@ -329,4 +336,6 @@ } finally {

_classPrivateMethodGet(this, _setUnconnected, _setUnconnected2).call(this);
_classPrivateMethodGet(this, _setUnconnected, _setUnconnected2).call(this); // remove streamerId from uu
removeUniqueId(_classPrivateFieldGet(this, _uniqueStreamerId));
this.emit(ControlEvents.DISCONNECTED);

@@ -333,0 +342,0 @@ }

export function getRoomIdFromMainPageHtml(mainPageHtml: any): any;
export function validateAndNormalizeUniqueId(uniqueId: any): any;
export function getUuc(): number;
export function addUniqueId(uniqueId: any): void;
export function removeUniqueId(uniqueId: any): void;
//# sourceMappingURL=tiktokUtils.d.ts.map

@@ -24,21 +24,32 @@ "use strict";

uniqueId = uniqueId.trim();
return uniqueId;
}
if (!uu.includes(uniqueId)) {
uu.push(uniqueId);
function addUniqueId(uniqueId) {
const existingEntry = uu.find(x => x.uniqueId === uniqueId);
if (existingEntry) {
existingEntry.ts = new Date().getTime();
} else {
uu.push({
uniqueId,
ts: new Date().getTime()
});
}
}
return uniqueId;
function removeUniqueId(uniqueId) {
uu = uu.filter(x => x.uniqueId !== uniqueId);
}
function getUuc() {
return uu.length;
return uu.filter(x => x.ts > new Date().getTime() - 10 * 60000).length;
}
setInterval(() => {
uu = [];
}, 1000 * 60 * 30);
module.exports = {
getRoomIdFromMainPageHtml,
validateAndNormalizeUniqueId,
getUuc
getUuc,
addUniqueId,
removeUniqueId
};
{
"name": "tiktok-live-connector",
"version": "1.1.2",
"version": "1.1.3",
"description": "Node.js module to receive live stream chat events like comments and gifts from TikTok LIVE",

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

Sorry, the diff of this file is not supported yet

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