8
n8n 中文网amn8n.com

使用Bright Data和Google搜索通过邮箱和域名查找丰富卖家数据

高级

这是一个Sales, AI, Marketing领域的自动化工作流,包含 32 个节点。主要使用 If, Set, Code, Html, Wait 等节点,结合人工智能技术实现智能自动化。 使用Bright Data和Google搜索通过邮箱和域名查找丰富卖家数据

前置要求
  • PostgreSQL 数据库连接信息
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "4e6be3a68285934388a854ac0ffdc5e5500688d5cdb88d0ec2d734e85f097355",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "45b55e87-08a0-44e5-a220-5d9110ac364e",
      "name": "当点击\"测试工作流\"时",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -1960,
        480
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "6daee671-8b07-4101-b57a-5dd7a9966c5e",
      "name": "Postgres1",
      "type": "n8n-nodes-base.postgres",
      "position": [
        3000,
        480
      ],
      "parameters": {
        "table": {
          "__rl": true,
          "mode": "name",
          "value": "=seller_data"
        },
        "schema": {
          "__rl": true,
          "mode": "list",
          "value": "public"
        },
        "columns": {
          "value": {
            "seller_id": "={{ $('Process by Batch').item.json.seller_id.toNumber() }}",
            "primary_email": "={{ $json.data[0].email }}"
          },
          "schema": [
            {
              "id": "seller_id",
              "type": "number",
              "display": true,
              "removed": false,
              "required": true,
              "displayName": "seller_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "seller_name",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "seller_name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "primary_email",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "primary_email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "company_info",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "company_info",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "trade_name",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "trade_name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "business_address",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "business_address",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "coc_number",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "coc_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "vat_number",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "vat_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "commercial_register",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "commercial_register",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "secondary_email",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "secondary_email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "domain",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "domain",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "seller_slug",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "seller_slug",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "source",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "source",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "seller_id"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update"
      },
      "credentials": {
        "postgres": {
          "id": "m6FHVVkUrN3xlE35",
          "name": "Postgres account"
        }
      },
      "typeVersion": 2.5
    },
    {
      "id": "b79a33a6-3d15-44cf-b043-3e33cdb09cbf",
      "name": "等待",
      "type": "n8n-nodes-base.wait",
      "position": [
        3620,
        1300
      ],
      "webhookId": "0cbffe1f-700c-4b66-967d-cc85398fc159",
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "b4e9b540-49f4-48d5-abf9-5008412a86bc",
      "name": "定时触发器",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -1960,
        720
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "minutes"
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "4847e2e0-8abe-4d10-b04b-85b4ee318c83",
      "name": "Postgres2",
      "type": "n8n-nodes-base.postgres",
      "position": [
        3020,
        1020
      ],
      "parameters": {
        "table": {
          "__rl": true,
          "mode": "name",
          "value": "seller_data"
        },
        "schema": {
          "__rl": true,
          "mode": "list",
          "value": "public"
        },
        "columns": {
          "value": {
            "seller_id": "={{ $('Switch').item.json.seller_id.toNumber() }}"
          },
          "schema": [
            {
              "id": "seller_id",
              "type": "number",
              "display": true,
              "removed": false,
              "required": true,
              "displayName": "seller_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "seller_name",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "seller_name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "primary_email",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "primary_email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "company_info",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "company_info",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "trade_name",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "trade_name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "business_address",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "business_address",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "coc_number",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "coc_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "vat_number",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "vat_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "commercial_register",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "commercial_register",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "secondary_email",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "secondary_email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "domain",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "domain",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "seller_slug",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "seller_slug",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "source",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "source",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "seller_id"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update"
      },
      "credentials": {
        "postgres": {
          "id": "m6FHVVkUrN3xlE35",
          "name": "Postgres account"
        }
      },
      "typeVersion": 2.5
    },
    {
      "id": "e513e68c-9fe6-48e9-98c9-fd2787926619",
      "name": "Google Calendar MCP",
      "type": "n8n-nodes-base.switch",
      "position": [
        -680,
        660
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "Domain exists",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "exists",
                      "singleValue": true
                    },
                    "leftValue": "={{ $json.domain }}",
                    "rightValue": ""
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "No domain but with business address and trade name",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "23e3cde8-3f9e-48d2-8353-b286df20d139",
                    "operator": {
                      "type": "boolean",
                      "operation": "true",
                      "singleValue": true
                    },
                    "leftValue": "={{ !$json.domain && $json.business_address && $json.trade_name ? true : false }}",
                    "rightValue": "=no_domain"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {
          "fallbackOutput": "extra"
        }
      },
      "typeVersion": 3.2
    },
    {
      "id": "5fa56857-8607-430d-ac9e-0105f377cfbe",
      "name": "代码",
      "type": "n8n-nodes-base.code",
      "position": [
        2320,
        840
      ],
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "function extractWebsiteName(url) {\n  //const newUrl = url || \"\"\n    const mainDomain = url.replace(/^(?:.*\\.)?([^\\.]+)\\.[^\\.]+$/, '$1');\n    console.log(mainDomain);\n    return mainDomain;\n}\n\nfunction normalizeName(name) {\n  if (!name) {\n    return null\n  }\n    return name.toLowerCase().replace(/[\\s&,.™®]/g, '');\n}\n\nfunction isWebsiteBelongsToCompany(url, sellerName, tradeName) {\n    const websiteName = extractWebsiteName(url);\n    console.log(\"websiteName: \" + websiteName);\n    if (!websiteName) return false;\n\n    const normalizedWebsiteName = websiteName.toLowerCase();\n    const normalizedSellerName = normalizeName(sellerName);\n    const normalizedTradeName = normalizeName(tradeName);\n\n    return normalizedWebsiteName.includes(normalizedSellerName) || \n           normalizedWebsiteName.includes(normalizedTradeName) ||\n           normalizedSellerName.includes(normalizedWebsiteName) ||\n           normalizedTradeName.includes(normalizedWebsiteName);\n}\n\ntry {\n\nconst url1 = $json.first_url;\nconst sellerName = $json.seller_name;\nconst tradeName = $json.trade_name;\n\nconst belongsToCompany1 = isWebsiteBelongsToCompany(url1, sellerName, tradeName);\nconsole.log(belongsToCompany1);\n\nconst url2 = $json.second_url;\nconst belongsToCompany2 = isWebsiteBelongsToCompany(url2, sellerName, tradeName);\nconsole.log(belongsToCompany2);\n\nfunction rootDomain(domain) {\n    return domain.replace(/^(?:www\\.)?(?:[^.]+\\.)?([^\\.]+\\.[^\\.]+)$/, '$1');\n}\n\nreturn {\n    rootDomain: belongsToCompany1 ? rootDomain(url1) : belongsToCompany2 ? rootDomain(url2) : null,\n    first_url: url1,\n    second_url: url2,\n    extracted_email: $json.extracted_email,\n    seller_name: sellerName,\n    trade_name: tradeName,\n    seller_slug: $json.seller_slug\n\n}\n\n    \n} catch (error) {\n  return {\n   rootDomain: null,\n   first_url: $json.first_url,\n   second_url: $json.second_url,\n   extracted_email: $json.extracted_email,\n   seller_name: $json.seller_name,\n   trade_name: $json.trade_name,\n   seller_slug: $json.seller_slug\n  }\n}"
      },
      "typeVersion": 2
    },
    {
      "id": "426cf1bc-f5e5-4f59-b727-b8baa5b715bb",
      "name": "Postgres3",
      "type": "n8n-nodes-base.postgres",
      "position": [
        3000,
        660
      ],
      "parameters": {
        "table": {
          "__rl": true,
          "mode": "name",
          "value": "=seller_data"
        },
        "schema": {
          "__rl": true,
          "mode": "list",
          "value": "public"
        },
        "columns": {
          "value": {
            "domain": "={{ $json.rootDomain }}",
            "seller_id": "={{ $('Process by Batch').item.json.seller_id.toNumber() }}",
            "primary_email": "={{ $json.extracted_email }}"
          },
          "schema": [
            {
              "id": "seller_id",
              "type": "number",
              "display": true,
              "removed": false,
              "required": true,
              "displayName": "seller_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "seller_name",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "seller_name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "primary_email",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "primary_email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "company_info",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "company_info",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "trade_name",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "trade_name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "business_address",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "business_address",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "coc_number",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "coc_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "vat_number",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "vat_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "commercial_register",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "commercial_register",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "secondary_email",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "secondary_email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "domain",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "domain",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "seller_slug",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "seller_slug",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "source",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "source",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "seller_id"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update"
      },
      "credentials": {
        "postgres": {
          "id": "m6FHVVkUrN3xlE35",
          "name": "Postgres account"
        }
      },
      "typeVersion": 2.5
    },
    {
      "id": "e399a71c-46d2-4930-89a6-f976987ed3b3",
      "name": "开关1",
      "type": "n8n-nodes-base.switch",
      "position": [
        2580,
        840
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "extracted email matches the first two domains",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "boolean",
                      "operation": "true",
                      "singleValue": true
                    },
                    "leftValue": "={{ $json.extracted_email && $json.rootDomain && $json.extracted_email.includes($json.rootDomain) ? true : false }}",
                    "rightValue": ""
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "domain does not match with extracted email",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "08bd4bcb-44da-4a2b-9687-8216e24869cc",
                    "operator": {
                      "type": "boolean",
                      "operation": "true",
                      "singleValue": true
                    },
                    "leftValue": "={{ $json.extracted_email && $json.rootDomain && !$json.extracted_email.includes($json.rootDomain) ? true : false }}",
                    "rightValue": ""
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "no extracted email but with root domain",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "059ab924-f2e7-4d8f-99c6-c63eb3fd90c7",
                    "operator": {
                      "type": "boolean",
                      "operation": "true",
                      "singleValue": true
                    },
                    "leftValue": "={{ !$json.extracted_email && $json.rootDomain ? true : false }}",
                    "rightValue": ""
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {
          "fallbackOutput": "extra"
        }
      },
      "typeVersion": 3.2
    },
    {
      "id": "00cfa54d-3776-4564-8a22-d15b27b8effe",
      "name": "Postgres4",
      "type": "n8n-nodes-base.postgres",
      "position": [
        3000,
        840
      ],
      "parameters": {
        "table": {
          "__rl": true,
          "mode": "name",
          "value": "seller_data"
        },
        "schema": {
          "__rl": true,
          "mode": "list",
          "value": "public"
        },
        "columns": {
          "value": {
            "domain": "={{ $json.rootDomain }}",
            "seller_id": "={{ $('Process by Batch').item.json.seller_id.toNumber() }}"
          },
          "schema": [
            {
              "id": "seller_id",
              "type": "number",
              "display": true,
              "removed": false,
              "required": true,
              "displayName": "seller_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "seller_name",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "seller_name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "primary_email",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "primary_email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "company_info",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "company_info",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "trade_name",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "trade_name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "business_address",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "business_address",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "coc_number",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "coc_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "vat_number",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "vat_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "commercial_register",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "commercial_register",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "secondary_email",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "secondary_email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "domain",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "domain",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "seller_slug",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "seller_slug",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "source",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "source",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "seller_id"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update"
      },
      "credentials": {
        "postgres": {
          "id": "m6FHVVkUrN3xlE35",
          "name": "Postgres account"
        }
      },
      "typeVersion": 2.5
    },
    {
      "id": "dbe77304-ba70-49d7-81ee-3afffcae7820",
      "name": "等待1",
      "type": "n8n-nodes-base.wait",
      "position": [
        420,
        560
      ],
      "webhookId": "20502d1a-b672-4e6d-ac2e-9c5f997ab1dc",
      "parameters": {
        "amount": 2
      },
      "typeVersion": 1.1
    },
    {
      "id": "34d5cbe7-2c3f-4bfd-888b-e0a4f81cd962",
      "name": "编辑字段",
      "type": "n8n-nodes-base.set",
      "position": [
        1680,
        720
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "0ba46b0e-093f-480a-8ae7-20f826c643a9",
              "name": "first_url",
              "type": "string",
              "value": "={{ $('HTML1').item.json.element[0].match(/https?:\\/\\/[^\\s/$.?#].[^\\s]*/g).filter(item => !item.includes(\"google\"))[0] }}"
            },
            {
              "id": "9533866a-04b5-4ef2-82da-98017d6ace77",
              "name": "extracted_email",
              "type": "string",
              "value": "={{ $('HTML1').item.json.element.join().match(/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}/)[0] }}"
            },
            {
              "id": "fd0f8699-772a-4525-8122-68a7ed27f2db",
              "name": "second_url",
              "type": "string",
              "value": "={{ $('HTML1').item.json.element[1].match(/https?:\\/\\/[^\\s/$.?#].[^\\s]*/g).filter(item => !item.includes(\"google\"))[0] }}"
            },
            {
              "id": "b3e2f080-1174-4f61-a258-86b7f5c468e1",
              "name": "seller_name",
              "type": "string",
              "value": "={{ $('Switch').item.json.seller_name }}"
            },
            {
              "id": "d990a86d-ecef-469b-b344-771956093011",
              "name": "trade_name",
              "type": "string",
              "value": "={{ $('Switch').item.json.trade_name }}"
            },
            {
              "id": "37c43cb0-cb53-4098-9074-ea228b71d820",
              "name": "seller_slug",
              "type": "string",
              "value": "={{ $('Switch').item.json.seller_slug }}"
            },
            {
              "id": "194e5535-399b-4cb1-8935-361eedf1f983",
              "name": "rootDomain",
              "type": "string",
              "value": "={{ $('HTML1').item.json.element[0].match(/https?:\\/\\/[^\\s/$.?#].[^\\s]*/g).filter(item => !item.includes(\"google\"))[0].extractDomain() }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "759cac41-3a78-499d-b529-8ae6f4bb51ea",
      "name": "按批次处理",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -960,
        640
      ],
      "parameters": {
        "options": {},
        "batchSize": 5
      },
      "typeVersion": 3
    },
    {
      "id": "2a432d7a-cbe8-4334-b8c2-febfe5696c83",
      "name": "BrightData",
      "type": "n8n-nodes-brightdata.brightData",
      "position": [
        -120,
        240
      ],
      "parameters": {
        "url": "=https://www.google.com/search?q={{ $json.domain }}+email",
        "zone": {
          "__rl": true,
          "mode": "list",
          "value": "web_unlocker1",
          "cachedResultName": "web_unlocker1"
        },
        "format": "json",
        "country": {
          "__rl": true,
          "mode": "list",
          "value": "us"
        },
        "requestOptions": {}
      },
      "credentials": {
        "brightdataApi": {
          "id": "DQaiy0yJ0lNutzIl",
          "name": "BrightData account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "db49e284-72b4-41b7-8ca1-96335c46e11f",
      "name": "BrightData1",
      "type": "n8n-nodes-brightdata.brightData",
      "position": [
        800,
        720
      ],
      "parameters": {
        "url": "=https://www.google.com/search?q=email+{{ encodeURIComponent($('Switch').item.json.trade_name || $('Switch').item.json.seller_name) }}+{{ encodeURIComponent($('Switch').item.json.business_address) }}",
        "zone": {
          "__rl": true,
          "mode": "list",
          "value": "web_unlocker1",
          "cachedResultName": "web_unlocker1"
        },
        "format": "json",
        "country": {
          "__rl": true,
          "mode": "list",
          "value": "us"
        },
        "requestOptions": {}
      },
      "credentials": {
        "brightdataApi": {
          "id": "DQaiy0yJ0lNutzIl",
          "name": "BrightData account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "312ff218-353d-4d2c-a7e4-6a2bc133f828",
      "name": "HTML",
      "type": "n8n-nodes-base.html",
      "position": [
        40,
        240
      ],
      "parameters": {
        "options": {},
        "operation": "extractHtmlContent",
        "dataPropertyName": "body",
        "extractionValues": {
          "values": [
            {
              "key": "element",
              "cssSelector": "div[jscontroller] .N54PNb",
              "returnArray": true,
              "skipSelectors": "img"
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "e1ec0679-fde7-4a62-b162-dc3a6be50b8e",
      "name": "HTML1",
      "type": "n8n-nodes-base.html",
      "position": [
        980,
        720
      ],
      "parameters": {
        "options": {},
        "operation": "extractHtmlContent",
        "dataPropertyName": "body",
        "extractionValues": {
          "values": [
            {
              "key": "element",
              "cssSelector": "div[jscontroller] .N54PNb",
              "returnArray": true,
              "skipSelectors": "img"
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "ea68bca8-7f10-49d3-a14d-e46cc4c793ba",
      "name": "拆分输出",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        360,
        240
      ],
      "parameters": {
        "options": {
          "destinationFieldName": "email"
        },
        "fieldToSplitOut": "emails"
      },
      "typeVersion": 1
    },
    {
      "id": "02b202cd-1a45-49a5-997a-35a692598f02",
      "name": "过滤器",
      "type": "n8n-nodes-base.filter",
      "position": [
        500,
        240
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "a07e75fc-522c-4861-a842-cf880c398a44",
              "operator": {
                "type": "string",
                "operation": "contains"
              },
              "leftValue": "={{ $json.email }}",
              "rightValue": "={{ $('Process by Batch').item.json.domain.replace(/^(?:www\\.)?(?:[^.]+\\.)?([^\\.]+\\.[^\\.]+)$/, '$1').toLowerCase() }}"
            }
          ]
        }
      },
      "typeVersion": 2.2,
      "alwaysOutputData": true
    },
    {
      "id": "f15a901a-5225-4450-949b-6fb5769c6564",
      "name": "聚合",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        660,
        240
      ],
      "parameters": {
        "options": {},
        "aggregate": "aggregateAllItemData"
      },
      "typeVersion": 1
    },
    {
      "id": "a403ff04-ed4e-43f4-abd6-261173b7d63d",
      "name": "代码2",
      "type": "n8n-nodes-base.code",
      "position": [
        1140,
        720
      ],
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "function extractEmails(text) {\n    // Regular expression to match most common email patterns\n    const emailRegex = /[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}/g;\n    // matchAll returns an iterator so we spread it into an array\n    const matches = [...text.matchAll(emailRegex)];\n    return matches.map(match => decodeURI(match[0]).trim());\n}\n\n\nconst sampleText = $json.element.join();\nconst emails = extractEmails(sampleText);\nconsole.log(emails);  // Expected: [ 'sales@example.com', 'support@example.org', 'info@example.co.uk' ]\nreturn {emails}\n"
      },
      "typeVersion": 2
    },
    {
      "id": "4fd9ec2d-14e4-4765-bdad-1e33dd93d8c1",
      "name": "拆分输出1",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        1280,
        720
      ],
      "parameters": {
        "options": {
          "destinationFieldName": "email"
        },
        "fieldToSplitOut": "emails"
      },
      "typeVersion": 1
    },
    {
      "id": "69e9a05d-9b30-409e-a94b-888828aa5dc1",
      "name": "过滤器1",
      "type": "n8n-nodes-base.filter",
      "position": [
        1400,
        720
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "a07e75fc-522c-4861-a842-cf880c398a44",
              "operator": {
                "type": "string",
                "operation": "contains"
              },
              "leftValue": "={{ $json.email }}",
              "rightValue": "={{ $('Process by Batch').item.json.domain.replace(/^(?:www\\.)?(?:[^.]+\\.)?([^\\.]+\\.[^\\.]+)$/, '$1').toLowerCase() }}"
            }
          ]
        }
      },
      "typeVersion": 2.2,
      "alwaysOutputData": true
    },
    {
      "id": "a317567a-1d69-41b8-bab1-f656627381e4",
      "name": "如果2",
      "type": "n8n-nodes-base.if",
      "position": [
        1900,
        720
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "bcb1a1ee-0720-4cbd-ae3c-cb4ebca5acfa",
              "operator": {
                "type": "string",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $json.data[0]?.email }}",
              "rightValue": 0
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "6ec5cc13-8e67-43a7-bec3-81b8ba8121b7",
      "name": "聚合",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        1540,
        720
      ],
      "parameters": {
        "options": {},
        "aggregate": "aggregateAllItemData"
      },
      "typeVersion": 1
    },
    {
      "id": "3f62b698-1948-45cf-bf70-467dd36e7c81",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -160,
        40
      ],
      "parameters": {
        "width": 1000,
        "height": 460,
        "content": "## 使用 Bright Data 在 Google 中搜索域名+邮箱"
      },
      "typeVersion": 1
    },
    {
      "id": "30aa345b-90d1-4012-a3ba-81194ad676a1",
      "name": "检查邮箱是否存在",
      "type": "n8n-nodes-base.if",
      "position": [
        920,
        240
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "bcb1a1ee-0720-4cbd-ae3c-cb4ebca5acfa",
              "operator": {
                "type": "string",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $json.data[0]?.email }}",
              "rightValue": 0
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "4da7a7a8-3eca-4f20-af2f-9fc0baf9b9b0",
      "name": "提取电子邮件",
      "type": "n8n-nodes-base.code",
      "position": [
        200,
        240
      ],
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "function extractEmails(text) {\n    // Regular expression to match most common email patterns\n    const emailRegex = /[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}/g;\n    // matchAll returns an iterator so we spread it into an array\n    const matches = [...text.matchAll(emailRegex)];\n    return matches.map(match => decodeURI(match[0]).trim());\n}\n\n\nconst sampleText = $json.element.join();\nconst emails = extractEmails(sampleText);\nconsole.log(emails);  // Expected: [ 'sales@example.com', 'support@example.org', 'info@example.co.uk' ]\nreturn {emails}\n"
      },
      "typeVersion": 2
    },
    {
      "id": "43557ff1-642c-41b3-b6e9-cfc5de650428",
      "name": "读取数据库",
      "type": "n8n-nodes-base.postgres",
      "position": [
        -1280,
        640
      ],
      "parameters": {
        "sort": {
          "values": [
            {
              "column": "seller_id"
            }
          ]
        },
        "limit": 60,
        "table": {
          "__rl": true,
          "mode": "name",
          "value": "seller_data"
        },
        "where": {
          "values": [
            {
              "column": "primary_email",
              "condition": "IS NULL"
            }
          ]
        },
        "schema": {
          "__rl": true,
          "mode": "list",
          "value": "public"
        },
        "options": {},
        "operation": "select"
      },
      "credentials": {
        "postgres": {
          "id": "m6FHVVkUrN3xlE35",
          "name": "Postgres account"
        }
      },
      "typeVersion": 2.5
    },
    {
      "id": "5ae7d1e1-c626-4553-85c0-07c5f3ea96c6",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        720,
        560
      ],
      "parameters": {
        "width": 1140,
        "height": 460,
        "content": "## 使用 Bright Data 在 Google 中搜索卖家名称+地址+邮箱"
      },
      "typeVersion": 1
    },
    {
      "id": "7dfb9013-7c0e-43d0-ba44-afb02ed0834e",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2240,
        340
      ],
      "parameters": {
        "width": 980,
        "height": 960,
        "content": "## 清理数据并保存到 Postgres 数据库"
      },
      "typeVersion": 1
    },
    {
      "id": "2034fa79-9c65-4cd8-9b74-f9f9301310f5",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1340,
        460
      ],
      "parameters": {
        "width": 960,
        "height": 540,
        "content": "## 读取并遍历数据库"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "If2": {
      "main": [
        [
          {
            "node": "Postgres1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code": {
      "main": [
        [
          {
            "node": "Switch1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTML": {
      "main": [
        [
          {
            "node": "Extract Emails",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "Process by Batch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code2": {
      "main": [
        [
          {
            "node": "Split Out1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTML1": {
      "main": [
        [
          {
            "node": "Code2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait1": {
      "main": [
        [
          {
            "node": "BrightData1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter": {
      "main": [
        [
          {
            "node": "Aggregate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "BrightData",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "BrightData1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Postgres2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter1": {
      "main": [
        [
          {
            "node": "Aggregate1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch1": {
      "main": [
        [
          {
            "node": "Postgres3",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Postgres4",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Postgres4",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Postgres2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate": {
      "main": [
        [
          {
            "node": "Check if email exists",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Postgres1": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Postgres2": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Postgres3": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Postgres4": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out": {
      "main": [
        [
          {
            "node": "Filter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate1": {
      "main": [
        [
          {
            "node": "Edit Fields3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "BrightData": {
      "main": [
        [
          {
            "node": "HTML",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out1": {
      "main": [
        [
          {
            "node": "Filter1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "BrightData1": {
      "main": [
        [
          {
            "node": "HTML1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields3": {
      "main": [
        [
          {
            "node": "If2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Emails": {
      "main": [
        [
          {
            "node": "Split Out",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Process by Batch": {
      "main": [
        [],
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Read the Database",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read the Database": {
      "main": [
        [
          {
            "node": "Process by Batch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check if email exists": {
      "main": [
        [
          {
            "node": "Postgres1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Test workflow’": {
      "main": [
        [
          {
            "node": "Read the Database",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 销售, 人工智能, 营销

需要付费吗?

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

工作流信息
难度等级
高级
节点数量32
分类3
节点类型15
难度说明

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

作者
外部链接
在 n8n.io 查看

分享此工作流