Skip to content

Responsible Use

PAM Crawl can fetch hundreds of pages per second. That speed is meant for your own sites, public data you are allowed to use, and polite crawls of the open web, not for overwhelming servers or collecting data you have no right to. This page collects the practices we recommend and the settings that implement them. It is not legal advice: the rules that apply to you depend on your jurisdiction, the sites you visit and what you do with the data.

  • Respect robots.txt.
  • Keep per-host concurrency low and add a delay on small sites.
  • Identify your crawler when you crawl regularly.
  • Read and follow each site’s terms of service.
  • Collect only the data you need, and handle personal data lawfully.
  • Never use PAM Crawl to bypass logins, paywalls, CAPTCHAs or other access controls.

robots.txt is how a site tells crawlers what they may fetch. Crawl::site() respects it by default; turn it on for other crawls:

crawl.php
use Pam\Crawl\Crawl;
Crawl::urls($urls)->respectRobots()->all();
Terminal window
pam crawl https://example.com --robots -o md

PAM Crawl honours Allow, Disallow and Crawl-delay. Only turn robots.txt off (respectRobots(false)) for sites you own or have explicit permission to crawl.

Every request costs the site’s operator CPU, bandwidth and sometimes money. Plan your crawl so it would be unremarkable in their logs:

Crawl::site('https://small-blog.example.com')
->concurrency(4, perHost: 1)
->delay(2.0)
->cache() // never download the same page twice
->limit(200)
->each(fn ($page) => null);
  • Per host, not total. The total concurrency can be high when you crawl many sites; the per-host limit is what each site feels.
  • Back off when asked. PAM Crawl slows a host down automatically on 429 and 503 and honours Retry-After. Do not work around it with more proxies.
  • Cache and revalidate. cache() serves fresh pages locally and revalidates stale ones with conditional requests, so repeat runs cost the site almost nothing.
  • Mind the browser. Rendering a page in a browser loads its scripts, styles and images. With the browser plugin, prefer ->render() (only pages that need it) over ->browser() (every page).

See Caching & Politeness for every setting.

The default user agent looks like a desktop browser so that sites serve their normal HTML. For scheduled or large crawls, use a descriptive user agent with a way to reach you:

Crawl::site('https://docs.example.com')
->userAgent('AcmeBot/1.0 (+https://example.com/bot)');

Operators can then contact you, and their robots.txt rules for AcmeBot apply to your crawler.

Many sites limit automated access or reuse of their content in their terms of service. Before you crawl a site regularly or reuse what you collect, check its terms and the licence of the content. Prefer an official API or data export when one exists. Remember that copyright still applies to content you can read publicly, including when you use it to build datasets or LLM indexes.

Pages often contain names, e-mail addresses, photos and other personal data. Laws such as the GDPR and Brazil’s LGPD apply to collecting and storing it, even when it is public.

  • Collect only the fields you need. Typed extraction (#[Css], #[JsonLd]) makes it easy to take exactly that and nothing else.
  • Do not build profiles of people, and do not combine sources to identify them.
  • Store crawled data securely, set a retention period and delete what you no longer need.
  • Do not send personal data to an LLM provider unless you are allowed to share it with them. Local models keep the data on your machine.

PAM Crawl can keep cookies (session()), use logged-in browser profiles, rotate proxies and user agents, and retry pages blocked by bot walls. Use these for accounts and sites you are allowed to access, for example your own dashboards or a partner’s site under an agreement.

If you expose the HTTP API or the MCP server to other people, you are responsible for what they crawl through it:

  • Require a token (CRAWL_API_TOKEN) and keep the SSRF guard on (do not set CRAWL_ALLOW_PRIVATE).
  • Keep the request limits (CRAWL_MAX_PAGES, CRAWL_MAX_CONCURRENCY, CRAWL_DEADLINE) modest.
  • Restrict targets with CRAWL_ALLOWED_HOSTS or CRAWL_BLOCKED_HOSTS when you can.
  • Log who requested what, and respond to abuse reports.

This product includes software developed by UncleCode (https://x.com/unclecode) as part of the Crawl4AI project (https://github.com/unclecode/crawl4ai).