1from apify_client import ApifyClient
2
3
4
5client = ApifyClient("<YOUR_API_TOKEN>")
6
7
8run_input = {
9 "runMode": "DEVELOPMENT",
10 "startUrls": [{ "url": "https://crawlee.dev/js" }],
11 "respectRobotsTxtFile": True,
12 "linkSelector": "a[href]",
13 "globs": [{ "glob": "https://crawlee.dev/js/*/*" }],
14 "pseudoUrls": [],
15 "excludes": [{ "glob": "/**/*.{png,jpg,jpeg,pdf}" }],
16 "proxyConfiguration": { "useApifyProxy": True },
17 "initialCookies": [],
18 "waitUntil": ["networkidle2"],
19 "preNavigationHooks": """// We need to return array of (possibly async) functions here.
20// The functions accept two arguments: the \"crawlingContext\" object
21// and \"gotoOptions\".
22[
23 async (crawlingContext, gotoOptions) => {
24 // ...
25 },
26]
27""",
28 "postNavigationHooks": """// We need to return array of (possibly async) functions here.
29// The functions accept a single argument: the \"crawlingContext\" object.
30[
31 async (crawlingContext) => {
32 // ...
33 },
34]""",
35 "breakpointLocation": "NONE",
36 "customData": {},
37}
38
39
40run = client.actor("vertivine/opentable-review-scraper").call(run_input=run_input)
41
42
43print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
44for item in client.dataset(run["defaultDatasetId"]).iterate_items():
45 print(item)
46
47