
Web Scraper Experimental Debug
- mtrunkat/web-scraper-experimental-dbgr
- Modified
- Users 28
- Runs 786
- Created by
Marek Trunk谩t
Experimental version of Apify Web Scraper with Chrome debugger integrated
To run the code examples, you need to have an Apify account. Replace <YOUR_API_TOKEN> in the code with your API token. For a more detailed explanation, please read about running Actors via the API in Apify Docs.
# Set API token
API_TOKEN=<YOUR_API_TOKEN>
# Prepare Actor input
cat > input.json <<'EOF'
{
"startUrls": [
{
"url": "https://apify.com"
}
],
"pseudoUrls": [
{
"purl": "https://apify.com[(/[\\w-]+)?]"
}
],
"linkSelector": "a",
"pageFunction": "async function pageFunction(context) {\n // See README for context properties. If the syntax is unfamiliar see the link\n // https://javascript.info/destructuring-assignment#object-destructuring\n const { request, log, jQuery } = context;\n\n // To be able to use jQuery as $, one needs save it into a variable\n // and select the inject jQuery option. We've selected it for you.\n const $ = jQuery;\n const title = $('title').text();\n\n // This is yet another new feature of Javascript called template strings.\n // https://javascript.info/string#quotes\n log.info(`URL: ${request.url} TITLE: ${title}`);\n\n // To save data just return an object with the requested properties.\n return {\n url: request.url,\n title\n };\n}",
"proxyConfiguration": {
"useApifyProxy": false
},
"initialCookies": [],
"waitUntil": [
"networkidle2"
],
"customData": {}
}
EOF
# Run the Actor
curl "https://api.apify.com/v2/acts/mtrunkat~web-scraper-experimental-dbgr/runs?token=$API_TOKEN" \
-X POST \
-d @input.json \
-H 'Content-Type: application/json'