1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "sourceMode": "sample",
12 "mode": "demo",
13 "startUrls": [
14 {
15 "url": "https://shop.tiktok.com/",
16 "sourceId": "TIKTOK-SHOP-PUBLIC",
17 "userData": {
18 "sourceId": "TIKTOK-SHOP-PUBLIC"
19 }
20 },
21 {
22 "url": "https://shop.tiktok.com/",
23 "sourceId": "TIKTOK-SHOP-CREATOR",
24 "userData": {
25 "sourceId": "TIKTOK-SHOP-CREATOR"
26 }
27 },
28 {
29 "url": "https://shop.tiktok.com/",
30 "sourceId": "TIKTOK-SHOP-AFFILIATE",
31 "userData": {
32 "sourceId": "TIKTOK-SHOP-AFFILIATE"
33 }
34 }
35 ],
36 "maxItems": 25,
37 "outputMode": "sample-records"
38};
39
40
41const run = await client.actor("zentrafoundry/tiktok-shop-affiliate-creator-sales-scraper").call(input);
42
43
44console.log('Results from dataset');
45console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
46const { items } = await client.dataset(run.defaultDatasetId).listItems();
47items.forEach((item) => {
48 console.dir(item);
49});
50
51