Scrape and store data from multiple website pages
Needs changesWhat this workflow does
This workflow has 23 nodes and runs manually, when you click “Execute workflow”. Along the way it connects MongoDB and uProc. It also calls theswiftcodes.com over HTTP.
How it runs
Trigger: Manually, when you click “Execute workflow”.
- Create Directory (Execute Command): runs a shell command on the n8n host
- HTTP Request: calls theswiftcodes.com
- HTML Extract: uses HTML Extract
- Prepare countries (Function): runs custom JavaScript (legacy Function node)
- SplitInBatches (Loop Over Items (Split in Batches)): loops over the items in batches
- uProc: uses uProc
- Set Page to Scrape (Function Item): runs custom JavaScript per item (legacy Function Item node)
- Set (Edit Fields (Set)): sets or maps fields
- Generate filename (Function Item): runs custom JavaScript per item (legacy Function Item node)
- Read Binary File: uses Read Binary File
…plus 12 more steps. See the full node list below.
Services it uses
HTTP calls to: theswiftcodes.com
Scraping pages by hand? Firecrawl is a simpler option (10% off for new users).
Before you upgrade to n8n 3.0
5 things in this workflow are removed in n8n 3.0. Fix them before you upgrade:
- HTML Extract in HTML Extract, HTML Extract1: replace with HTML node, 'Extract HTML Content' operation.
- Function (legacy) in Prepare Documents, Set More Pages, Wait…: replace with Code node, mode 'Run Once for All Items'.
- Function Item (legacy) in Set Page to Scrape, Generate filename: replace with Code node, mode 'Run Once for Each Item'.
- Read Binary File in Read Binary File, Read Binary File1: replace with Read/Write Files from Disk.
- Write Binary File: replace with Read/Write Files from Disk.
Rather not rewrite it? Many of these flows can be rebuilt in Make (free plan).
| Removed in 3.0 | Replace with |
|---|---|
| HTML Extract HTML Extract, HTML Extract1 | HTML node, 'Extract HTML Content' operation |
| Function (legacy) Prepare Documents, Set More Pages, Wait, Prepare countries | Code node, mode 'Run Once for All Items' |
| Function Item (legacy) Set Page to Scrape, Generate filename | Code node, mode 'Run Once for Each Item' |
| Read Binary File Read Binary File, Read Binary File1 | Read/Write Files from Disk |
| Write Binary File Write Binary File | Read/Write Files from Disk |
Nodes used (13)
- Manual Trigger
n8n-nodes-base.manualTrigger - HTTP Request
n8n-nodes-base.httpRequest - HTML Extract
n8n-nodes-base.htmlExtract - Loop Over Items (Split in Batches)
n8n-nodes-base.splitInBatches - MongoDB
n8n-nodes-base.mongoDb - uProc
n8n-nodes-base.uproc - Function
n8n-nodes-base.function - If
n8n-nodes-base.if - Function Item
n8n-nodes-base.functionItem - Edit Fields (Set)
n8n-nodes-base.set - Read Binary File
n8n-nodes-base.readBinaryFile - Write Binary File
n8n-nodes-base.writeBinaryFile - Execute Command
n8n-nodes-base.executeCommand
From the author
This workflow allows extracting data from multiple pages website. The workflow: 1) Starts in a country list at https://www.theswiftcodes.com/browse-by-country/. 2) Loads every country page 3) Paginates every page in the country page. 4) Extracts data from the…