![My Actr testing 2 avatar](https://images.apifyusercontent.com/3uViVoYdrb2aHZrN3XIs6ge-yDpOGYIQMtAEzh6q368/rs:fill:92:92/aHR0cHM6Ly9hcGlmeS1pbWFnZS11cGxvYWRzLXByb2QuczMuYW1hem9uYXdzLmNvbS9ZSkNuUzlxb2dpOVh4RGdMQi9YeWd0Snl4RVFpWG4zV2Vwcy1JTUdfNzYzNXNhLTA4LnBuZw.webp)
My Actr testing 2
Under maintenanceTry for free
No credit card required
View all Actors![My Actr testing 2](https://images.apifyusercontent.com/3uViVoYdrb2aHZrN3XIs6ge-yDpOGYIQMtAEzh6q368/rs:fill:92:92/aHR0cHM6Ly9hcGlmeS1pbWFnZS11cGxvYWRzLXByb2QuczMuYW1hem9uYXdzLmNvbS9ZSkNuUzlxb2dpOVh4RGdMQi9YeWd0Snl4RVFpWG4zV2Vwcy1JTUdfNzYzNXNhLTA4LnBuZw.webp)
This Actor is under maintenance.
This Actor may be unreliable while under maintenance. Would you like to try a similar Actor instead?
See alternative Actors![My Actr testing 2](https://images.apifyusercontent.com/3uViVoYdrb2aHZrN3XIs6ge-yDpOGYIQMtAEzh6q368/rs:fill:92:92/aHR0cHM6Ly9hcGlmeS1pbWFnZS11cGxvYWRzLXByb2QuczMuYW1hem9uYXdzLmNvbS9ZSkNuUzlxb2dpOVh4RGdMQi9YeWd0Snl4RVFpWG4zV2Vwcy1JTUdfNzYzNXNhLTA4LnBuZw.webp)
My Actr testing 2
xrhibiyftd/my-actr-testing-2
Try for free
No credit card required
Crawls websites with the headless Chrome and Puppeteer library using a provided server-side Node.js code. This crawler is an alternative to apify/web-scraper that gives you finer control over the process. Supports both recursive crawling and list of URLs. Supports login to website.
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
1import { ApifyClient } from 'apify-client';
2
3// Initialize the ApifyClient with your Apify API token
4const client = new ApifyClient({
5 token: '<YOUR_API_TOKEN>',
6});
7
8// Prepare Actor input
9const input = {
10 "startUrls": [
11 {
12 "url": "https://crawlee.dev"
13 }
14 ],
15 "globs": [
16 {
17 "glob": "https://crawlee.dev/*/*"
18 }
19 ],
20 "pseudoUrls": [],
21 "excludes": [
22 {
23 "glob": "/**/*.{png,jpg,jpeg,pdf}"
24 }
25 ],
26 "linkSelector": "a",
27 "pageFunction": async function pageFunction(context) {
28 const { page, request, log } = context;
29 const title = await page.title();
30 log.info(`URL: ${request.url} TITLE: ${title}`);
31 return {
32 url: request.url,
33 title
34 };
35 },
36 "proxyConfiguration": {
37 "useApifyProxy": true
38 },
39 "initialCookies": [],
40 "waitUntil": [
41 "networkidle2"
42 ],
43 "preNavigationHooks": `// We need to return array of (possibly async) functions here.
44 // The functions accept two arguments: the "crawlingContext" object
45 // and "gotoOptions".
46 [
47 async (crawlingContext, gotoOptions) => {
48 const { page } = crawlingContext;
49 // ...
50 },
51 ]`,
52 "postNavigationHooks": `// We need to return array of (possibly async) functions here.
53 // The functions accept a single argument: the "crawlingContext" object.
54 [
55 async (crawlingContext) => {
56 const { page } = crawlingContext;
57 // ...
58 },
59 ]`,
60 "customData": {}
61};
62
63(async () => {
64 // Run the Actor and wait for it to finish
65 const run = await client.actor("xrhibiyftd/my-actr-testing-2").call(input);
66
67 // Fetch and print Actor results from the run's dataset (if any)
68 console.log('Results from dataset');
69 console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
70 const { items } = await client.dataset(run.defaultDatasetId).listItems();
71 items.forEach((item) => {
72 console.dir(item);
73 });
74})();
75
76// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs
Actor metrics
- 3 monthly users
- 1 star
- 100.0% runs succeeded
- Created in Jan 2024
- Modified 6 months ago
Categories