-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreverse-search.json
More file actions
130 lines (130 loc) · 4.38 KB
/
reverse-search.json
File metadata and controls
130 lines (130 loc) · 4.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
{
"name": "reverse-search",
"nodes": [
{
"parameters": {
"inputSource": "passthrough"
},
"id": "c055762a-8fe7-4141-a639-df2372f30060",
"typeVersion": 1.1,
"name": "When Executed by Another Workflow",
"type": "n8n-nodes-base.executeWorkflowTrigger",
"position": [
272,
352
]
},
{
"parameters": {
"method": "POST",
"url": "https://api.bing.microsoft.com/v7.0/images/visualsearch",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "multipart/form-data"
},
{
"name": "Ocp-Apim-Subscription-Key"
}
]
},
"sendBody": true,
"contentType": "binaryData",
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.3,
"position": [
400,
656
],
"id": "98078745-f3e1-4f14-9285-d1f59d3cb3fe",
"name": "HTTP Request2"
},
{
"parameters": {
"method": "POST",
"url": "https://vision.googleapis.com/v1/images:annotate",
"authentication": "predefinedCredentialType",
"nodeCredentialType": "googleOAuth2Api",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "application/json"
}
]
},
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={\n \"requests\": [\n {\n \"image\": {\n \"content\": \"{{ $json.data?.base64 || $json.base64 }}\"\n },\n \"features\": [\n {\n \"type\": \"WEB_DETECTION\"\n }\n ]\n }\n ]\n}\n",
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.3,
"position": [
576,
352
],
"id": "62ae82e6-142a-413c-ab66-3db73c77266c",
"name": "HTTP Request",
"credentials": {
"googleOAuth2Api": {
"id": "GL5OTHA639nII293",
"name": "Google account"
}
}
},
{
"parameters": {
"jsCode": "const data = items[0].json;\n\n// Acessa o webDetection corretamente\nconst detection = data?.responses?.[0]?.webDetection;\n\n// Se não tiver fullMatchingImages → resposta padrão\nif (!detection || !detection.fullMatchingImages || detection.fullMatchingImages.length === 0) {\n return [\n {\n json: {\n text: \"Nenhuma correspondência completa encontrada para esta imagem.\"\n }\n }\n ];\n}\n\n// ---- Web Entities ----\nlet entitiesText = \"Entidades Detectadas:\\n\";\nif (detection.webEntities?.length) {\n detection.webEntities.forEach(e => {\n if (e.description) entitiesText += `- ${e.description}\\n`;\n });\n} else {\n entitiesText += \"- Nenhuma entidade encontrada.\\n\";\n}\n\n// ---- Pages With Matching Images (somente 3 primeiras) ----\nlet pagesText = \"\\nPáginas com Imagens Correspondentes:\\n\";\n\nif (detection.pagesWithMatchingImages?.length) {\n detection.pagesWithMatchingImages\n .slice(0, 3) // <= apenas os 3 primeiros\n .forEach(p => {\n if (p.pageTitle) pagesText += `- ${p.pageTitle}\\n`;\n });\n} else {\n pagesText += \"- Nenhuma página encontrada.\\n\";\n}\n\n// Texto final\nconst finalText = entitiesText + pagesText;\n\nreturn [\n {\n json: {\n text: finalText\n }\n }\n];"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
880,
352
],
"id": "ab63e1f9-897c-4640-bb0d-acaba1c539b8",
"name": "Code in JavaScript"
}
],
"pinData": {},
"connections": {
"When Executed by Another Workflow": {
"main": [
[
{
"node": "HTTP Request",
"type": "main",
"index": 0
}
]
]
},
"HTTP Request": {
"main": [
[
{
"node": "Code in JavaScript",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "608a42f0-4611-4838-a4f3-ff97e83f5e1f",
"meta": {
"instanceId": "66003f19454addf7e955bb54c53f18bcbbdbda71fc5e07836f0a61d5116098f0"
},
"id": "JpxOxZxyrCz0h6kZ",
"tags": []
}