Scheduled web scraping: run a scraper on a cron schedule and get a webhook when it is done
Set up scheduled web scraping with a pipeline: a 5-field cron in your timezone, per-run and daily caps, skipped runs, and a signed webhook at the end.
- Published
- Reading time
- 9 min read
- By
- ExtractHub team
- pipelines
- scheduled scraping
- cron
- webhooks
- tutorial
On this page
A scraper you run by hand gives you one snapshot. Price tracking, stock checks, new listings and rankings all need the same pages scraped again tomorrow and the day after, at a known time, with the results landing somewhere without you starting anything. That is scheduled web scraping: a cron expression decides when, the scraper runs on its own, and a webhook tells your system that new data is ready.
This post shows how to set it up with an ExtractHub pipeline: the schedule fields, how the cron and the timezone are read, the limits that keep a schedule from spending more than you planned, the cases where a run is skipped, and the webhook that closes the loop.
What a scheduled scrape is made of
A schedule belongs to a pipeline, a chain of released extractors with saved start URLs. Even a single extractor on a fixed list of pages is a one-step pipeline. If you have not built one yet, the list and detail pipeline post walks through it; this post starts from a pipeline that already runs correctly by hand.
A scheduled run is the same job as a manual one. Each time the cron matches, the scheduler creates a job with trigger type scheduled and the pipeline’s saved start URLs. From there it goes through the normal path: it waits in the queue for a free run slot, holds credit for its estimate, runs every step, writes the dataset and sends the webhook. Nothing about the steps, the pins or the charging changes because a clock started the run instead of you.
That gives you three things to set:
- The start URLs the scheduled runs use. A schedule cannot pass URLs at run time, so they must be saved on the pipeline.
- The schedule: a cron expression, a timezone and an on / off switch.
- The limits and the webhook: how much one run may cost, how many runs a day are allowed, and where to send the result.
Set up scheduled web scraping with cron
The schedule is three fields. With the MCP server connected, an agent sets them with update_pipeline (or create_pipeline for a new one). An illustrative example that runs every weekday at 06:00 Paris time on two category pages of example.com:
{
"pipeline_id": "<pipeline_id>",
"input_urls": [
"https://www.example.com/category/laptops",
"https://www.example.com/category/monitors"
],
"limits": { "maxCostPerRun": 2, "maxRunsPerDay": 2 },
"schedule": {
"cronExpression": "0 6 * * 1-5",
"timezone": "Europe/Paris",
"isActive": true
}
}
In the dashboard, the pipeline builder has the same settings in its Schedule panel, with presets such as “Every 6 hours” or “Daily at 9 AM” and a field for a custom expression.
The schedule is off until you switch it on
isActive defaults to false. A schedule saved without isActive: true is stored but never fires, and get_pipeline shows nextScheduledAt: null. This is on purpose: every scheduled run spends credit without anyone starting it, so turning one on has to be an explicit choice.
One consequence trips people up. On update_pipeline, any schedule object without isActive: true turns the schedule off. To change only the time of an active schedule, send the new cronExpression together with isActive: true again.
When the schedule is on, the save computes the first run (the next cron match after the save) and get_pipeline returns it as nextScheduledAt. Check that value after every change: it is the quickest way to see that the cron means what you think.
Reading the cron expression
The expression has five fields, in this order:
┌ minute 0-59
│ ┌ hour 0-23
│ │ ┌ day of month 1-31
│ │ │ ┌ month 1-12 or JAN-DEC
│ │ │ │ ┌ day of week 0-7 or SUN-SAT (0 and 7 are Sunday)
0 6 * * 1-5
Each field takes *, a number, a range (1-5), a list (1,15) or a step (*/6, 8-18/2). Some common ones:
| Expression | Runs |
|---|---|
0 6 * * * | every day at 06:00 |
0 */6 * * * | every 6 hours, on the hour |
30 8 * * MON-FRI | weekdays at 08:30 |
0 0 1 * * | the 1st of every month at midnight |
15 9,17 * * * | every day at 09:15 and 17:15 |
An expression with the wrong number of fields, a value out of range or an unknown timezone is rejected when you save it, with an invalid_schedule error that says what is wrong. So is an expression that never matches a date, such as 0 0 31 2 * (February 31).
Day of month and day of week together
When both day fields are restricted, a day matches if either one matches. That is the standard cron rule, and it surprises almost everyone the first time: 0 6 1 * MON runs on the 1st of the month and on every Monday, not only on Mondays that fall on the 1st. If you want one of them, leave the other as *.
Timezones and daylight saving
The cron runs on the wall clock of the saved timezone, an IANA name such as UTC, Europe/Paris or America/New_York (default UTC). 0 6 * * * in Europe/Paris means 06:00 in Paris all year, so the run moves by an hour in UTC when the clocks change.
Two edge cases come from daylight saving:
- A skipped hour never fires. When the clocks jump forward, a time inside the gap does not exist that day.
30 2 * * *inEurope/Parisdoes not run on the last Sunday of March. - A repeated hour fires once. When the clocks go back, the same local time happens twice; the run fires on the first one only.
If your job must run at a fixed interval no matter what, use UTC. If it must match local business hours, use the local zone and avoid times between 01:00 and 03:00.
Limits that keep scheduled scraping in budget
A schedule multiplies the cost of one run by the number of runs. 0 */6 * * * is 4 runs a day, about 120 a month, so work out the cost of one run before you switch it on. The realistic cost is what a manual test run actually cost (actual_cost_usd in get_pipeline_job), not the upfront estimate, which counts one call per step and cannot know how many links a list page fans out to. The price of each tier is on the pricing section.
Three limits apply to every scheduled run:
maxCostPerRun(USD, default 1) caps one run. When a stage would go over it, the run stops with statuscost_limit_exceeded; what already ran is charged and the partial results are kept.maxRunsPerDay(default 10) caps how often the scheduler may start the pipeline. It counts every job of the pipeline created in the last 24 hours, manual and MCP runs included, so a few test runs in the afternoon can use up the evening’s scheduled slot.- Your concurrent run slots. A scheduled job starts as
queuedand is promoted when one of your slots is free. If yesterday’s run is still going, today’s waits for it instead of running beside it.
When a scheduled run is skipped
At each match the scheduler checks the pipeline before it creates a job. It skips that run, creates no job and moves nextScheduledAt to the following match when:
maxRunsPerDayis already reached for the last 24 hours;- your credit balance is below the pipeline’s
maxCostPerRun; - the pipeline flow is not runnable (for example no extractor connected to the output);
- the pipeline has no saved start URLs.
A skipped run is not replayed later, and neither is a match that passed while the pipeline was switched off: when you switch a pipeline back on (is_active: true) or change its schedule, the next run is computed from that moment. If a scheduled run did not happen, check those four conditions first. A run that was created but could not hold its estimate when it started ends as failed with an insufficient balance message.
is_active: false on the pipeline itself stops everything, manual and scheduled runs alike. Use it to pause a pipeline without losing its schedule.
Get a webhook when the run ends
A schedule is only useful if something reads the data. Polling get_pipeline_job works, but a webhook tells you the moment a run ends. Add it to the pipeline:
{
"pipeline_id": "<pipeline_id>",
"webhook": { "url": "https://hooks.example.com/extracthub", "events": ["completed", "failed"] }
}
The URL must use https and a public host (no localhost, private addresses or credentials in the URL), and redirects are not followed. The events you can rely on are started, completed and failed; the default is completed and failed. Each delivery is a JSON body like this (illustrative values):
{
"event": "completed",
"pipelineId": "<pipeline_id>",
"jobId": "<job_id>",
"timestamp": "2026-11-26T05:03:12.000Z",
"data": {
"status": "completed",
"actualCost": 0.42,
"duration": 183000,
"totalSteps": 2,
"datasetId": "<dataset_id>"
}
}
A failed event carries data.status (failed, cancelled or cost_limit_exceeded), an errorMessage, the cost so far and the number of completed steps. No payload contains the scraped records: on a completed event, call get_pipeline_job with the jobId to get the first records inline and a signed download link for the full dataset.
Check the signature
Set a webhook secret in the dashboard pipeline builder (it is never set or shown through MCP; get_pipeline only reports secret_set). Deliveries then carry X-Webhook-Signature: sha256=<hex>, an HMAC-SHA256 of the raw body keyed with that secret. A minimal Node.js check:
import { createHmac, timingSafeEqual } from "node:crypto";
export function isValidPipelineWebhook(rawBody, header, secret) {
if (!header?.startsWith("sha256=")) return false;
const expected = createHmac("sha256", secret).update(rawBody).digest("hex");
const received = header.slice("sha256=".length);
return received.length === expected.length &&
timingSafeEqual(Buffer.from(received), Buffer.from(expected));
}
This signature has no timestamp, so store the jobId of every event you processed and ignore repeats. The webhook signature post covers raw bodies, constant-time compares and the timestamped format used by batches and jobs.
Each event is sent once, with a timeout. Answer quickly with a 2xx and do the work afterwards; if your endpoint was down, open the pipeline’s jobs in the dashboard and catch up from there instead of waiting for a resend.
A safe rollout order
- Run the pipeline by hand on its saved start URLs and check the records.
- Note
actual_cost_usdand multiply it by the runs per month the cron gives. - Set
maxCostPerRuna little above one run’s real cost andmaxRunsPerDayto what the cron needs plus room for manual tests. - Add the webhook and the secret, and test your endpoint with one manual run.
- Save the schedule with
isActive: trueand readnextScheduledAtback.
Scheduled runs use the extractor versions the steps pin. With a major pin such as @you/example-product@1, a selector fix released as a patch reaches the next scheduled run without touching the pipeline; the scraper monitoring post explains how health checks tell you that a fix is needed.
Let an agent set the schedule
The ExtractHub pipeline builder skill follows the same order. Install it in Claude Code:
git clone https://github.com/extracthub-io/extracthub-pipeline-builder ~/.claude/skills/extracthub-pipeline-builder
With the MCP server connected, ask for “this scrape every weekday at 6 in the morning, Paris time”. The skill runs a small test first, shows you the results and the real cost, states the cron in plain words with the cost per run and per month, and switches the schedule on only after you agree. Without that agreement it saves the schedule off and tells you how to turn it on. The agent skill page lists both skills.
FAQ
How do I schedule a web scraper to run every day?
Save the scraper as a pipeline with its start URLs, then set a schedule such as cronExpression "0 6 * * *" with a timezone and isActive true. The scheduler checks every minute and queues a run at each cron match.
Which timezone does a scheduled scrape use?
The timezone saved with the schedule, an IANA name such as UTC or Europe/Paris; the default is UTC. The cron runs on that zone's wall clock, so a daylight saving change moves the run in UTC, not in local time.
What happens if a scheduled run is still going when the next one is due?
The next run is still created, as a queued job. It starts when one of your concurrent run slots is free, so runs of the same pipeline wait for each other instead of overlapping past your limit.
Does a scheduled scrape run when my balance is low?
No. When your balance is below the pipeline's maxCostPerRun at the scheduled time, that run is skipped and no job is created. The schedule moves on to the next cron match.
How do I know when a scheduled scrape has finished?
Add a webhook URL to the pipeline. It receives a completed or failed event with the job id, the cost and the dataset id; you then read the records with get_pipeline_job or the dashboard.
Related
- Build a job listings scraper: list pages, JobPosting JSON and dedupe by URL: Build a job listings scraper that returns structured JSON: job URLs from list pages, JobPosting fields and ISO dates from each job page, and dedupe by URL.
- Build a price monitoring scraper: product fields, daily runs and change detection: Build a price monitoring scraper: a product extractor with typed prices, daily batch or scheduled runs, a signed webhook and change detection in your code.
- Use ready-made web scrapers instead of writing one: find, check and pin a public extractor: Use ready-made web scrapers instead of writing one: find a public extractor, read its fields, price tier and health, pin a version and call it with your key.
- Agent skill: install the extractor builder skill for Claude Code
- MCP server: connect Claude Code, Cursor or any MCP client
- API reference: realtime extract, async jobs and the Batch API
- Web scraper catalog: public extractors you can call today