Web Scraper Experimental Debug
No credit card required
Web Scraper Experimental Debug
No credit card required
Experimental version of Apify Web Scraper with Chrome debugger integrated
You can access the Web Scraper Experimental Debug programmatically from your own JavaScript applications by using the Apify API. You can also choose the language preference from below. To use the Apify API, you’ll need an Apify account and your API token, found in Integrations settings in Apify Console.
1import { ApifyClient } from 'apify-client';
2
3// Initialize the ApifyClient with your Apify API token
4// Replace the '<YOUR_API_TOKEN>' with your token
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9// Prepare Actor input
10const input = {
11 "startUrls": [
12 {
13 "url": "https://apify.com"
14 }
15 ],
16 "pseudoUrls": [
17 {
18 "purl": "https://apify.com[(/[\\w-]+)?]"
19 }
20 ],
21 "linkSelector": "a",
22 "pageFunction": async function pageFunction(context) {
23 // See README for context properties. If the syntax is unfamiliar see the link
24 // https://javascript.info/destructuring-assignment#object-destructuring
25 const { request, log, jQuery } = context;
26
27 // To be able to use jQuery as $, one needs save it into a variable
28 // and select the inject jQuery option. We've selected it for you.
29 const $ = jQuery;
30 const title = $('title').text();
31
32 // This is yet another new feature of Javascript called template strings.
33 // https://javascript.info/string#quotes
34 log.info(`URL: ${request.url} TITLE: ${title}`);
35
36 // To save data just return an object with the requested properties.
37 return {
38 url: request.url,
39 title
40 };
41 },
42 "proxyConfiguration": {
43 "useApifyProxy": false
44 },
45 "initialCookies": [],
46 "waitUntil": [
47 "networkidle2"
48 ],
49 "customData": {}
50};
51
52// Run the Actor and wait for it to finish
53const run = await client.actor("mtrunkat/web-scraper-experimental-dbgr").call(input);
54
55// Fetch and print Actor results from the run's dataset (if any)
56console.log('Results from dataset');
57console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
58const { items } = await client.dataset(run.defaultDatasetId).listItems();
59items.forEach((item) => {
60 console.dir(item);
61});
62
63// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs
Web Scraper Experimental Debug API in JavaScript
The Apify API client for JavaScript is the official library that allows you to use Web Scraper Experimental Debug API in JavaScript or TypeScript, providing convenience functions and automatic retries on errors.
Install the apify-client
npm install apify-client
Other API clients include:
Actor Metrics
3 monthly users
-
3 stars
91% runs succeeded
Created in Oct 2019
Modified 4 years ago