8
n8n 中文网amn8n.com

Brave搜索结构化数据提取(Bright Data MCP + Google Gemini)

高级

这是一个AI, Marketing领域的自动化工作流,包含 24 个节点。主要使用 Set, Switch, Function, McpClient, HttpRequest 等节点,结合人工智能技术实现智能自动化。 使用Bright Data MCP和Google Gemini从Brave搜索中提取结构化数据

前置要求
  • 可能需要目标 API 的认证凭证
  • Google Sheets API 凭证
  • Google Gemini API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "eqvDSknjbg3YLzxM",
  "meta": {
    "instanceId": "885b4fb4a6a9c2cb5621429a7b972df0d05bb724c20ac7dac7171b62f1c7ef40",
    "templateCredsSetupCompleted": true
  },
  "name": "使用 Bright Data MCP 和 Google Gemini 进行 Brave 搜索(图像、视频、新闻、全部)和结构化数据提取",
  "tags": [
    {
      "id": "Kujft2FOjmOVQAmJ",
      "name": "Engineering",
      "createdAt": "2025-04-09T01:31:00.558Z",
      "updatedAt": "2025-04-09T01:31:00.558Z"
    },
    {
      "id": "ZOwtAMLepQaGW76t",
      "name": "Building Blocks",
      "createdAt": "2025-04-13T15:23:40.462Z",
      "updatedAt": "2025-04-13T15:23:40.462Z"
    },
    {
      "id": "ddPkw7Hg5dZhQu2w",
      "name": "AI",
      "createdAt": "2025-04-13T05:38:08.053Z",
      "updatedAt": "2025-04-13T05:38:08.053Z"
    },
    {
      "id": "qpxJxOMCv2x7Op5c",
      "name": "SERP",
      "createdAt": "2025-04-03T15:37:19.686Z",
      "updatedAt": "2025-04-03T15:37:19.686Z"
    }
  ],
  "nodes": [
    {
      "id": "70d29e8e-3e2d-4177-abdc-d3da8d6b60e4",
      "name": "点击“测试工作流”时",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -780,
        0
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "e3b06669-954e-494f-8b59-080d9d7083a8",
      "name": "Google Gemini聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        600,
        220
      ],
      "parameters": {
        "options": {},
        "modelName": "models/gemini-2.0-flash-exp"
      },
      "credentials": {
        "googlePalmApi": {
          "id": "YeO7dHZnuGBVQKVZ",
          "name": "Google Gemini(PaLM) Api account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "2c8c3b3a-edaf-42f2-8f3b-1c3a96bd4c7d",
      "name": "结构化数据提取器",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        600,
        0
      ],
      "parameters": {
        "text": "=Extract structured data from the search result. \n\n{{ $json.search_response }}",
        "promptType": "define",
        "hasOutputParser": true
      },
      "retryOnFail": true,
      "typeVersion": 1.6
    },
    {
      "id": "b2cb439e-eccc-40ad-97db-265bcd9f7a73",
      "name": "设置图像搜索的输入",
      "type": "n8n-nodes-base.set",
      "position": [
        -120,
        -300
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "0b0e9335-56d4-4705-b61b-de0dc9c8ae6d",
              "name": "search_base_url",
              "type": "string",
              "value": "https://search.brave.com/images"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "df89cc2e-1b75-4176-a66d-f17d5076bb17",
      "name": "结构化输出解析器",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        780,
        220
      ],
      "parameters": {
        "schemaType": "manual",
        "inputSchema": "{\n  \"type\": \"object\",\n  \"properties\": {\n    \"search_results\": {\n      \"type\": \"array\",\n      \"description\": \"A list of search results related to the query.\",\n      \"items\": {\n        \"type\": \"object\",\n        \"properties\": {\n          \"title\": {\n            \"type\": \"string\",\n            \"description\": \"The title of the search result or webpage.\"\n          },\n          \"url\": {\n            \"type\": \"string\",\n            \"format\": \"uri\",\n            \"description\": \"The URL of the result.\"\n          },\n          \"description\": {\n            \"type\": \"string\",\n            \"description\": \"A short description or snippet summarizing the content of the URL.\"\n          }\n        },\n        \"required\": [\"title\", \"url\", \"description\"]\n      }\n    },\n    \"related_queries\": {\n      \"type\": \"array\",\n      \"description\": \"A list of queries related to the original search, often used for refining or expanding the search.\",\n      \"items\": {\n        \"type\": \"string\"\n      }\n    }\n  },\n  \"required\": [\"search_results\"]\n}\n"
      },
      "typeVersion": 1.2
    },
    {
      "id": "919833cb-1add-4670-86a4-466f3df925f3",
      "name": "用于 Brave 图像搜索的 Bright Data MCP 客户端",
      "type": "n8n-nodes-mcp.mcpClient",
      "position": [
        100,
        -300
      ],
      "parameters": {
        "toolName": "scrape_as_html",
        "operation": "executeTool",
        "toolParameters": "={\n  \"url\": \"{{$json.search_base_url}}?q={{encodeURI($('Set the search criteria\\'s').item.json.search_query))}}\"\n} "
      },
      "credentials": {
        "mcpClientApi": {
          "id": "JtatFSfA2kkwctYa",
          "name": "MCP Client (STDIO) account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "d90b79cc-b878-4210-8380-794cd378ec73",
      "name": "条件分支",
      "type": "n8n-nodes-base.switch",
      "position": [
        -340,
        -21
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "235f2abd-b5fd-4c0a-aa63-9d8655d02dfc",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.search_type }}",
                    "rightValue": "images"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "4b6eb7ce-5683-48cf-8ab9-81b25693c280",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.search_type }}",
                    "rightValue": "videos"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "312a7726-33a4-4294-9103-5a5017f36909",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.search_type }}",
                    "rightValue": "news"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "e84e037f-89a3-48ef-b509-2ca70844ad27",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.search_type }}",
                    "rightValue": "all"
                  }
                ]
              }
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "f20fde43-bfb3-447a-9f43-51bf952c9d7e",
      "name": "设置视频搜索的输入",
      "type": "n8n-nodes-base.set",
      "position": [
        -120,
        -100
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "0b0e9335-56d4-4705-b61b-de0dc9c8ae6d",
              "name": "search_base_url",
              "type": "string",
              "value": "https://search.brave.com/video"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "b25da743-0d4b-46a2-bb51-2b8e1c533ac5",
      "name": "用于 Brave 视频搜索的 Bright Data MCP 客户端",
      "type": "n8n-nodes-mcp.mcpClient",
      "position": [
        100,
        -100
      ],
      "parameters": {
        "toolName": "scrape_as_html",
        "operation": "executeTool",
        "toolParameters": "={\n  \"url\": \"{{$json.search_base_url}}?q={{encodeURI($('Set the search criteria\\'s').item.json.search_query))}}\"\n} "
      },
      "credentials": {
        "mcpClientApi": {
          "id": "JtatFSfA2kkwctYa",
          "name": "MCP Client (STDIO) account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "28e51b1c-a4f3-4d95-af12-d4bd1219cfa2",
      "name": "设置搜索响应",
      "type": "n8n-nodes-base.set",
      "position": [
        380,
        0
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "74d82a2b-0219-4966-80f2-3144c7c5e4c7",
              "name": "search_response",
              "type": "string",
              "value": "={{ $json.result.content[0].text }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "98d38078-4708-4d22-a8be-e50a4701ea75",
      "name": "便签 2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        120,
        -480
      ],
      "parameters": {
        "color": 3,
        "width": 440,
        "height": 120,
        "content": "## 免责声明"
      },
      "typeVersion": 1
    },
    {
      "id": "43138034-35ad-43fd-b67e-69942e1b061b",
      "name": "便签 4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -340,
        -580
      ],
      "parameters": {
        "color": 5,
        "width": 440,
        "height": 220,
        "content": "## LLM用途"
      },
      "typeVersion": 1
    },
    {
      "id": "eb731e47-779e-40bc-8a83-126d1b03a70b",
      "name": "便签 5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -800,
        -980
      ],
      "parameters": {
        "color": 7,
        "width": 440,
        "height": 360,
        "content": "## 徽标"
      },
      "typeVersion": 1
    },
    {
      "id": "5581a950-075d-4d4d-9f97-fd65e71cc6ff",
      "name": "便签 3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -800,
        -580
      ],
      "parameters": {
        "width": 440,
        "height": 320,
        "content": "## 注意"
      },
      "typeVersion": 1
    },
    {
      "id": "a5afb97c-0fbf-48b1-b598-fbca46e3df96",
      "name": "设置新闻搜索的输入字段",
      "type": "n8n-nodes-base.set",
      "position": [
        -120,
        100
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "0b0e9335-56d4-4705-b61b-de0dc9c8ae6d",
              "name": "search_base_url",
              "type": "string",
              "value": "https://search.brave.com/news"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "0dcd6a1b-7968-40da-ad27-4d39fadc243a",
      "name": "设置搜索条件",
      "type": "n8n-nodes-base.set",
      "position": [
        -560,
        0
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "9852f865-49b9-4672-9454-4bcc51173445",
              "name": "search_type",
              "type": "string",
              "value": "news"
            },
            {
              "id": "643626c4-6d3e-4609-be12-5e7c0c7afe1d",
              "name": "search_query",
              "type": "string",
              "value": "bright+data&source=web&lang=en-in"
            },
            {
              "id": "4a0fc0eb-2638-4441-9eb1-51c29dd7d1b4",
              "name": "json_search_query",
              "type": "string",
              "value": "{     \"query\": \"What are the latest funding rounds for AI startups?\",     \"include_domains\": [ \"crunchbase.com\", \"techcrunch.com\", \"pitchbook.com\" ]  }"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "2c686701-f3fa-4bf4-bdea-b11dce7b2862",
      "name": "用于 Brave 新闻搜索的 Bright Data MCP 客户端",
      "type": "n8n-nodes-mcp.mcpClient",
      "position": [
        100,
        100
      ],
      "parameters": {
        "toolName": "scrape_as_html",
        "operation": "executeTool",
        "toolParameters": "={\n  \"url\": \"{{$json.search_base_url}}?q={{encodeURI($('Set the search criteria\\'s').item.json.search_query)}}\"\n} "
      },
      "credentials": {
        "mcpClientApi": {
          "id": "JtatFSfA2kkwctYa",
          "name": "MCP Client (STDIO) account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "725c7c7e-6422-4bcb-8bb1-441766741c96",
      "name": "用于 Brave 全部搜索的 Bright Data MCP 客户端",
      "type": "n8n-nodes-mcp.mcpClient",
      "position": [
        100,
        300
      ],
      "parameters": {
        "toolName": "scrape_as_html",
        "operation": "executeTool",
        "toolParameters": "={\n  \"url\": \"{{$json.search_base_url}}?q={{encodeURI($('Set the search criteria\\'s').item.json.search_query)}}\"\n} "
      },
      "credentials": {
        "mcpClientApi": {
          "id": "JtatFSfA2kkwctYa",
          "name": "MCP Client (STDIO) account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "a6843bfe-f649-4ab8-9208-1d3119e811c5",
      "name": "设置全部搜索的输入字段",
      "type": "n8n-nodes-base.set",
      "position": [
        -120,
        300
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "0b0e9335-56d4-4705-b61b-de0dc9c8ae6d",
              "name": "search_base_url",
              "type": "string",
              "value": "https://search.brave.com/search"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "c8fa6490-f0db-400c-8283-e8f9120e6481",
      "name": "Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1060,
        -180
      ],
      "parameters": {
        "columns": {
          "value": {
            "Output": "={{ $json.output.search_results.toJsonString() }}"
          },
          "schema": [
            {
              "id": "Output",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Output",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Output"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1KE5v8RZ3BouTzoT3D4CeU8whe-kWpZcq0VMSalNrxFg/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1KE5v8RZ3BouTzoT3D4CeU8whe-kWpZcq0VMSalNrxFg",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1KE5v8RZ3BouTzoT3D4CeU8whe-kWpZcq0VMSalNrxFg/edit?usp=drivesdk",
          "cachedResultName": "Brave Search Results"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "Zjoxh2BUZ6VXGQhA",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "6d51e57a-1303-46a0-95ce-80d3a17c30db",
      "name": "为结构化数据提取创建二进制数据",
      "type": "n8n-nodes-base.function",
      "position": [
        1060,
        20
      ],
      "parameters": {
        "functionCode": "items[0].binary = {\n  data: {\n    data: new Buffer(JSON.stringify(items[0].json, null, 2)).toString('base64')\n  }\n};\nreturn items;"
      },
      "typeVersion": 1
    },
    {
      "id": "7f5d181b-18bc-4bb4-8ae9-bc2e05137127",
      "name": "将结构化内容写入磁盘",
      "type": "n8n-nodes-base.readWriteFile",
      "position": [
        1280,
        20
      ],
      "parameters": {
        "options": {},
        "fileName": "=d:\\Brave-Search-Result-{{new Date().toISOString().replaceAll(\":\",\".\")}}.json",
        "operation": "write"
      },
      "typeVersion": 1
    },
    {
      "id": "fa6143c9-3312-4890-a490-3bc3db355c53",
      "name": "为结构化数据发起 Webhook 通知",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1060,
        220
      ],
      "parameters": {
        "url": "https://webhook.site/24878284-919d-4d39-bff0-5f36bfae17b6",
        "options": {},
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "summary",
              "value": "={{ $json.output.search_results.toJsonString() }}"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "cdea8e7d-f513-45fa-b7cf-3b9507d47fda",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        540,
        -220
      ],
      "parameters": {
        "color": 4,
        "width": 940,
        "height": 660,
        "content": "## 结构化数据和输出处理"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "3a04231b-455b-48ad-8403-915a6851d84b",
  "connections": {
    "Switch": {
      "main": [
        [
          {
            "node": "Set the input for image search",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Set the input for video search",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Set the input fields for news search",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Set the input fields for All search",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set the Search Response": {
      "main": [
        [
          {
            "node": "Structured Data Extractor",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Structured Data Extractor",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Structured Data Extractor",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Set the search criteria's": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Data Extractor": {
      "main": [
        [
          {
            "node": "Google Sheets",
            "type": "main",
            "index": 0
          },
          {
            "node": "Create a binary data for Structured Data Extract",
            "type": "main",
            "index": 0
          },
          {
            "node": "Initiate a Webhook Notification for the Structured Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set the input for image search": {
      "main": [
        [
          {
            "node": "Bright Data MCP Client for Brave Image Search",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set the input for video search": {
      "main": [
        [
          {
            "node": "Bright Data MCP Client for Brave Video Search",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Test workflow’": {
      "main": [
        [
          {
            "node": "Set the search criteria's",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set the input fields for All search": {
      "main": [
        [
          {
            "node": "Bright Data MCP Client for Brave All Search",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set the input fields for news search": {
      "main": [
        [
          {
            "node": "Bright Data MCP Client for Brave News Search",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Bright Data MCP Client for Brave All Search": {
      "main": [
        [
          {
            "node": "Set the Search Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Bright Data MCP Client for Brave News Search": {
      "main": [
        [
          {
            "node": "Set the Search Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Bright Data MCP Client for Brave Image Search": {
      "main": [
        [
          {
            "node": "Set the Search Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Bright Data MCP Client for Brave Video Search": {
      "main": [
        [
          {
            "node": "Set the Search Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create a binary data for Structured Data Extract": {
      "main": [
        [
          {
            "node": "Write the structured content to disk",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

高级 - 人工智能, 营销

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
高级
节点数量24
分类2
节点类型12
难度说明

适合高级用户,包含 16+ 个节点的复杂工作流

作者
Ranjan Dailata

Ranjan Dailata

@ranjancse

A Professional based out of India specialized in handling AI-powered automations. Contact me at ranjancse@gmail.com

外部链接
在 n8n.io 查看

分享此工作流