-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.ts
More file actions
27 lines (20 loc) · 873 Bytes
/
example.ts
File metadata and controls
27 lines (20 loc) · 873 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import BotProtector from './BotProtector';
// Replace with your YouTube API key
const API_KEY = 'AIzaSyBBB1Gm5z-cGJT_WuA287H6w97zAd64KQw';
const CHANNEL_ID = 'UCtgHR0fSfJfg2Flu5Wx85sw';
const VIDEO_ID = 'YOUR_VIDEO_ID';
const botProtector = new BotProtector(API_KEY);
async function protectYouTubeContent() {
// Start monitoring the channel
await botProtector.monitorChannel(CHANNEL_ID);
// Example of checking a comment
const comment = "Check out my channel! Sub4Sub!";
const isSpam = await botProtector.checkYouTubeComment(comment);
if (!isSpam) {
console.log('Comment blocked - spam detected');
}
// Start monitoring video views
await botProtector.monitorVideoViews(VIDEO_ID);
console.log(`Started monitoring views for video ${VIDEO_ID}`);
}
protectYouTubeContent().catch(console.error);