1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "profiles": [
12 "tiktok"
13 ],
14 "includeRecentPosts": true,
15 "maxPostsPerProfile": 50,
16 "includeProfileAnalytics": true,
17 "videoUrls": [
18 "https://www.tiktok.com/@tiktok/video/7234567890123456789"
19 ],
20 "includeRelatedVideos": true,
21 "maxRelatedVideos": 20,
22 "followersProfiles": [
23 "tiktok"
24 ],
25 "scrapeFollowers": true,
26 "scrapeFollowing": false,
27 "maxItemsPerProfile": 1000,
28 "commentVideoUrls": [
29 "https://www.tiktok.com/@tiktok/video/7234567890123456789"
30 ],
31 "includeCommentReplies": true,
32 "maxComments": 100,
33 "maxReplies": 20,
34 "creatorSearchKeywords": [
35 "fitness"
36 ],
37 "videoSearchKeywords": [
38 "ai"
39 ],
40 "maxSearchResultsPerQuery": 100,
41 "hashtags": [
42 "fyp"
43 ],
44 "maxHashtagPosts": 50,
45 "musicUrlsOrIds": [],
46 "maxMusicPosts": 50
47};
48
49
50const run = await client.actor("datadoping/tiktok-scraper").call(input);
51
52
53console.log('Results from dataset');
54console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
55const { items } = await client.dataset(run.defaultDatasetId).listItems();
56items.forEach((item) => {
57 console.dir(item);
58});
59
60