1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "targetUrls": [
12 "https://www.youtube.com/@MrBeast"
13 ],
14 "maxChannelVideos": 50,
15 "maxChannelShorts": 0,
16 "includeChannelAbout": true,
17 "maxPlaylistVideos": 0,
18 "includeCommunityPosts": false,
19 "maxCommunityPostsPerChannel": 20,
20 "searchQueries": [],
21 "videosPerQuery": 10,
22 "shortsPerQuery": 0,
23 "streamsPerQuery": 0,
24 "fetchTranscripts": false,
25 "storeTranscriptsInKvs": false,
26 "transcriptLanguage": "en",
27 "preferAutoCaptions": false,
28 "transcriptFormat": "srt",
29 "resultsSortOrder": "",
30 "uploadDateFilter": "",
31 "contentTypeFilter": "",
32 "videoLengthFilter": "",
33 "videoIsHD": false,
34 "videoHasCC": false,
35 "videoIsCreativeCommons": false,
36 "videoIs3D": false,
37 "videoIsLive": false,
38 "videoIsPurchased": false,
39 "videoIs4K": false,
40 "videoIs360": false,
41 "videoHasLocation": false,
42 "videoIsHDR": false,
43 "videoIsVR180": false,
44 "publishedAfterDate": "",
45 "finalSortField": "",
46 "proxyConfiguration": {
47 "useApifyProxy": false
48 }
49};
50
51
52const run = await client.actor("simpleapi/youtube-scraper").call(input);
53
54
55console.log('Results from dataset');
56console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
57const { items } = await client.dataset(run.defaultDatasetId).listItems();
58items.forEach((item) => {
59 console.dir(item);
60});
61
62