1from apify_client import ApifyClient
2
3
4
5client = ApifyClient("<YOUR_API_TOKEN>")
6
7
8run_input = {
9 "startUrls": [{ "url": "https://docs.apify.com/academy/web-scraping-for-beginners" }],
10 "useSitemaps": False,
11 "respectRobotsTxtFile": True,
12 "crawlerType": "playwright:adaptive",
13 "includeUrlGlobs": [],
14 "excludeUrlGlobs": [],
15 "initialCookies": [],
16 "proxyConfiguration": { "useApifyProxy": True },
17 "keepElementsCssSelector": "",
18 "removeElementsCssSelector": """nav, footer, script, style, noscript, svg, img[src^='data:'],
19[role=\"alert\"],
20[role=\"banner\"],
21[role=\"dialog\"],
22[role=\"alertdialog\"],
23[role=\"region\"][aria-label*=\"skip\" i],
24[aria-modal=\"true\"]""",
25 "blockMedia": True,
26 "clickElementsCssSelector": "[aria-expanded=\"false\"]",
27}
28
29
30run = client.actor("apify/website-content-crawler").call(run_input=run_input)
31
32
33print("πΎ Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
34for item in client.dataset(run["defaultDatasetId"]).iterate_items():
35 print(item)
36
37