Reoo88 commited on
Commit
ef9a1f8
·
verified ·
1 Parent(s): 7b48dec

Update index.js

Browse files
Files changed (1) hide show
  1. index.js +6 -9
index.js CHANGED
@@ -1,25 +1,22 @@
1
  const { WebcastPushConnection } = require('tiktok-live-connector');
2
  const fs = require('fs');
3
 
4
- const username = 's.og94';
 
5
  const commentsFile = 'comments.txt';
6
 
7
- // ضع مفتاح Euler Stream API الخاص بك هنا
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('❌ فشل الاتصال:', err.message);
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
  });