1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "videoRefs": [
12 "https://www.youtube.com/watch?v=EAdh6m3E3UI"
13 ],
14 "channelRefs": [],
15 "mode": "replay",
16 "channelDiscoveryMode": "current_live_then_replays",
17 "maxVideosPerChannel": 1,
18 "lookbackDays": 30,
19 "maxMessagesPerVideo": 50,
20 "maxTotalItems": 50,
21 "maxTimePerVideoSecs": 120,
22 "includeNormalMessages": true,
23 "includeSuperChats": true,
24 "includeMembershipEvents": true,
25 "includeModerationEvents": true,
26 "proxy": {
27 "useApifyProxy": true,
28 "apifyProxyGroups": [
29 "RESIDENTIAL"
30 ]
31 }
32};
33
34
35const run = await client.actor("parsebird/youtube-live-chat-scraper").call(input);
36
37
38console.log('Results from dataset');
39console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
40const { items } = await client.dataset(run.defaultDatasetId).listItems();
41items.forEach((item) => {
42 console.dir(item);
43});
44
45