Empty TypeScript Actor
An Actor with the Apify SDK set up, so you can build any tool you need.
src/main.ts
1// Apify SDK - toolkit for building Apify Actors (Read more at https://docs.apify.com/sdk/js/)2import { Actor, log } from 'apify';3// Crawlee - web scraping and browser automation library (Read more at https://crawlee.dev)4// import { CheerioCrawler } from '@crawlee/cheerio';5
6// this is ESM project, and as such, it requires you to specify extensions in your relative imports7// read more about this here: https://nodejs.org/docs/latest-v18.x/api/esm.html#mandatory-file-extensions8// note that we need to use `.js` even when inside TS files9// import { router } from './routes.js';10
11// The init() call configures the Actor to correctly work with the Apify-provided environment - mainly the storage infrastructure. It is necessary that every Actor performs an init() call.12await Actor.init();13
14log.info('Hello from the Actor!');15/**16 * Actor code17 */18
19// Gracefully exit the Actor process. It's recommended to quit all Actors with an exit()20await Actor.exit();Start a new web scraping project quickly and easily in TypeScript (Node.js) with our empty project template. It provides a basic structure for the Actor with Apify SDK and allows you to easily add your own functionality.
Insert your own code between await Actor.init() and await Actor.exit(). If you would like to use the Crawlee library simply uncomment its import import { CheerioCrawler } from '@crawlee/cheerio';.
- TypeScript vs. JavaScript: which to use for web scraping?
- Node.js tutorials in Academy
- Video guide on getting scraped data using Apify API
- Integration with Airbyte , Make, Zapier, Google Drive, and other apps
- A short guide on how to build web scrapers using code templates:
TypeScript site crawler (Crawlee + Cheerio)
A fast crawler that follows links and gets data from static pages, with Crawlee handling retries, queues, and proxies. Good for blogs, news, or product listings, but it can't run client-side JavaScript.
TypeScript one-page scraper (Cheerio)
A scraper that gets data from one web page with Cheerio. The simplest way to start scraping.
TypeScript browser crawler (Crawlee + Puppeteer + Chrome)
A browser crawler that renders JavaScript in headless Chrome, with Crawlee handling retries, queues, and proxies. Good for social feeds, dashboards, or single-page apps.
TypeScript browser crawler (Crawlee + Playwright + Chrome)
A browser crawler that renders JavaScript, with Crawlee handling retries, queues, and proxies. Good for social feeds, dashboards, or single-page apps.
TypeScript stealth crawler (Crawlee + Playwright + Camoufox)
A browser crawler built to get past bot protection. Uses Camoufox, a Firefox build that looks like a real user.
TypeScript test runner (Playwright)
An automated browser test runner with results you can access via API.