1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "keywords": [
12 "cooking recipes"
13 ],
14 "contentType": "all",
15 "sortBy": "relevance",
16 "uploadDate": "all",
17 "videoDuration": "all",
18 "includeVideoStats": false,
19 "detectLanguage": false,
20 "includeChannelAnalytics": false,
21 "outputTitle": true,
22 "outputVideoId": true,
23 "outputVideoUrl": true,
24 "outputChannelName": true,
25 "outputChannelId": true,
26 "outputChannelUrl": true,
27 "outputIsVerified": true,
28 "outputThumbnailUrl": true,
29 "outputViewCount": true,
30 "outputViewCountText": true,
31 "outputPublishedText": true,
32 "outputDuration": true,
33 "outputDurationSeconds": true,
34 "outputContentType": true,
35 "outputKeyword": true,
36 "outputScrapedAt": true,
37 "concurrency": 3,
38 "proxyConfig": {
39 "useApifyProxy": true,
40 "apifyProxyGroups": []
41 }
42};
43
44
45const run = await client.actor("lurkapi/youtube-keyword-search-scraper").call(input);
46
47
48console.log('Results from dataset');
49console.log(`πΎ Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
50const { items } = await client.dataset(run.defaultDatasetId).listItems();
51items.forEach((item) => {
52 console.dir(item);
53});
54
55