Standby TypeScript project
Template with basic structure for an Actor using Standby mode that allows you to easily add your own functionality.
src/main.ts
1import http from 'http';2// Apify SDK - toolkit for building Apify Actors (Read more at https://docs.apify.com/sdk/js/)3import { Actor } from 'apify';4
5// this is ESM project, and as such, it requires you to specify extensions in your relative imports6// read more about this here: https://nodejs.org/docs/latest-v18.x/api/esm.html#mandatory-file-extensions7// note that we need to use `.js` even when inside TS files8// import { router } from './routes.js';9
10// The init() call configures the Actor for its environment. It's recommended to start every Actor with an init()11await Actor.init();12
13// Create a simple HTTP server that will respond with a message14const server = http.createServer((req, res) => {15 // Handle Apify standby readiness probe16 // https://docs.apify.com/platform/actors/development/programming-interface/standby#readiness-probe17 if (req.headers['x-apify-container-server-readiness-probe']) {18 res.writeHead(200);19 res.end('ok');20 return;21 }22 res.writeHead(200, { 'Content-Type': 'text/plain' });23 res.end('Hello from Actor Standby!\n');24});25
26// Listen on the standby port27server.listen(Actor.config.get('standbyPort'));Standby TypeScript template
Start a new web scraping project quickly and easily in TypeScript (Node.js) with our Standby project template. It provides a basic structure for building an Actor with Apify SDK and allows you to easily add your own functionality.
Included features
Resources
Crawlee + Cheerio
A scraper example that uses Cheerio to parse HTML. It's fast, but it can't run the website's JavaScript or pass JS anti-scraping challenges.
One‑Page HTML Scraper with Cheerio
Scrape single page with provided URL with Axios and extract data from page's HTML with Cheerio.
Crawlee + Puppeteer + Chrome
Example of a Puppeteer and headless Chrome web scraper. Headless browsers render JavaScript and are harder to block, but they're slower than plain HTTP.
Crawlee + Playwright + Chrome
Web scraper example with Crawlee, Playwright and headless Chrome. Playwright is more modern, user-friendly and harder to block than Puppeteer.
Crawlee + Playwright + Camoufox
Web scraper example with Crawlee, Playwright and headless Camoufox. Camoufox is a custom stealthy fork of Firefox. Try this template if you're facing anti-scraping challenges.
Playwright + Chrome Test Runner
Example of using the Playwright Test project to run automated website tests in the cloud and display their results. Usable as an API.