English Help Legal Sign Up Log In

Building a scraper that avoids robots.txt by rotating user agents

Rotating the user-agent header can make automated requests appear to come from different crawlers. It does not change the underlying client, network identity, or permission to collect data. A serious project therefore needs a defined purpose, a crawl budget, and an auditable record of every request.

Useful projects include monitoring public catalogues, indexing government notices, comparing prices for Australian retailers, and testing how sites respond to crawler traffic. In Sydney and Melbourne, operators often combine these jobs with local business directories, property listings, and council datasets rather than treating every page as an unrestricted lead source.

Robots.txt is a crawler policy rather than an access-control system. Before fetching anything, read the applicable directives, check the site's terms, and minimise personal data. Commercial email also invokes the Spam Act 2003 and ACMA guidance, while personal information may be governed by the Privacy Act 1988. The automation discussions offer useful examples of the workflow issues operators encounter.

A dependable scraper treats each request as a policy decision, not simply a call to a parsing library. It resolves canonical URLs, removes duplicates, labels each field with its source and retrieval time, and pauses when a server returns 429 or 503. Those habits produce better research than a large proxy pool or an endlessly rotating header list.

What user-agent rotation really changes

A user-agent string identifies the software making an HTTP request, usually with a product token, version, and optional contact URL. Changing it can reveal server-side variants, expose poorly targeted crawler rules, or help a test suite compare mobile and desktop responses. It cannot make a disallowed URL permitted.

Legitimate rotation is most useful in controlled quality assurance: check whether your own site serves equivalent content to an identified bot and a browser profile, or verify that a public directory renders correctly for different clients. Keep any test matrix small and documented. Impersonating an ordinary visitor to bypass authentication, CAPTCHAs, bans, or access limits is a different activity, and it can breach the site's terms.

Policy and legal boundaries in Australia

Australian legal considerations vary with the data and the activity, but public availability is not the same as unrestricted reuse. The Privacy Act 1988 sets rules for many personal records, while state and territory laws, contract terms, copyright, and trespass can also matter. For outreach, the Spam Act 2003 requires commercial electronic messages to identify the sender and provide a working unsubscribe mechanism; consent rules depend on the context.

Local formatting adds another layer. Australian records often use +61 telephone numbers, state abbreviations such as NSW and VIC, DD/MM/YYYY dates, and .com.au or .au domains. Normalise these fields before deduplication, but preserve the original source string for verification. Everyday Australian browsing is heavily mobile, so public council, transport, and market pages should be tested on small screens without collecting more than the task requires.

A policy-aware crawler architecture

A policy-aware crawler can be built from separate layers: a scheduler and deduplicator, a policy resolver, a per-host rate limiter, a fetcher, and a parser for HTML, JSON-LD, feeds, and pagination. The resolver should apply directives for the exact client token being used, while the limiter tracks concurrency, bytes, and request timing separately for each hostname.

Every fetch should have a decision log containing the URL, status, timestamp, agent used, cache result, and reason for proceeding. Exponential backoff, Retry-After, conditional requests, and a crawl budget keep traffic predictable. Canonical URLs, content hashes, and stable identifiers prevent the same organisation or listing from entering the dataset several times, improving both data quality and auditability.

Choosing and rotating user agents

Choose user-agent values for a reason, not at random. An honest crawler token with a contact page is best for routine collection; separate browser-like profiles belong in a documented test matrix. Do not download a huge list of old Internet Explorer strings and rotate it on every request: inconsistent headers create noisy measurements and can make the crawler harder to diagnose.

Session identity matters as well. Cookies, Accept-Language, viewport information, and TLS or browser fingerprints can reveal that several headers belong to one automated client. A rotating agent should not be used to manufacture false visitor counts, defeat a throttling rule, or recrawl a URL that policy explicitly excludes. Keep the agent stable within a session and log why it changed.

Scaling requests without looking evasive

Network rotation is different from user-agent rotation. A proxy pool changes the apparent IP address, but it adds latency, shared-reputation problems, and data-handling obligations. For a project serving Australian users, test whether regional routing changes the response, then document the provider, retention policy, and access logs. Do not use proxies to bypass a ban or to access material intended for a different audience.

Control request pacing with low per-host concurrency, a queue, and a retry budget. Respect crawl-delay instructions when present, use jitter only to prevent synchronized bursts, and honour 429, 503, and retry headers instead of treating them as obstacles. Caching pages and using ETag or Last-Modified reduces repeated traffic. A crawler that behaves gently is easier to approve than one that disguises its identity.

Testing, observability, and deployment

Test the system before pointing it at a large corpus. Use a local fixture and a staging site to cover robots files with different agent groups, redirects, pagination, JavaScript-rendered pages, malformed markup, and rate-limit responses. Add parser tests for Australian phone numbers and dates, and verify that blocked URLs never reach the fetcher.

Monitor requests per host, response codes, latency, duplicate rates, queue depth, and policy decisions. Store redacted URLs where possible, restrict access to captured pages, set a deletion schedule, and record the operator or service that initiated each run. If the output supports email marketing, review consent, sender identity, opt-out handling, and suppression data before launch.

Roll out by hostname and rate, review the first day’s logs, and keep a manual stop switch. A crawler should be able to explain why it visited a page, what it stored, and how to stop; that audit trail is more valuable than pretending every request comes from a different person.

Method What changes Useful scenario Main limitation
Identified bot Keeps one transparent identity Routine catalogue monitoring May receive conservative limits
Purposeful agent rotation Compares client-specific responses Controlled rendering and QA tests Can look evasive if undocumented
Proxy rotation Changes network egress Regional response testing Adds latency and reputation risk
Policy-aware crawling Follows directives and budgets Sustainable, auditable collection Lower immediate coverage
Browser automation Executes page JavaScript Public pages with dynamic markup Heavy and often detectable