By Alex Hammerschmied • 5. April 2023

Copy this code and paste it into your n8n workflow:

{
"meta": {
"instanceId": "b3da871dc331c5efce1f19328dbf7b86d2350257e2cd271d635d3a754decb4dd"
},
"nodes": [
{
"parameters": {},
"id": "da3ef08b-91a6-407c-84be-95ef88a68202",
"name": "Start",
"type": "n8n-nodes-base.start",
"typeVersion": 1,
"position": [
260,
920
]
},
{
"parameters": {
"authentication": "oAuth2",
"sheetId": "={{$node[\"Parameters\"].json[\"googleSheetsID\"]}}",
"range": "A:B",
"options": {}
},
"name": "Google Sheets",
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 1,
"position": [
860,
920
],
"id": "d62937b8-6a95-4fb2-a08c-0bee716f6308",
"credentials": {
"googleSheetsOAuth2Api": {
"id": "62",
"name": "Google Sheets account 2"
}
}
},
{
"parameters": {
"batchSize": 1,
"options": {
"reset": false
}
},
"name": "SplitInBatches",
"type": "n8n-nodes-base.splitInBatches",
"typeVersion": 1,
"position": [
1020,
920
],
"id": "9363d6d7-0be1-405b-a55b-973ec6342f1d"
},
{
"parameters": {
"authentication": "oAuth2",
"operation": "append",
"sheetId": "={{$node[\"Parameters\"].json[\"googleSheetsID\"]}}",
"range": "scraped!A:F",
"options": {}
},
"name": "Google Sheets1",
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 1,
"position": [
2140,
920
],
"id": "8c4343b2-e615-4143-bc2b-9055cac7b3d9",
"credentials": {
"googleSheetsOAuth2Api": {
"id": "62",
"name": "Google Sheets account 2"
}
}
},
{
"parameters": {
"url": "={{$node[\"SanitizeDomain\"].json[\"domainClean\"]}}/{{$node[\"Parameters\"].json[\"link\"]}}",
"responseFormat": "string",
"options": {
"fullResponse": true
}
},
"name": "scrape1",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 1,
"position": [
1340,
920
],
"alwaysOutputData": true,
"id": "c854d578-7a01-4e1a-88ed-7d25317f7f32",
"continueOnFail": true
},
{
"parameters": {
"functionCode": "items[0].json.dataNew = items[0].json.data || \"no data no nothing.\"\nreturn items;"
},
"name": "data1",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
1500,
920
],
"alwaysOutputData": false,
"id": "b873ab44-06df-4bbf-af6c-e3c5d7fd0762"
},
{
"parameters": {
"keepOnlySet": true,
"values": {
"string": [
{
"name": "domain",
"value": "={{$node[\"SanitizeDomain\"].json[\"domainClean\"]}}/{{$node[\"Parameters\"].json[\"link\"]}}"
},
{
"name": "email1",
"value": "={{$node[\"exctract emails\"].json[\"uniqueScrapedEmail\"][1]}}"
},
{
"name": "email2",
"value": "={{$node[\"exctract emails\"].json[\"uniqueScrapedEmail\"][2]}}"
},
{
"name": "email3",
"value": "={{$node[\"exctract emails\"].json[\"uniqueScrapedEmail\"][3]}}"
},
{
"name": "email4",
"value": "={{$node[\"exctract emails\"].json[\"uniqueScrapedEmail\"][4]}}"
},
{
"name": "email5",
"value": "={{$node[\"exctract emails\"].json[\"uniqueScrapedEmail\"][5]}}"
},
{
"name": "scraped",
"value": "yes"
}
]
},
"options": {}
},
"name": "Set",
"type": "n8n-nodes-base.set",
"typeVersion": 1,
"position": [
1980,
920
],
"id": "634cfb40-bfee-480a-804a-753ad954eb65"
},
{
"parameters": {
"dataPropertyName": "dataNew",
"extractionValues": {
"values": [
{
"key": "key",
"cssSelector": "p,spar",
"returnArray": true
}
]
},
"options": {
"trimValues": true
}
},
"name": "HTML Extract1",
"type": "n8n-nodes-base.htmlExtract",
"typeVersion": 1,
"position": [
1660,
920
],
"id": "0a9bce60-3f81-4007-a41f-198ef0173ae7"
},
{
"parameters": {
"functionCode": "var arr = [\"thisisnoemail\"];\nvar emailsString1 = $node[\"HTML Extract1\"].json[\"key\"].join(', ');\nvar emails1 = emailsString1.match(/([\\w-\\.]+)@((?:[\\w]+\\.)+)([a-zA-Z]{2,4})/g);\nvar arrEmail = arr.concat(emails1);\nvar newArr = [...new Set(arrEmail)];\nvar filtered = newArr.filter(function (el) {\n return el != null;\n});\n\n//items[0].json.uniqueScrapedEmail = [...new Set(arrEmail)];\nitems[0].json.uniqueScrapedEmail = filtered;\n\nreturn items;"
},
"name": "exctract emails",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
1820,
920
],
"alwaysOutputData": true,
"id": "75541329-7e1c-4320-bb0c-8be54a06d5b3",
"continueOnFail": true
},
{
"parameters": {
"authentication": "oAuth2",
"operation": "update",
"sheetId": "={{$node[\"Parameters\"].json[\"googleSheetsID\"]}}",
"range": "A:B",
"key": "domain",
"options": {}
},
"name": "Google Sheets2",
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 1,
"position": [
2460,
920
],
"id": "bfc24821-5d30-4b9a-a427-a8ccc7507427",
"credentials": {
"googleSheetsOAuth2Api": {
"id": "62",
"name": "Google Sheets account 2"
}
}
},
{
"parameters": {
"keepOnlySet": true,
"values": {
"string": [
{
"name": "domain",
"value": "={{$node[\"SplitInBatches\"].json[\"domain\"]}}"
},
{
"name": "scraped",
"value": "yes"
}
]
},
"options": {}
},
"name": "Set1",
"type": "n8n-nodes-base.set",
"typeVersion": 1,
"position": [
2300,
920
],
"id": "933b94f1-8ceb-4b44-a348-aea6998e2d7e"
},
{
"parameters": {
"content": "## Change Data here:",
"height": 196.61714285714288,
"width": 252.2057142857143
},
"id": "c4ab1977-11a8-4fec-b77e-f127c997b0f4",
"name": "Note",
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
580,
860
]
},
{
"parameters": {
"content": "# Email Scraper V1.0 \nbrought to you by:\n## Automate This!\nsupport us and subscribe to our youtube channel:\n# [subscribe on youtube ](https://www.youtube.com/channel/UCC1wOJNvFbM1Jfa2Wvsy24A)",
"height": 228.6571428571429,
"width": 503.94857142857154
},
"id": "ba896575-5c70-4093-9aeb-cdfec625c302",
"name": "Note1",
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
580,
340
]
},
{
"parameters": {
"content": "# How to use:\n1) Change the permalink you want to scrape for each domain\n2) Change the Google Sheets ID inside all Google Sheet nodes\n3) Insert your domainlist into the Google Sheet\n4) Execute Workflow",
"height": 241.36125000000015,
"width": 250.68
},
"id": "a6b980f4-3077-43d5-adae-d5f953b89c24",
"name": "Note2",
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
580,
600
]
},
{
"parameters": {
"keepOnlySet": true,
"values": {
"string": [
{
"name": "link",
"value": "privacypolicy"
},
{
"name": "googleSheetsID"
}
]
},
"options": {}
},
"id": "93729c06-37ab-457d-b0f0-b38e4eed1956",
"name": "Parameters",
"type": "n8n-nodes-base.set",
"typeVersion": 1,
"position": [
660,
920
]
},
{
"parameters": {
"functionCode": "// Code here will run only once, no matter how many input items there are.\n// More info and help: https://docs.n8n.io/nodes/n8n-nodes-base.function\n// Tip: You can use luxon for dates and $jmespath for querying JSON structures\n\n// Loop over inputs and add a new field called 'myNewField' to the JSON of each one\nvar domain = items[0].json.domain;\nvar domain2 = domain.replace(/\\/$/, '');\n\nitems[0].json.domainClean = domain2;\nreturn items;"
},
"name": "SanitizeDomain",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
1180,
920
],
"id": "7506abe7-1f47-49d5-af64-7988a1c48d12"
}
],
"connections": {
"Start": {
"main": [
[
{
"node": "Parameters",
"type": "main",
"index": 0
}
]
]
},
"Google Sheets": {
"main": [
[
{
"node": "SplitInBatches",
"type": "main",
"index": 0
}
]
]
},
"SplitInBatches": {
"main": [
[
{
"node": "SanitizeDomain",
"type": "main",
"index": 0
}
]
]
},
"Google Sheets1": {
"main": [
[
{
"node": "Set1",
"type": "main",
"index": 0
}
]
]
},
"scrape1": {
"main": [
[
{
"node": "data1",
"type": "main",
"index": 0
}
]
]
},
"data1": {
"main": [
[
{
"node": "HTML Extract1",
"type": "main",
"index": 0
}
]
]
},
"Set": {
"main": [
[
{
"node": "Google Sheets1",
"type": "main",
"index": 0
}
]
]
},
"HTML Extract1": {
"main": [
[
{
"node": "exctract emails",
"type": "main",
"index": 0
}
]
]
},
"exctract emails": {
"main": [
[
{
"node": "Set",
"type": "main",
"index": 0
}
]
]
},
"Google Sheets2": {
"main": [
[
{
"node": "SplitInBatches",
"type": "main",
"index": 0
}
]
]
},
"Set1": {
"main": [
[
{
"node": "Google Sheets2",
"type": "main",
"index": 0
}
]
]
},
"Parameters": {
"main": [
[
{
"node": "Google Sheets",
"type": "main",
"index": 0
}
]
]
},
"SanitizeDomain": {
"main": [
[
{
"node": "scrape1",
"type": "main",
"index": 0
}
]
]
}
}
}

And make a copy of this google sheet:

What do you think about this?

Your email address will not be published. Required fields are marked

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}