Spaces:
Paused
Paused
Update index.js
Browse files
index.js
CHANGED
|
@@ -1,25 +1,22 @@
|
|
| 1 |
const { WebcastPushConnection } = require('tiktok-live-connector');
|
| 2 |
const fs = require('fs');
|
| 3 |
|
| 4 |
-
|
|
|
|
| 5 |
const commentsFile = 'comments.txt';
|
| 6 |
|
| 7 |
-
|
| 8 |
-
const SIGN_API_KEY = 'euler_NmE1NWUwY2E3MjUxNDM3MDk5MzliMDBkMjdjMWVlMWMzODdkMjdkOWQ5OGFmYTI0ODliYWM4';
|
| 9 |
-
|
| 10 |
-
let tiktokConnection = new WebcastPushConnection(username, {
|
| 11 |
-
signApiKey: SIGN_API_KEY // هذا هو السطر السحري الذي يحل المشكلة
|
| 12 |
-
});
|
| 13 |
|
| 14 |
tiktokConnection.connect().then(state => {
|
| 15 |
-
console.log(`✅ متصل بـ ${username} (Room ID: ${state.roomId})`);
|
| 16 |
|
| 17 |
tiktokConnection.on('chat', data => {
|
| 18 |
const comment = `${data.uniqueId}: ${data.comment}`;
|
| 19 |
console.log(comment);
|
|
|
|
| 20 |
fs.appendFileSync(commentsFile, comment + '\n');
|
| 21 |
});
|
| 22 |
|
| 23 |
}).catch(err => {
|
| 24 |
-
console.error('❌ فشل ا
|
| 25 |
});
|
|
|
|
| 1 |
const { WebcastPushConnection } = require('tiktok-live-connector');
|
| 2 |
const fs = require('fs');
|
| 3 |
|
| 4 |
+
// يمكنك تغيير اسم المستخدم هنا أو عبر متغير البيئة
|
| 5 |
+
const username = process.env.TIKTOK_USERNAME || 's.og94';
|
| 6 |
const commentsFile = 'comments.txt';
|
| 7 |
|
| 8 |
+
let tiktokConnection = new WebcastPushConnection(username);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
tiktokConnection.connect().then(state => {
|
| 11 |
+
console.log(`✅ Alluser متصل بـ ${username} (Room ID: ${state.roomId})`);
|
| 12 |
|
| 13 |
tiktokConnection.on('chat', data => {
|
| 14 |
const comment = `${data.uniqueId}: ${data.comment}`;
|
| 15 |
console.log(comment);
|
| 16 |
+
// كتابة التعليق في الملف (سيُنشأ تلقائياً)
|
| 17 |
fs.appendFileSync(commentsFile, comment + '\n');
|
| 18 |
});
|
| 19 |
|
| 20 |
}).catch(err => {
|
| 21 |
+
console.error('❌ فشل اتصال Alluser:', err.message);
|
| 22 |
});
|