This guide shows how to feed values into a script, read a page well, get past blocks, and log in. Read Scraping basics first.
Contents: Dynamic parameters · CSS selectors · Proxy tiers · API integration · Account credentials
Dynamic parameters
Parameters put values into your script at run time, so you don't edit the code to change them. Each one becomes TRAWL.<name> in the script:
How to set them, store several sets (scenarios), use the DATE() and RANDOM() helpers, and run with values of your own from your code: Parameters.
await page.goto(`https://news.ycombinator.com/search?q=${TRAWL.query}`, { waitUntil: 'domcontentloaded' });// A list
const items = await page.$$eval('ul.results li', els =>
els.map(el => ({
title: el.querySelector('h2')?.textContent.trim(),
price: el.querySelector('.price')?.textContent.trim(),
url: el.querySelector('a')?.href,
}))
);
// A single element
const heading = await page.$eval('h1.main-title', el => el.textContent.trim());
returnData(items);await page.waitForSelector('.results-list', { timeout: 8000 });Proxy tiers
When a site blocks a run, Trawl moves the scrap up to a stronger proxy tier and keeps it there. The tier column in the Run tab shows the tier of each run.
| Tier | Use case |
|---|---|
tier0 |
No proxy (default) |
tier1 |
Home IPs, for basic bot checks |
tier2 |
Mobile network IPs, for stricter sites |
tier3 |
Premium rotating proxies, for well-protected sites |
tier4 |
A premium scraping browser on home IPs, for the hardest sites |
A higher tier costs more per run.
API integration
Every scrap can be run from your code. The call and its answer, in curl, JavaScript and Python: Quickstart. With values of your own: Parameters. Keys, scopes, and the routes that list scraps and runs: API keys. The API card on the scrap page also shows a ready curl call.
Account credentials
A scrap that needs a login reads its stored account in the script as TRAWL.account.username, TRAWL.account.password and TRAWL.account.session. Trawl puts a saved session back on the browser before your script starts, so the script only logs in when the page is not logged in yet. How to store an account or a session, and the script to use: Account & sessions.
See also: Scraping · Parameters · Account & sessions
Next step → Parameters