Web Scraper Experimental Debug avatar
Web Scraper Experimental Debug
Try for free

No credit card required

View all Actors
Web Scraper Experimental Debug

Web Scraper Experimental Debug

mtrunkat/web-scraper-experimental-dbgr
Try for free

No credit card required

Experimental version of Apify Web Scraper with Chrome debugger integrated

The code examples below show how to run the Actor and get its results. To run the code, you need to have an Apify account. Replace <YOUR_API_TOKEN> in the code with your API token, which you can find under Settings > Integrations in Apify Console. Learn more

1from apify_client import ApifyClient
2
3# Initialize the ApifyClient with your Apify API token
4client = ApifyClient("<YOUR_API_TOKEN>")
5
6# Prepare the Actor input
7run_input = {
8    "startUrls": [{ "url": "https://apify.com" }],
9    "pseudoUrls": [{ "purl": "https://apify.com[(/[\\w-]+)?]" }],
10    "linkSelector": "a",
11    "pageFunction": """async function pageFunction(context) {
12    // See README for context properties. If the syntax is unfamiliar see the link
13    // https://javascript.info/destructuring-assignment#object-destructuring
14    const { request, log, jQuery } = context;
15
16    // To be able to use jQuery as $, one needs save it into a variable
17    // and select the inject jQuery option. We've selected it for you.
18    const $ = jQuery;
19    const title = $('title').text();
20
21    // This is yet another new feature of Javascript called template strings.
22    // https://javascript.info/string#quotes
23    log.info(`URL: ${request.url} TITLE: ${title}`);
24
25    // To save data just return an object with the requested properties.
26    return {
27        url: request.url,
28        title
29    };
30}""",
31    "proxyConfiguration": { "useApifyProxy": False },
32    "initialCookies": [],
33    "waitUntil": ["networkidle2"],
34    "customData": {},
35}
36
37# Run the Actor and wait for it to finish
38run = client.actor("mtrunkat/web-scraper-experimental-dbgr").call(run_input=run_input)
39
40# Fetch and print Actor results from the run's dataset (if there are any)
41print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
42for item in client.dataset(run["defaultDatasetId"]).iterate_items():
43    print(item)
44
45# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start
Developer
Maintained by Community
Actor metrics
  • 5 monthly users
  • 3 stars
  • 100.0% runs succeeded
  • Created in Oct 2019
  • Modified over 3 years ago