1from apify_client import ApifyClient
2
3
4
5client = ApifyClient("<YOUR_API_TOKEN>")
6
7
8run_input = {
9 "enableVideoKeyword": True,
10 "videoKeywords": [
11 "cooking",
12 "gym tips",
13 ],
14 "videoMaxResults": 20,
15 "videoKeywordFetchEngagement": True,
16 "videoKeywordFetchAccountDetails": False,
17 "videoKeywordMinPlays": 0,
18 "videoKeywordPublishedWithin": "any",
19 "enableVideoUrl": False,
20 "videoUrls": [],
21 "videoIds": [],
22 "videoUrlFetchEngagement": True,
23 "videoUrlFetchAccountDetails": False,
24 "enableVideoRelated": False,
25 "relatedVideoUrls": [],
26 "relatedMaxResults": 16,
27 "videoRelatedFetchEngagement": True,
28 "videoRelatedFetchAccountDetails": False,
29 "enableVideoUser": False,
30 "videoUsernames": [],
31 "videoUserMaxResults": 20,
32 "videoUserFetchEngagement": True,
33 "videoUserFetchAccountDetails": False,
34 "videoUserMinPlays": 0,
35 "videoUserPublishedWithin": "any",
36 "enableAccounts": False,
37 "accountMode": "url",
38 "accountUsernames": ["tiktok"],
39 "accountUrls": [],
40 "accountKeywords": ["cooking"],
41 "accountsPerKeyword": 15,
42 "accountFetchRecentVideos": False,
43 "accountRecentVideosMax": 12,
44 "enableTrends": False,
45 "trendsMode": "discover",
46 "hashtags": [
47 "cooking",
48 "fyp",
49 ],
50 "hashtagFetchVideos": True,
51 "hashtagMaxVideos": 20,
52 "discoverMaxHashtags": 40,
53 "discoverMaxSounds": 20,
54 "discoverHydrateDetails": True,
55 "enableSuggestions": False,
56 "suggestionKeywords": ["gym tips"],
57 "suggestionsMaxResults": 15,
58 "enableComments": False,
59 "commentKeywords": ["cooking"],
60 "commentSearchMaxVideos": 5,
61 "commentsMaxResults": 30,
62 "commentMinDiggs": 0,
63 "commentVideoUrls": [],
64 "commentVideoIds": [],
65 "commentsFromSearchResults": False,
66 "commentsFromSearchMaxVideos": 10,
67 "enableScrapeByUrl": False,
68 "scrapeUrls": [],
69 "webhookFormat": "json",
70 "includeRaw": False,
71}
72
73
74run = client.actor("b2b_leads/tiktok-real-time-data").call(run_input=run_input)
75
76
77print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
78for item in client.dataset(run["defaultDatasetId"]).iterate_items():
79 print(item)
80
81