Files
n8n/flows/56.json

704 lines
14 KiB
JSON

{
"id": 56,
"name": "olx final",
"active": true,
"nodes": [
{
"parameters": {},
"name": "Start",
"type": "n8n-nodes-base.start",
"typeVersion": 1,
"position": [
200,
-40
]
},
{
"parameters": {
"triggerTimes": {
"item": [
{
"mode": "everyX",
"value": 15,
"unit": "minutes"
}
]
}
},
"name": "Cron2",
"type": "n8n-nodes-base.cron",
"typeVersion": 1,
"position": [
200,
260
]
},
{
"parameters": {
"operation": "create",
"docId": "d61nLm6Fn99jwqxd6hdT9d",
"tableId": "Items",
"dataToSend": "autoMapInputs"
},
"name": "Grist",
"type": "n8n-nodes-base.grist",
"typeVersion": 1,
"position": [
3040,
200
],
"credentials": {
"gristApi": {
"id": "21",
"name": "Grist account"
}
}
},
{
"parameters": {
"values": {
"string": [
{
"name": "link",
"value": "={{$node[\"IF\"].json[\"link\"]}}"
},
{
"name": "tag",
"value": "={{$node[\"IF\"].json[\"tag\"]}}"
},
{
"name": "city",
"value": "={{$node[\"IF\"].json[\"city\"]}}"
},
{
"name": "date",
"value": "={{$now.toString()}}"
}
]
},
"options": {}
},
"name": "Set1",
"type": "n8n-nodes-base.set",
"typeVersion": 1,
"position": [
2860,
200
]
},
{
"parameters": {
"url": "={{$json[\"url\"]}}",
"responseFormat": "string",
"options": {
"batchSize": 20
}
},
"name": "HTTP Request3",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 2,
"position": [
620,
20
]
},
{
"parameters": {
"extractionValues": {
"values": [
{
"key": "items",
"cssSelector": "div.css-19ucd76",
"returnValue": "html",
"returnArray": true
}
]
},
"options": {}
},
"name": "HTML Extract3",
"type": "n8n-nodes-base.htmlExtract",
"typeVersion": 1,
"position": [
820,
20
]
},
{
"parameters": {
"fieldToSplitOut": "items",
"include": "allOtherFields",
"options": {}
},
"name": "Item Lists1",
"type": "n8n-nodes-base.itemLists",
"typeVersion": 1,
"position": [
1220,
20
]
},
{
"parameters": {
"dataPropertyName": "items",
"extractionValues": {
"values": [
{
"key": "link",
"cssSelector": "a.css-1bbgabe",
"returnValue": "attribute",
"attribute": "href"
},
{
"key": "city",
"cssSelector": "p.css-p6wsjo-Text.eu5v0x0"
}
]
},
"options": {}
},
"name": "HTML Extract4",
"type": "n8n-nodes-base.htmlExtract",
"typeVersion": 1,
"position": [
1420,
20
]
},
{
"parameters": {
"conditions": {
"string": [
{
"value1": "={{$json[\"link\"]}}",
"operation": "isNotEmpty"
},
{
"value1": "={{$json[\"city\"]}}",
"operation": "contains",
"value2": "Сегодня"
},
{
"value1": "={{$json[\"city\"]}}",
"operation": "isNotEmpty"
}
]
}
},
"name": "IF1",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
1780,
20
]
},
{
"parameters": {
"docId": "d61nLm6Fn99jwqxd6hdT9d",
"tableId": "Url",
"additionalOptions": {}
},
"name": "get url",
"type": "n8n-nodes-base.grist",
"typeVersion": 1,
"position": [
420,
20
],
"credentials": {
"gristApi": {
"id": "21",
"name": "Grist account"
}
}
},
{
"parameters": {
"keepOnlySet": true,
"values": {
"string": [
{
"name": "tag",
"value": "={{$node[\"get url\"].json[\"tag\"]}}"
},
{
"name": "items",
"value": "={{$json[\"items\"]}}"
},
{
"name": "filter",
"value": "={{$node[\"get url\"].json[\"filter\"]}}"
}
]
},
"options": {}
},
"name": "Set items",
"type": "n8n-nodes-base.set",
"typeVersion": 1,
"position": [
1020,
20
]
},
{
"parameters": {
"mode": "removeKeyMatches",
"propertyName1": "link",
"propertyName2": "link"
},
"name": "Merge",
"type": "n8n-nodes-base.merge",
"typeVersion": 1,
"position": [
2060,
20
]
},
{
"parameters": {
"docId": "d61nLm6Fn99jwqxd6hdT9d",
"tableId": "Items",
"returnAll": true,
"additionalOptions": {}
},
"name": "Grist2",
"type": "n8n-nodes-base.grist",
"typeVersion": 1,
"position": [
1800,
220
],
"credentials": {
"gristApi": {
"id": "21",
"name": "Grist account"
}
}
},
{
"parameters": {
"url": "={{$json[\"link\"]}}",
"responseFormat": "string",
"options": {}
},
"name": "HTTP Request4",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 2,
"position": [
2460,
0
]
},
{
"parameters": {
"extractionValues": {
"values": [
{
"key": "price",
"cssSelector": "h3.css-okktvh-Text.eu5v0x0"
},
{
"key": "content",
"cssSelector": "div.css-g5mtbi-Text"
},
{
"key": "image",
"cssSelector": "img.css-1bmvjcs",
"returnValue": "attribute",
"attribute": "src"
},
{
"key": "title",
"cssSelector": "h1.css-r9zjja-Text.eu5v0x0"
}
]
},
"options": {
"trimValues": true
}
},
"name": "HTML Extract5",
"type": "n8n-nodes-base.htmlExtract",
"typeVersion": 1,
"position": [
2640,
0
]
},
{
"parameters": {
"conditions": {
"string": [
{
"value1": "={{$json[\"link\"]}}",
"operation": "contains",
"value2": "={{$json[\"filter\"]}}"
}
]
}
},
"name": "IF",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
2240,
20
]
},
{
"parameters": {
"chatId": "1684481",
"text": "=#{{$node[\"IF\"].json[\"tag\"]}}\n<b>{{$json[\"title\"]}} - {{$json[\"price\"]}}</b>\n📍 <i>{{$node[\"IF\"].json[\"city\"]}}</i>\n<a href=\"{{$node[\"IF\"].json[\"link\"]}}\">Подробнее</a>",
"additionalFields": {
"parse_mode": "HTML"
}
},
"name": "Telegram",
"type": "n8n-nodes-base.telegram",
"typeVersion": 1,
"position": [
2860,
0
],
"credentials": {
"telegramApi": {
"id": "31",
"name": "Telegram account"
}
}
},
{
"parameters": {
"values": {
"string": [
{
"name": "link",
"value": "=https://m.olx.ua{{$json[\"link\"]}}"
},
{
"name": "tag",
"value": "={{$node[\"Item Lists1\"].json[\"tag\"]}}"
},
{
"name": "filter",
"value": "={{$node[\"Item Lists1\"].json[\"filter\"]}}"
}
]
},
"options": {}
},
"name": "Set",
"type": "n8n-nodes-base.set",
"typeVersion": 1,
"position": [
1600,
20
]
},
{
"parameters": {
"docId": "d61nLm6Fn99jwqxd6hdT9d",
"tableId": "Items",
"returnAll": true,
"additionalOptions": {}
},
"name": "Grist3",
"type": "n8n-nodes-base.grist",
"typeVersion": 1,
"position": [
420,
260
],
"credentials": {
"gristApi": {
"id": "21",
"name": "Grist account"
}
}
},
{
"parameters": {
"conditions": {
"dateTime": [
{
"value1": "={{ $json[\"data\"] }}",
"operation": "before",
"value2": "={{$today.minus({days: 14}).toString()}}"
}
]
}
},
"name": "IF2",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
820,
260
]
},
{
"parameters": {
"value": "={{ $json[\"date\"] }}",
"toFormat": "YYYY-MM-DD",
"options": {
"fromFormat": "X"
}
},
"name": "Date & Time",
"type": "n8n-nodes-base.dateTime",
"typeVersion": 1,
"position": [
620,
260
]
},
{
"parameters": {
"operation": "delete",
"docId": "d61nLm6Fn99jwqxd6hdT9d",
"tableId": "Items",
"rowId": "={{ $json[\"id\"] }}"
},
"name": "Grist4",
"type": "n8n-nodes-base.grist",
"typeVersion": 1,
"position": [
1020,
240
],
"credentials": {
"gristApi": {
"id": "21",
"name": "Grist account"
}
}
}
],
"connections": {
"Cron2": {
"main": [
[
{
"node": "get url",
"type": "main",
"index": 0
},
{
"node": "Grist3",
"type": "main",
"index": 0
}
]
]
},
"Set1": {
"main": [
[
{
"node": "Grist",
"type": "main",
"index": 0
}
]
]
},
"HTTP Request3": {
"main": [
[
{
"node": "HTML Extract3",
"type": "main",
"index": 0
}
]
]
},
"HTML Extract3": {
"main": [
[
{
"node": "Set items",
"type": "main",
"index": 0
}
]
]
},
"Item Lists1": {
"main": [
[
{
"node": "HTML Extract4",
"type": "main",
"index": 0
}
]
]
},
"HTML Extract4": {
"main": [
[
{
"node": "Set",
"type": "main",
"index": 0
}
]
]
},
"IF1": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 0
}
]
]
},
"get url": {
"main": [
[
{
"node": "HTTP Request3",
"type": "main",
"index": 0
}
]
]
},
"Set items": {
"main": [
[
{
"node": "Item Lists1",
"type": "main",
"index": 0
}
]
]
},
"Grist2": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 1
}
]
]
},
"Merge": {
"main": [
[
{
"node": "IF",
"type": "main",
"index": 0
}
]
]
},
"HTTP Request4": {
"main": [
[
{
"node": "HTML Extract5",
"type": "main",
"index": 0
}
]
]
},
"HTML Extract5": {
"main": [
[
{
"node": "Set1",
"type": "main",
"index": 0
},
{
"node": "Telegram",
"type": "main",
"index": 0
}
]
]
},
"IF": {
"main": [
[
{
"node": "HTTP Request4",
"type": "main",
"index": 0
}
]
]
},
"Set": {
"main": [
[
{
"node": "IF1",
"type": "main",
"index": 0
}
]
]
},
"Grist3": {
"main": [
[
{
"node": "Date & Time",
"type": "main",
"index": 0
}
]
]
},
"IF2": {
"main": [
[
{
"node": "Grist4",
"type": "main",
"index": 0
}
]
]
},
"Date & Time": {
"main": [
[
{
"node": "IF2",
"type": "main",
"index": 0
}
]
]
}
},
"createdAt": "2022-07-18T17:30:44.606Z",
"updatedAt": "2022-08-01T07:50:29.799Z",
"settings": {
"errorWorkflow": "25"
},
"staticData": null,
"pinData": {},
"tags": [
{
"id": "3",
"name": "olx",
"createdAt": "2022-06-21T19:20:51.822Z",
"updatedAt": "2022-06-21T19:20:51.822Z"
}
]
}