8
n8n 中文网amn8n.com

使用BrowserAct将目录抓取自动化到Google Sheets

中级

这是一个Lead Generation领域的自动化工作流,包含 15 个节点。主要使用 Code, GoogleSheets, ManualTrigger, BrowserAct 等节点。 使用BrowserAct将YP.com目录抓取自动化到Google Sheets

前置要求
  • Google Sheets API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "fffRt3A8pcGDhAYV",
  "meta": {
    "instanceId": "88804d8e264d231c18413147cc92e4245b20ae7b97d774bad847556f645c8192",
    "templateCredsSetupCompleted": true
  },
  "name": "使用 BrowserAct 将目录抓取自动化到 Google Sheets",
  "tags": [],
  "nodes": [
    {
      "id": "8ad92360-1ee6-44cb-ad18-ff1d898489b0",
      "name": "当点击‘执行工作流’时",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -32,
        208
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "281fdee8-0b6e-4f2d-b811-7376e20c14f2",
      "name": "运行工作流任务",
      "type": "n8n-nodes-browseract-workflows.browserAct",
      "position": [
        144,
        208
      ],
      "parameters": {
        "workflowId": "56683859462521975",
        "inputParameters": {
          "parameters": [
            {
              "name": "business_category",
              "value": "dentists"
            },
            {
              "name": "city_location",
              "value": "Brooklyn"
            }
          ]
        },
        "additionalFields": {
          "saveBrowserData": false
        }
      },
      "credentials": {
        "browserActApi": {
          "id": "AzKMhR2eAlOjzDiJ",
          "name": "BrowserAct account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "35073d60-1922-4fec-a162-de41e3c3a037",
      "name": "获取工作流任务详情",
      "type": "n8n-nodes-browseract-workflows.browserAct",
      "position": [
        352,
        208
      ],
      "parameters": {
        "taskId": "={{ $json.id }}",
        "operation": "getTask",
        "maxWaitTime": 600,
        "waitForFinish": true,
        "pollingInterval": 20
      },
      "credentials": {
        "browserActApi": {
          "id": "AzKMhR2eAlOjzDiJ",
          "name": "BrowserAct account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "6efa3204-54af-4b38-95a7-9996028b6166",
      "name": "JavaScript代码",
      "type": "n8n-nodes-base.code",
      "position": [
        640,
        208
      ],
      "parameters": {
        "jsCode": "// Get the JSON string using the exact path provided by the user.\nconst jsonString = $input.first().json.output.string;\n\nlet parsedData;\n\n// Check if the string exists before attempting to parse\nif (!jsonString) {\n    // Return an empty array or throw an error if no string is found\n    // Throwing an error is usually better to stop the workflow if data is missing.\n    throw new Error(\"Input string is empty or missing at the specified path: $input.first().json.output.string\");\n}\n\ntry {\n    // 1. Parse the JSON string into a JavaScript array of objects\n    parsedData = JSON.parse(jsonString);\n} catch (error) {\n    // Handle JSON parsing errors (e.g., if the string is malformed)\n    throw new Error(`Failed to parse JSON string: ${error.message}`);\n}\n\n// 2. Ensure the parsed data is an array\nif (!Array.isArray(parsedData)) {\n    throw new Error('Parsed data is not an array. It cannot be split into multiple items.');\n}\n\n// 3. Map the array of objects into the n8n item format { json: object }\n// Each element in this array will be treated as a new item by n8n, achieving the split.\nconst outputItems = parsedData.map(item => ({\n    json: item,\n}));\n\n// 4. Return the new array of items\nreturn outputItems;"
      },
      "typeVersion": 2
    },
    {
      "id": "dc54c1f9-db58-48fd-92c1-45091fd18751",
      "name": "在表格中追加或更新行",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        944,
        208
      ],
      "parameters": {
        "columns": {
          "value": {
            "Address": "={{ $json.Location }}",
            "Category": "={{ $json.Business }}",
            "Company Name": "={{ $json.Name }}",
            "Phone Number": "={{ $json.Phone }}"
          },
          "schema": [
            {
              "id": "Company Name",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Company Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Category",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Category",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Phone Number",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Phone Number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Address",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Address",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Company Name"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 512924235,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/18sw7io0yJOTDzvcknGmjBBqtK154CLk3k0FoWJZbfI0/edit#gid=512924235",
          "cachedResultName": "Online Directory Lead Scraper (YP.com)"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "18sw7io0yJOTDzvcknGmjBBqtK154CLk3k0FoWJZbfI0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/18sw7io0yJOTDzvcknGmjBBqtK154CLk3k0FoWJZbfI0/edit?usp=drivesdk",
          "cachedResultName": "Test For BrowserAct"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "wAMAqU43zjVjlpuA",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "764d9961-c8f2-4b85-a30f-5953edec0645",
      "name": "便签 - 介绍",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -640,
        -160
      ],
      "parameters": {
        "width": 592,
        "height": 424,
        "content": "## 立即试用!"
      },
      "typeVersion": 1
    },
    {
      "id": "708ca10f-6d70-4b8d-8a28-4e551509b05f",
      "name": "便签 - 如何使用",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -640,
        272
      ],
      "parameters": {
        "width": 592,
        "height": 208,
        "content": "## 使用方法"
      },
      "typeVersion": 1
    },
    {
      "id": "e66f41b8-e129-4645-a969-fad9b7094770",
      "name": "便签 - 需要帮助",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -640,
        496
      ],
      "parameters": {
        "width": 336,
        "height": 120,
        "content": "### 需要帮助?"
      },
      "typeVersion": 1
    },
    {
      "id": "8ebf7b39-412f-42d1-b230-f5c6344c9e3e",
      "name": "便签 - 抓取阶段",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        96,
        0
      ],
      "parameters": {
        "color": 5,
        "width": 416,
        "height": 168,
        "content": "### 🌐 1. 抓取与等待"
      },
      "typeVersion": 1
    },
    {
      "id": "6bfa6f3c-b47f-4e8f-9d2d-8b49eb52a031",
      "name": "便签 - 处理阶段",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        528,
        0
      ],
      "parameters": {
        "color": 6,
        "width": 336,
        "height": 164,
        "content": "### 🧹 2. 解析与拆分数据"
      },
      "typeVersion": 1
    },
    {
      "id": "290deae8-3767-4144-a54b-6eee32210336",
      "name": "便签 - 输出阶段",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        880,
        384
      ],
      "parameters": {
        "color": 3,
        "width": 288,
        "content": "### 💾 3. 保存到 Google Sheets"
      },
      "typeVersion": 1
    },
    {
      "id": "897e4af5-b6c4-43c9-9dec-3ddf5d76aee8",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        96,
        192
      ],
      "parameters": {
        "color": 5,
        "width": 416,
        "height": 176,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "4fa7bfe9-c045-4768-9bb6-9e5331635a50",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        528,
        192
      ],
      "parameters": {
        "color": 6,
        "width": 336,
        "height": 176,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "31b49192-05ad-434b-8770-eb1bc279f607",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        880,
        192
      ],
      "parameters": {
        "color": 3,
        "width": 288,
        "height": 176,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "c36f1e00-e08c-421e-b5c2-4d9f5c5e47f8",
      "name": "便签 - 需要帮助1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -288,
        496
      ],
      "parameters": {
        "height": 120,
        "content": "### 工作流指南与展示"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "277b247a-08fc-41d5-8553-3f94d74b1793",
  "connections": {
    "Code in JavaScript": {
      "main": [
        [
          {
            "node": "Append or update row in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Run a workflow task": {
      "main": [
        [
          {
            "node": "Get details of a workflow task",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get details of a workflow task": {
      "main": [
        [
          {
            "node": "Code in JavaScript",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "Run a workflow task",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 潜在客户开发

需要付费吗?

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

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

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

作者
Madame AI Team | Kai

Madame AI Team | Kai

@madame-ai

I’m a PhD in Physics turned AI enthusiast, passionate about uncovering how AI is transforming content creation, business, and daily life.

外部链接
在 n8n.io 查看

分享此工作流