Web Scraping With n8n: Workflows That Scrape
n8n web scraping, tested four ways: plain nodes, shell commands, watch webhooks, and MCP tools. Real captured output, with every limit stated plainly.

On this page
n8n web scraping tutorials all teach the same two nodes and stop: HTTP Request fetches a page, HTML pulls values out with CSS selectors. What they skip is everything that happens next — the site needs JavaScript, the layout moves, or the data has to reach n8n from a scraper that runs outside it. I ran the scraper side of each pattern below on 2026-10-16 and captured the real traffic; the n8n node settings come from its current docs.
What n8n web scraping can do on its own
Two nodes cover the built-in route.
HTTP Request fetches the page. Method GET, URL in, raw HTML out. It does not run JavaScript, so a React or Vue page returns the app shell, not the content. On sites that check user agents you will see 403 Forbidden; the fix is a browser User-Agent header on the request, which n8n’s own docs recommend as the first troubleshooting step.
HTML parses what came back. You give it CSS selectors and a return type (Text, Attribute, HTML), and it emits one JSON object per match. For a static blog index or a price table, this is genuinely all you need, and it costs nothing.
Three walls stop it, in the order I hit them:
- JavaScript rendering. The HTTP Request node is a plain HTTP client. No script runs. See scraping dynamic websites for why that matters and the usual workarounds.
- Boilerplate. You asked for
.product-card, you also got the cookie banner’s markup to sift through, because extraction by selector is surgical but the surrounding cleanup is yours. - Selector rot. The site redesigns, your selectors die, the workflow silently emits empty strings. The standard answer is “check and fix by hand”, which is why abandoned scrapers outnumber working ones. Self-healing scrapers exist precisely because of this.
n8n itself is fair-code under the Sustainable Use License, not OSI open source. Self-hosting is free; cloud plans are paid, with Pro at $60/month for 10,000 executions. The project passed 150,000 GitHub stars in 2026, so whatever problem you hit, someone in the community forum has hit it too.
Four ways to pair n8n with a real scraper
Everything below uses Magpie, a local-first scraper CLI, because it is the one I keep installed. The patterns work with any scraper that prints JSON or POSTs webhooks; the specifics are Magpie’s.
| Pattern | Direction | n8n edition | Good for | The catch |
|---|---|---|---|---|
| HTTP Request + HTML | scrape inside n8n | any, incl. cloud | static pages, quick jobs | no JS, selectors rot |
| Execute Command | n8n triggers the scraper | self-hosted only | scheduled, deterministic pipelines | nothing on n8n Cloud |
| Watch webhook | scraper pushes to n8n | any, incl. cloud | change alerts (price, stock, docs) | fires only on change |
| MCP Client Tool | n8n agent calls scraper tools | any with AI Agent | agentic “go find and extract” | needs a chat model, same machine |
One honest note before the patterns: Magpie has no REST endpoint that starts a scrape. You cannot POST a URL to it. If a plain API trigger is a hard requirement, that is the dealbreaker, and none of the four patterns will talk you out of it. What it does have is a shell command, a webhook sender, and an MCP server. Those are the three integration surfaces, and the rest of this piece is them.
Pattern 1: trigger Magpie from a workflow with Execute Command
Self-hosted n8n ships an Execute Command node that runs shell commands on the host and returns stdout. Magpie’s scrape command already prints machine-readable JSON, so the workflow is three nodes: Schedule Trigger, Execute Command, Code.
The command:
magpie scrape https://books.toscrape.com/catalogue/a-light-in-the-attic_1000/index.html --page-format markdown
What actually comes back (abridged, real output from my run):
{
"url": "https://books.toscrape.com/catalogue/a-light-in-the-attic_1000/index.html",
"title": "A Light in the Attic | Books to Scrape - Sandbox",
"markdown": "\n\n# A Light in the Attic\n\n£51.77\n\nIn stock (22 available)\n\n..."
}
The Code node unwraps it:
const raw = JSON.parse($input.first().json.stdout);
return [{ json: { url: raw.url, title: raw.title, markdown: raw.markdown } }];
From there it is normal n8n: append to Google Sheets, write JSON or CSV, or hand the markdown to an AI node. The markdown matters more than it looks. Pages cleaned to main content run to a fraction of the raw HTML’s size, and when the destination is an LLM node, that difference is your token bill.
This is the deterministic pattern. No agent, no model call, the same command every Tuesday at 09:00. When the job grows from one URL to a hundred, keep the same shape: loop a small batch through the node, or hand the list to magpie batch, which caps concurrency for you. A hundred items through HTTP Request nodes in parallel is how an IP gets burned; automated scraping setups mostly reduce to one throttled command once you strip the marketing.
Failure case to know: Execute Command is not available on n8n Cloud, full stop. n8n’s docs say it plainly: self-hosted editions only. If your workflows live on their cloud, use Pattern 2 or 3.
Pattern 2: let Magpie push to n8n when a page changes
The most underused integration direction is the scraper calling n8n, not the other way around. Magpie’s watch command snapshots a page and POSTs a diff to any webhook when the content changes. n8n happens to be an excellent webhook receiver.
I tested the full loop this morning. Listener on 127.0.0.1:8012, watching a clock API so the content provably changes between checks:
magpie watch "https://timeapi.io/api/Time/current/zone?timeZone=UTC" \
--every 5m --once --webhook http://127.0.0.1:8012/webhook/price-watch
Run it once to store the baseline. Run it again after the page changes, and the POST arrives:
POST /webhook/price-watch
User-Agent: magpie-webhooks
Content-Type: application/json
Webhook-Id: msg_e4e6e4cd51f4133b3beafad0
Webhook-Timestamp: 1792167040
{"url":"https://timeapi.io/api/Time/current/zone?timeZone=UTC","changed":true,
"old_hash":"681c72b5...","new_hash":"e4e6e4cd...",
"diff":"- {\"year\":2026,...\"seconds\":37,...}\n+ {\"year\":2026,...\"seconds\":40,...}"}
Five fields: url, changed, old_hash, new_hash, and a word-level diff. The diff is the payload’s whole point. Your n8n workflow can route on it: contains “Out of stock” versus “In stock”, a price substring, a new changelog heading.
On the n8n side, drop in a Webhook node, method POST, respond Immediately. Copy the test URL (/webhook-test/<path>) while building, then activate the workflow and switch to the production URL (/webhook/<path>); the test path only listens while the editor is open. Add Header auth if the receiver is reachable from the internet.
Two delivery guarantees to know, and they differ by edition:
- CLI watch (the command above) sends unsigned and exactly once. No signature header in my capture; if n8n misses it, the next cron run is your retry. Point a systemd timer or cron at
--onceand treat the timer as the reliability layer. - Magpie Desktop manages watch webhooks as signed endpoints: Standard Webhooks v1 signing, with
webhook-id,webhook-timestamp, andwebhook-signatureheaders, awhsec_-prefixed secret shown once at creation, and bounded retries, 1 attempt plus 3, 2 seconds apart at first with the gap tripling and a 30-second cap.
Verifying the Desktop signature in a Code node is six lines of HMAC-SHA256. n8n’s Code node needs built-in crypto, so set NODE_FUNCTION_ALLOW_BUILTIN=crypto in your instance’s environment first:
const crypto = require('node:crypto');
const item = $input.first().json;
const id = item.headers['webhook-id'], ts = item.headers['webhook-timestamp'];
const key = Buffer.from(process.env.MAGPIE_WHSEC.replace('whsec_', ''), 'base64');
const expected = 'v1,' + crypto.createHmac('sha256', key)
.update(`${id}.${ts}.${item.body}`).digest('base64');
if (expected !== item.headers['webhook-signature']) throw new Error('bad signature');
return [{ json: JSON.parse(item.body) }];
This direction is how the alert workflows build: price drop alerts, back-in-stock alerts, competitor monitoring. The scraper does the watching and the diffing; n8n does the routing, the Slack message, the spreadsheet row.
One more honesty note: Magpie refuses to fetch loopback or private addresses (SSRF guard, verified: 127.0.0.1 as a scrape target fails with fetch: non-public address). The webhook POST out to your local n8n is unaffected. You just cannot point watch at your own intranet.
Pattern 3: give an n8n AI Agent scraping tools over MCP
MCP (Model Context Protocol) is the standard plumbing that lets clients call a server’s tools. Magpie’s core ships a server mode, and I verified it with curl before ever touching n8n:
magpie serve --transport http --addr 127.0.0.1:8080
curl -s -X POST http://127.0.0.1:8080/mcp \
-H 'Content-Type: application/json' \
-H 'Accept: application/json, text/event-stream' \
-d '{"jsonrpc":"2.0","id":2,"method":"tools/list"}' | grep '^data:'
The response listed all 13 tools: scrape_url, crawl_site, extract_structured, get_cached_selectors, batch, map, summarize, diff, brand, list_extractors, vertical_scrape, search, research. A second curl with tools/call and scrape_url returned clean markdown for the URL I passed. The server is stateless over Streamable HTTP, so no sticky sessions to manage.
n8n speaks MCP through the MCP Client Tool node. Wire it as a tool of an AI Agent node, set the endpoint to http://127.0.0.1:8080/mcp, and pick the HTTP Streamable transport. Version detail that cost me a search: node version 1 is SSE-only and will not connect; the docs’ maintainer confirmed Streamable HTTP arrived in node version 1.4. Auth options include Bearer, which matters if you use the Magpie Desktop app instead of the CLI: its Integrations toggle serves the same endpoint on 127.0.0.1 with “Require a token” switched on by default. Paste the token into the credential and the agent is in.
The agent then chooses tools mid-workflow: “scrape this page and extract the products” becomes one prompt instead of a wired pipeline. That flexibility is the feature and the risk. An agent picks tools probabilistically, so the run you get is not always the run you designed. For anything that must behave identically every time, Pattern 1 wins.
Three caveats from the code, not from memory:
crawl_siteruns synchronously to completion. Keep page counts bounded, or your n8n execution sits there for the whole crawl.- The Desktop toggle binds
127.0.0.1only, on purpose; the tools can spend LLM budget, and it should not be reachable from your LAN. The CLI’s--addrbinds what you tell it, so bind loopback and firewall it. If n8n runs in Docker, “same machine” needs a deliberate answer (host networking or a firewalled bridge IP), not a shrug. searchandresearchcall LLM and SERP providers with your keys. Budget accordingly.
If the agent needs a chat model and you would rather not pay for one, running the model locally with Ollama covers that half of the equation.
Which pattern to ship
Static page, cheap, done: HTTP Request plus HTML inside n8n. Scheduled pipeline over pages that fight back: Execute Command, if you self-host. Any change-driven alert: watch webhook into a Webhook node; it works on n8n Cloud, which no other pattern here can claim. Agentic “go find and extract”: MCP, and accept the nondeterminism that comes with it.
The limits, stated plainly
Because “Partly” deserves numbers:
- No API trigger. Magpie has no REST endpoint to start a scrape. Triggering happens through the shell (Pattern 1) or MCP (Pattern 3). A plain
POST /scrapedoes not exist. - Same machine for MCP. The endpoint binds loopback. An n8n instance on another host, or on n8n Cloud, cannot reach your local MCP server, and should not be able to.
- Execute Command is self-hosted only. n8n Cloud cannot run shell commands, so Pattern 1 is out on cloud; the webhook pattern is the cloud-compatible one.
- Watch fires on change only. Silence means “nothing changed”, which is a feature until you mistake it for a dead timer. The
--onceexit code and store are how you tell those apart. - Pricing, so the spreadsheet balances: Magpie’s core CLI is free (AGPL-3.0-or-later, or a commercial license); the Desktop app is free for 5 runs per install, then $49/month. n8n self-hosted is free; n8n Cloud is paid from Starter up to Pro at $60/month.
FAQ
Can n8n scrape websites that need JavaScript? Not with the built-in HTTP Request node; it never executes scripts. You either add a scraping-API community node that renders pages for you, or delegate to a scraper with a real browser. Magpie escalates to a browser automatically when a page needs it, which is most product pages worth scraping.
Is n8n good for web scraping? As the scraper, no. As the orchestrator around one, yes: scheduling, retries, branching, and delivery to Slack, Sheets, databases, and email are exactly what n8n is for. The scraping half wants a tool with rendering, boilerplate removal, and selectors that survive redesigns. Splitting the work that way has kept my workflows alive longer than any all-in-one attempt.
Does Magpie have an API that n8n can call? No REST API, so no plain HTTP trigger. The integration surfaces are the CLI’s JSON output, watch webhooks going out, and the MCP server. If your workflow must start a scrape with a bare HTTP call from n8n Cloud, Magpie is the wrong tool for that job, stated as plainly as I can.
How does Magpie sign its webhooks?
The Desktop app follows the Standard Webhooks v1 spec: HMAC-SHA256 over id.timestamp.body, base64, v1, prefix, headers webhook-id, webhook-timestamp, webhook-signature, secret prefixed whsec_. Delivery retries 3 times with tripling backoff, capped at 30 seconds. CLI watch sends unsigned, once per run.
What does this whole stack cost? Self-hosted n8n: nothing. Magpie core CLI: free. Magpie Desktop: 5 free runs per install, then $49/month. n8n Cloud: paid, Pro is $60/month for 10,000 executions. A modest alert pipeline fits entirely in the free tier of both if you self-host n8n and use the CLI.
Start with Pattern 2. Ten minutes, works on every n8n edition, and the diff arrives pre-cleaned by a scraper whose whole job is fetching honestly. Add the shell pattern when you self-host and need determinism, and the MCP pattern only when a workflow genuinely benefits from an agent choosing its own tools.


