How to set timeout to each loop? and how to continue looping if code is not 2XX?
I was checking response code for 140+ urls to find out 404 websites. But continually got
“Error: unable to verify the first certificate”
here is my workflow
{
"nodes": [
{
"parameters": {},
"name": "Start",
"type": "n8n-nodes-base.start",
"typeVersion": 1,
"position": [
280,
270
]
},
{
"parameters": {
"url": "http://www.samacn.org.cn/",
"responseFormat": "string",
"options": {
"fullResponse": false
},
"headerParametersUi": {
"parameter": []
},
"queryParametersUi": {
"parameter": []
}
},
"name": "HTTP Request",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 1,
"position": [
480,
290
]
},
{
"parameters": {
"extractionValues": {
"values": [
{
"key": "data",
"cssSelector": "div .nlist ul li",
"returnValue": "html",
"returnArray": true
}
]
},
"options": {}
},
"name": "HTML Extract",
"type": "n8n-nodes-base.htmlExtract",
"typeVersion": 1,
"position": [
670,
290
]
},
{
"parameters": {
"extractionValues": {
"values": [
{
"key": "url",
"cssSelector": "a",
"returnValue": "attribute",
"attribute": "href"
},
{
"key": "name",
"cssSelector": "a"
}
]
},
"options": {}
},
"name": "HTML Extract1",
"type": "n8n-nodes-base.htmlExtract",
"typeVersion": 1,
"position": [
860,
290
]
},
{
"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\n// Loop over inputs and add a new field called 'myNewField' to the JSON of each one\nnewItems = []\nfor (item of items) {\n console.log(item['json']['name'])\n console.log(item['json']['url'])\n console.log('name+url')\n if ((item['json']['name'] && item['json']['url']) === '') continue;\n newItems.push(item)\n}\n\n// You can write logs to the browser console\nconsole.log('Done!');\n\nreturn newItems;"
},
"name": "Function",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
1040,
290
]
},
{
"parameters": {
"url": "={{$node[\"Function\"].json[\"url\"]}}",
"responseFormat": "string",
"options": {
"ignoreResponseCode": true
},
"headerParametersUi": {
"parameter": []
}
},
"name": "HTTP Request1",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 1,
"position": [
1210,
270
]
}
],
"connections": {
"Start": {
"main": [
[
{
"node": "HTTP Request",
"type": "main",
"index": 0
}
]
]
},
"HTTP Request": {
"main": [
[
{
"node": "HTML Extract",
"type": "main",
"index": 0
}
]
]
},
"HTML Extract": {
"main": [
[
{
"node": "HTML Extract1",
"type": "main",
"index": 0
}
]
]
},
"HTML Extract1": {
"main": [
[
{
"node": "Function",
"type": "main",
"index": 0
}
]
]
},
"Function": {
"main": [
[
{
"node": "HTTP Request1",
"type": "main",
"index": 0
}
]
]
}
}
}