How do I keep a scraper working when a page changes or goes down?

Published 2026-12-03 · Updated 2026-12-03

Save a raw snapshot before parsing, validate required fields, and keep the last good result when the fetch or parse fails. Report site downtime separately from a layout change. When the layout changes, repair the parser against the saved snapshot and run it once before resuming the schedule.

The problem

A page you scrape is outside your control. The site owner can change the layout or take the page down without warning. Two failures matter most: the page layout changes, or the site goes down.

A rental search is a realistic example. New listings appear and disappear quickly, built-in alerts may not cover every filter, and checking every hour can reveal a place before it is gone. It is also a page that can change its layout or become unavailable.

The worst outcome is not a failed run. It is a successful run that writes empty or wrong data over the last good result.

Failure How to detect it What to do
Site down Non-2xx response or timeout Alert as downtime and keep the last good result
Layout changed A required field or selector is missing Save the snapshot, alert, and repair the parser
Data shape changed Validation or a type check fails Reject the result and alert
Wrong but plausible data A range, count, or cross-check fails Keep the previous value and alert
JavaScript or anti-bot Empty page, challenge page, or 403 Use a scraping service

The usual options

Option Good fit The friction
Direct fetch Static HTML, APIs, or feeds Breaks when the page needs rendering or anti-bot handling
Scraping service JavaScript-rendered pages, proxies, anti-bot, repeated scraping Cost and vendor dependency, but a stable HTTP interface
Browser automation Complex interactive pages More infrastructure and maintenance
Official API or feed The site provides one The best option when it covers your filters

For most scraping jobs, start with a scraping service. Use direct fetch only when the page is static or you are calling an API. The docs show the service pattern in Scrape a Page With a Service.

How GearTrain solves it

GearTrain does not include a scraper or a browser. It gives you a scheduled JavaScript job where you can implement the reliability pattern that fits the page. An agent can help write and repair that job.

If you use a scraping service, it handles rendering, proxies, and anti-bot behavior. The job handles the parsing and reliability rules.

What the job can do:

  • Call an external scraping service with an API key stored as a secret.
  • Save the raw response before parsing.
  • Extract fields with fallbacks: structured data, semantic elements, stable attributes, then text extraction.
  • Validate required fields, types, ranges, and item counts.
  • Keep the last good result and never overwrite it when a fetch or parse fails.
  • Compare listing IDs with the previous run so the same listing does not alert twice.
  • Report site downtime separately from a parser failure.
  • Leave enough context in the run log to repair the parser.

What GearTrain provides around it:

  • A schedule or webhook trigger.
  • Secrets for API keys and webhooks.
  • Persistent files for snapshots and seen IDs.
  • A console and run history.
  • Failure notifications.
  • An MCP connection so an agent can inspect the failure and propose a fix.

A run that cannot validate its data should fail visibly. That is better than writing an empty list or a wrong price.

What it looks like in practice

Connect your agent to GearTrain over MCP, then give it a request like this. The agent creates the script and job; you decide the behavior you want.

Prompt for your agent

Every hour, check the rental search for new two-bedroom listings under $2,200
in Riverside. Use ScrapingBee to render the page and return the HTML. Save the
raw response to /data/rentals/latest.html, extract each listing's ID, address,
price, bedrooms, and URL, and validate that each listing has all five fields.

Compare the IDs with /data/rentals/seen.json and post only new listings to
Slack.

If the request fails, do not overwrite the seen list. Tell me whether the site
was unavailable or the page could not be parsed. If the layout changed, keep
the snapshot and show me which field failed.

The outcome is a scheduled job, a raw snapshot, a normalized list of listings, a seen-ID file, and a Slack message only for new matches. A failed fetch and a failed parse produce different alerts, so you know whether to wait for the site or repair the parser.

Scraping is not built into GearTrain. The job calls an external scraping service such as ScrapingBee. You need an account and an API key, which you store as a secret. Another service with an HTTP API works the same way.

When GearTrain is not the right fit

Some of these mean using GearTrain differently. Others mean using a different tool for the job.

Use GearTrain differently:

  • The site offers an API, feed, or export. Call it from the job instead of scraping.
  • The page is JavaScript-rendered or protected by anti-bot checks. Use a scraping service and call it from the job.
  • You need to scrape thousands of pages per run. Use a dedicated scraping pipeline, then validate and alert through GearTrain.
  • The page needs heavy parsing or packages. Use a service or container for the processing.

Use a different tool instead:

  • You need continuous, real-time monitoring. Use a dedicated monitoring service.
  • You need an interactive browser session that cannot be delegated to an HTTP scraping service. Use a browser automation platform.
  • The site’s terms or robots policy prohibit automated access. Do not scrape it.
  • You need guaranteed uptime or response-time monitoring. Use an uptime service.

The same reliability pattern applies to mortgage rates, flight fares, and competitor prices. The details change; the need to separate downtime from a changed page does not.

Ready to run it?