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 "khaby.lame"
13 ],
14 "resultsPerPage": 10,
15 "profileScrapeSections": [
16 "videos"
17 ],
18 "maxFollowersPerProfile": 0,
19 "maxFollowingPerProfile": 0,
20 "commentsPerPost": 0,
21 "maxRepliesPerComment": 0,
22 "proxyCountryCode": "None",
23 "mcpMode": "perPost",
24 "mcpMessage": `*@{{authorMeta.name}}* — {{diggCount}} likes · {{playCount}} views
25{{text}}
26{{webVideoUrl}}`,
27 "mcpMaxItems": 50
28};
29
30
31const run = await client.actor("harshmaur/tiktok-scraper").call(input);
32
33
34console.log('Results from dataset');
35console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
36const { items } = await client.dataset(run.defaultDatasetId).listItems();
37items.forEach((item) => {
38 console.dir(item);
39});
40
41