8
n8n 中文网amn8n.com

通过 Bright Data API 基于 URL 的 Yelp 商家抓取器,采用 Google Sheets 集中存储

中级

这是一个Market Research领域的自动化工作流,包含 14 个节点。主要使用 If, Wait, FormTrigger, HttpRequest, GoogleSheets 等节点。 使用 Bright Data API 和 Google Sheets 的基于 URL 的 Yelp 商家抓取器

前置要求
  • 可能需要目标 API 的认证凭证
  • Google Sheets API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "MTFFo3zU2JtQDbCy",
  "meta": {
    "instanceId": "bc8ca75c203589705ae2e446cad7181d6f2a7cc1766f958ef9f34810e53b8cb2",
    "templateCredsSetupCompleted": true
  },
  "name": "通过 Bright Data API 基于 URL 的 Yelp 商家抓取器,采用 Google Sheets 集中存储",
  "tags": [],
  "nodes": [
    {
      "id": "c79123e0-4c50-4b36-979c-0d396d722354",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2440,
        -840
      ],
      "parameters": {
        "width": 220,
        "height": 240,
        "content": "当用户通过表单提交 Yelp 商家 URL 时启动工作流"
      },
      "typeVersion": 1
    },
    {
      "id": "01d3783f-5eb1-40a9-a5b0-dbe5898053d0",
      "name": "📥 表单触发器",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -2380,
        -760
      ],
      "webhookId": "ae4aacb7-a062-4172-8817-f51716a841b7",
      "parameters": {
        "options": {},
        "formTitle": "Yelp Service URL",
        "formFields": {
          "values": [
            {
              "fieldLabel": "URL"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "194283a3-8d99-48b0-8665-51a9675e298e",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2200,
        -840
      ],
      "parameters": {
        "color": 3,
        "width": 220,
        "height": 240,
        "content": "将 URL 发送至 Bright Data 开始抓取 Yelp 商家页面"
      },
      "typeVersion": 1
    },
    {
      "id": "33669ea8-b06d-4741-8b47-bbb9d6641a80",
      "name": "🔍 触发 Bright Data 抓取",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -2140,
        -760
      ],
      "parameters": {
        "url": "https://api.brightdata.com/datasets/v3/trigger",
        "method": "POST",
        "options": {},
        "jsonBody": "=[\n  {\n    \"url\": \"https://www.yelp.com/biz/the-round-hearth-caf%C3%A9-stowe?osq=Sandwiches\"\n  }\n]",
        "sendBody": true,
        "sendQuery": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "queryParameters": {
          "parameters": [
            {
              "name": "dataset_id",
              "value": "gd_lgugwl0519h1p14rwk"
            },
            {
              "name": "include_errors",
              "value": "true"
            },
            {
              "name": "limit_multiple_results",
              "value": "5"
            },
            {
              "name": "limit_per_input",
              "value": "20"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer BRIGHT_DATA_API_KEY"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "13a3a29b-054c-4232-b1d9-82042645ee6f",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1940,
        -840
      ],
      "parameters": {
        "color": 2,
        "width": 220,
        "height": 240,
        "content": "检查 Bright Data 快照是否完成处理"
      },
      "typeVersion": 1
    },
    {
      "id": "f5489303-a94a-4499-88dc-953ca6a27bed",
      "name": "📡 监控快照状态",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -1880,
        -760
      ],
      "parameters": {
        "url": "=https://api.brightdata.com/datasets/v3/progress/{{ $json.snapshot_id }}",
        "options": {},
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer BRIGHT_DATA_API_KEY"
            }
          ]
        }
      },
      "typeVersion": 4.2,
      "alwaysOutputData": true
    },
    {
      "id": "258146e5-4d3b-444c-8379-d2b3e303b74c",
      "name": "⏳ 等待快照 30 秒",
      "type": "n8n-nodes-base.wait",
      "position": [
        -1660,
        -760
      ],
      "webhookId": "10b45556-5e91-4387-abd0-f9078b220286",
      "parameters": {
        "amount": 30
      },
      "typeVersion": 1.1
    },
    {
      "id": "58ef3944-2c0a-4249-97a4-b51d3c5dcb60",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1700,
        -840
      ],
      "parameters": {
        "color": 4,
        "width": 200,
        "height": 240,
        "content": "在重新检查抓取状态前等待 30 秒"
      },
      "typeVersion": 1
    },
    {
      "id": "2360c9bd-927e-49a1-9ac7-38d7c74208f9",
      "name": "🔁 重试直至就绪",
      "type": "n8n-nodes-base.if",
      "position": [
        -1420,
        -760
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "or",
          "conditions": [
            {
              "id": "35ed620d-b5d5-4e97-bcc5-52b283d85616",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.status }}",
              "rightValue": "ready"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "ead1165b-7665-49a4-9c0d-143dbfe085c8",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1480,
        -840
      ],
      "parameters": {
        "color": 5,
        "width": 220,
        "height": 240,
        "content": "若 Bright Data 返回数据未就绪,则循环返回继续等待;若已就绪,则继续执行"
      },
      "typeVersion": 1
    },
    {
      "id": "fdc13050-dc51-4995-836c-83d775ffe23a",
      "name": "📥 获取已抓取的商家数据",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -1160,
        -780
      ],
      "parameters": {
        "url": "=https://api.brightdata.com/datasets/v3/snapshot/{{ $json.snapshot_id }}",
        "options": {},
        "sendQuery": true,
        "sendHeaders": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "format",
              "value": "json"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer BRIGHT_DATA_API_KEY"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "c410d0a6-2d3c-4201-87dc-356b4ff015b7",
      "name": "便签5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1220,
        -840
      ],
      "parameters": {
        "color": 7,
        "height": 240,
        "content": "从就绪的快照中检索结构化的商家详情"
      },
      "typeVersion": 1
    },
    {
      "id": "f511c8d4-d8c6-4ab5-949a-ba47189553d9",
      "name": "📊 存储至 Google Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -900,
        -780
      ],
      "parameters": {
        "columns": {
          "value": {},
          "schema": [
            {
              "id": "name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "overall_rating",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "overall_rating",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "reviews_count",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "reviews_count",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "url",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "images_videos_urls",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "images_videos_urls",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_GOOGLE_SHEET_ID/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_GOOGLE_SHEET_ID",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_GOOGLE_SHEET_ID/edit?usp=drivesdk",
          "cachedResultName": "Yelp scraper data by URL"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "YOUR_GOOGLE_SHEETS_CREDENTIAL_ID",
          "name": "Google Sheets OAuth2"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "6f9084cf-3437-450e-99fc-147ee7443289",
      "name": "便签6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -960,
        -880
      ],
      "parameters": {
        "color": 4,
        "width": 280,
        "height": 280,
        "content": "📊 在“通过 URL 抓取的 Yelp 数据”工作表中,使用商家数据(名称、网站、电话、评分、地址等)更新您的 Google Sheet"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "02404bee-4698-40fc-a884-85bb5ca751e7",
  "connections": {
    "📥 Form Trigger": {
      "main": [
        [
          {
            "node": "🔍 Trigger Bright Data Scrape",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "🔁 Retry Until Ready": {
      "main": [
        [
          {
            "node": "📥 Fetch Scraped Business Data",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "📡 Monitor Snapshot Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "⏳ Wait 30 Sec for Snapshot": {
      "main": [
        [
          {
            "node": "🔁 Retry Until Ready",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "📡 Monitor Snapshot Status": {
      "main": [
        [
          {
            "node": "⏳ Wait 30 Sec for Snapshot",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "🔍 Trigger Bright Data Scrape": {
      "main": [
        [
          {
            "node": "📡 Monitor Snapshot Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "📥 Fetch Scraped Business Data": {
      "main": [
        [
          {
            "node": "📊 Store to Google Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 市场调研

需要付费吗?

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

工作流信息
难度等级
中级
节点数量14
分类1
节点类型6
难度说明

适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流

外部链接
在 n8n.io 查看

分享此工作流