8
n8n 中文网amn8n.com

使用 Bright Data MCP 和 OpenAI 的食谱推荐引擎

高级

这是一个Other, AI领域的自动化工作流,包含 23 个节点。主要使用 Set, Code, Wait, Function, McpClient 等节点,结合人工智能技术实现智能自动化。 基于 Bright Data MCP 和 OpenAI 4o mini 的食谱推荐引擎

前置要求
  • 可能需要目标 API 的认证凭证
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "3nPufqQQUzDzdo02",
  "meta": {
    "instanceId": "885b4fb4a6a9c2cb5621429a7b972df0d05bb724c20ac7dac7171b62f1c7ef40",
    "templateCredsSetupCompleted": true
  },
  "name": "使用 Bright Data MCP 和 OpenAI 的食谱推荐引擎",
  "tags": [],
  "nodes": [
    {
      "id": "e1aeff42-0129-48df-b69b-927ef3e89f21",
      "name": "当点击\"测试工作流\"时",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -600,
        145
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "50ddc2f7-89d1-4fb8-a47a-6b77ddb309da",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -200,
        60
      ],
      "parameters": {
        "color": 4,
        "width": 440,
        "height": 320,
        "content": "## 食谱数据抓取器"
      },
      "typeVersion": 1
    },
    {
      "id": "da4a520e-0960-4262-af8e-82fb365546cb",
      "name": "列出 Bright Data 的所有工具",
      "type": "n8n-nodes-mcp.mcpClient",
      "position": [
        -380,
        145
      ],
      "parameters": {},
      "credentials": {
        "mcpClientApi": {
          "id": "JtatFSfA2kkwctYa",
          "name": "MCP Client (STDIO) account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "67dead27-adee-458e-9040-25aabf69c845",
      "name": "设置食谱提取 URL",
      "type": "n8n-nodes-base.set",
      "position": [
        -160,
        145
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "214e61a0-3587-453f-baf5-eac013990857",
              "name": "url",
              "type": "string",
              "value": "https://realfood.tesco.com/search.html?search=tomato%20pasta&sortby=Rating"
            },
            {
              "id": "45014942-0a2e-4f46-b395-f82f97bfa93e",
              "name": "webhook_url",
              "type": "string",
              "value": "https://webhook.site/24878284-919d-4d39-bff0-5f36bfae17b6"
            },
            {
              "id": "8d9b4ec0-416e-4b47-859a-36300f18aa23",
              "name": "base_url",
              "type": "string",
              "value": "https://realfood.tesco.com/search.html"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "e5d42bd3-2c23-42e6-be3b-c6e505cd585b",
      "name": "分页数据提取",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        280,
        145
      ],
      "parameters": {
        "text": "=Extract the paginated data from the provided content. \n\nHere's the content : {{ $json.result.content[0].text }}\n\nAppend the link with the Base URL as {{ $('Set the Recipe Extract URL').item.json.base_url }}",
        "messages": {
          "messageValues": [
            {
              "message": "You are an expert data miner"
            }
          ]
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "retryOnFail": true,
      "typeVersion": 1.6
    },
    {
      "id": "136c1487-4164-4b7e-b2ed-f9d29017f539",
      "name": "遍历项目",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        876,
        145
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "a10d507e-cd18-474f-998a-64f435b9d230",
      "name": "输出分页信息数组的代码",
      "type": "n8n-nodes-base.code",
      "position": [
        656,
        145
      ],
      "parameters": {
        "jsCode": "return $input.first().json.output"
      },
      "typeVersion": 2
    },
    {
      "id": "2047cdb3-ce19-4254-8d52-f99ec5101e18",
      "name": "分页数据的结构化输出解析器",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        500,
        380
      ],
      "parameters": {
        "jsonSchemaExample": "[{\n\t\"page_number\": \"page number in int\",\n\t\"link\": \"link to the web content\"\n}]"
      },
      "typeVersion": 1.2
    },
    {
      "id": "4e912c2c-12a1-45ee-a821-9e1fd873120c",
      "name": "用于食谱提取的 Bright Data MCP 客户端",
      "type": "n8n-nodes-mcp.mcpClient",
      "notes": "Scrape a single webpage URL with advanced options for content extraction and get back the results in MarkDown language.",
      "position": [
        60,
        145
      ],
      "parameters": {
        "toolName": "scrape_as_html",
        "operation": "executeTool",
        "toolParameters": "={\n   \"url\": \"{{ $json.url }}\"\n} "
      },
      "credentials": {
        "mcpClientApi": {
          "id": "JtatFSfA2kkwctYa",
          "name": "MCP Client (STDIO) account"
        }
      },
      "notesInFlow": true,
      "typeVersion": 1
    },
    {
      "id": "b14070b3-da81-4356-bef5-e70399893ce7",
      "name": "循环内用于食谱提取的 Bright Data MCP 客户端",
      "type": "n8n-nodes-mcp.mcpClient",
      "notes": "Scrape a single webpage URL with advanced options for content extraction and get back the results in MarkDown language.",
      "position": [
        1480,
        160
      ],
      "parameters": {
        "toolName": "scrape_as_html",
        "operation": "executeTool",
        "toolParameters": "={\n   \"url\": \"{{ $json.link }}\"\n} "
      },
      "credentials": {
        "mcpClientApi": {
          "id": "JtatFSfA2kkwctYa",
          "name": "MCP Client (STDIO) account"
        }
      },
      "notesInFlow": true,
      "typeVersion": 1
    },
    {
      "id": "0577e0ca-162f-40bc-b96f-fbe5f9690826",
      "name": "食谱数据提取的结构化输出解析器",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1900,
        360
      ],
      "parameters": {
        "schemaType": "manual",
        "inputSchema": "{\n  \"$schema\": \"http://json-schema.org/schema#\",\n  \"title\": \"TescoRecipeSearchResults\",\n  \"type\": \"object\",\n  \"properties\": {\n    \"pageTitle\": { \"type\": \"string\" },\n    \"searchTerms\": { \"type\": \"string\" },\n    \"sortBy\": { \"type\": \"string\" },\n    \"numberOfResults\": { \"type\": \"integer\" },\n    \"numberOfPages\": { \"type\": \"integer\" },\n    \"numberOfFirstResult\": { \"type\": \"integer\" },\n    \"numberOfLastResult\": { \"type\": \"integer\" },\n    \"recipes\": {\n      \"type\": \"array\",\n      \"items\": {\n        \"type\": \"object\",\n        \"properties\": {\n          \"title\": { \"type\": \"string\" },\n          \"url\": { \"type\": \"string\" },\n          \"category\": { \"type\": \"string\" },\n          \"rating\": { \"type\": \"number\" },\n          \"serves\": { \"type\": \"integer\" },\n          \"dietaryOptions\": {\n            \"type\": \"array\",\n            \"items\": { \"type\": \"string\" }\n          },\n          \"isHealthy\": { \"type\": \"boolean\" }\n        },\n        \"required\": [\n          \"title\",\n          \"url\",\n          \"category\",\n          \"rating\",\n          \"serves\",\n          \"dietaryOptions\"\n        ],\n        \"additionalProperties\": false\n      }\n    }\n  },\n  \"required\": [\n    \"pageTitle\",\n    \"searchTerms\",\n    \"sortBy\",\n    \"numberOfResults\",\n    \"numberOfPages\",\n    \"numberOfFirstResult\",\n    \"numberOfLastResult\",\n    \"recipes\"\n  ],\n  \"additionalProperties\": false\n}\n"
      },
      "typeVersion": 1.2
    },
    {
      "id": "dc24bede-a05a-45be-bea8-abd4efec5679",
      "name": "创建二进制数据",
      "type": "n8n-nodes-base.function",
      "position": [
        2200,
        160
      ],
      "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": "82630ed0-d321-42bd-ae68-e790228a61c7",
      "name": "循环内数据提取的 Webhook 通知",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2120,
        340
      ],
      "parameters": {
        "url": "={{ $('Set the Recipe Extract URL').item.json.webhook_url }}",
        "options": {},
        "sendBody": true,
        "contentType": "multipart-form-data",
        "bodyParameters": {
          "parameters": [
            {
              "name": "recipe_content",
              "value": "={{ $json.output.toJsonString() }}"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "c2b53242-8c0d-49a4-8cdb-27da64377d50",
      "name": "将结构化内容写入磁盘",
      "type": "n8n-nodes-base.readWriteFile",
      "position": [
        2500,
        160
      ],
      "parameters": {
        "options": {},
        "fileName": "=d:\\Recipe-Structured-Data-{{ $('Loop Over Items').item.json.page_number }}.json",
        "operation": "write"
      },
      "typeVersion": 1
    },
    {
      "id": "f4eef0b9-8a1d-4eb2-92fc-7f4ee9d48898",
      "name": "结构化食谱数据提取",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        1740,
        160
      ],
      "parameters": {
        "text": "=Extract search data. Here's the content : \nOutput the data in JSON",
        "messages": {
          "messageValues": [
            {
              "message": "You are an expert data miner"
            }
          ]
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "retryOnFail": true,
      "typeVersion": 1.6
    },
    {
      "id": "bd64603d-230b-4318-b365-b186826454f0",
      "name": "便签 2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        820,
        -160
      ],
      "parameters": {
        "width": 440,
        "height": 120,
        "content": "## 免责声明"
      },
      "typeVersion": 1
    },
    {
      "id": "3715be91-c809-495c-8a4e-ca58cf9de999",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        820,
        0
      ],
      "parameters": {
        "color": 6,
        "width": 1860,
        "height": 540,
        "content": "## 结构化数据提取"
      },
      "typeVersion": 1
    },
    {
      "id": "c5d846da-581a-4182-a52d-0e29b302150e",
      "name": "便签 3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -680,
        -340
      ],
      "parameters": {
        "width": 400,
        "height": 320,
        "content": "## 注意"
      },
      "typeVersion": 1
    },
    {
      "id": "3af431fa-63fd-4140-8e86-8443a6ae013f",
      "name": "便签6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -200,
        -240
      ],
      "parameters": {
        "color": 5,
        "width": 440,
        "height": 220,
        "content": "## LLM 使用情况"
      },
      "typeVersion": 1
    },
    {
      "id": "367bed09-cc77-4955-ada5-d71111bdfef1",
      "name": "便签 5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -680,
        -780
      ],
      "parameters": {
        "color": 7,
        "width": 400,
        "height": 400,
        "content": "## 徽标"
      },
      "typeVersion": 1
    },
    {
      "id": "cbe55c76-4a62-4c15-af34-b49e037d779b",
      "name": "用于分页数据提取的 OpenAI 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        280,
        380
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "vPKynKbDzJ5ZU4cU",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "566f7f77-8eed-4ea2-9402-ccb46a13bf52",
      "name": "用于结构化数据提取的 OpenAI 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1700,
        360
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "vPKynKbDzJ5ZU4cU",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "fca8b6ce-a17c-416f-acc2-6a7a8bbf5b7b",
      "name": "等待",
      "type": "n8n-nodes-base.wait",
      "position": [
        1180,
        160
      ],
      "webhookId": "791cb0be-ba4a-417f-bcf2-ca8151bf16cd",
      "parameters": {
        "amount": 10
      },
      "typeVersion": 1.1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "79bcb4d2-0dd7-4759-a2f6-7636f054d543",
  "connections": {
    "Wait": {
      "main": [
        [
          {
            "node": "Bright Data MCP Client For Recipe Extract Within The Loop",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create a binary data": {
      "main": [
        [
          {
            "node": "Write the structured content to disk",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Paginated Data Extract": {
      "main": [
        [
          {
            "node": "Code to output the array of paginated info",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set the Recipe Extract URL": {
      "main": [
        [
          {
            "node": "Bright Data MCP Client For Recipe Extract",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "List all tools for Bright Data": {
      "main": [
        [
          {
            "node": "Set the Recipe Extract URL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Recipe Data Extract": {
      "main": [
        [
          {
            "node": "Create a binary data",
            "type": "main",
            "index": 0
          },
          {
            "node": "Webhook Notification for Data Extract Within the Loop",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Test workflow’": {
      "main": [
        [
          {
            "node": "List all tools for Bright Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Write the structured content to disk": {
      "main": [
        []
      ]
    },
    "Bright Data MCP Client For Recipe Extract": {
      "main": [
        [
          {
            "node": "Paginated Data Extract",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code to output the array of paginated info": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser for Paginated Data": {
      "ai_outputParser": [
        [
          {
            "node": "Paginated Data Extract",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model for Paginated Data Extract": {
      "ai_languageModel": [
        [
          {
            "node": "Paginated Data Extract",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model for Structured Data Extract": {
      "ai_languageModel": [
        [
          {
            "node": "Structured Recipe Data Extract",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser for Recipe Data Extract": {
      "ai_outputParser": [
        [
          {
            "node": "Structured Recipe Data Extract",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Webhook Notification for Data Extract Within the Loop": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Bright Data MCP Client For Recipe Extract Within The Loop": {
      "main": [
        [
          {
            "node": "Structured Recipe Data Extract",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 其他, 人工智能

需要付费吗?

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

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

适合高级用户,包含 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 查看

分享此工作流