8
n8n 中文网amn8n.com

[LI] - 搜索个人资料

中级

这是一个Lead Generation领域的自动化工作流,包含 14 个节点。主要使用 Set, Code, Form, Switch, SplitOut 等节点。 使用SerpAPI谷歌搜索和表格收集LinkedIn个人资料

前置要求
  • Google Sheets API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "oghc0ynE1x8iSAgb",
  "meta": {
    "instanceId": "2295c029f4cb86c8f849f9c87dade323734dc279619eb9e2704f8473c381e4d1"
  },
  "name": "[LI] - 搜索个人资料",
  "tags": [],
  "nodes": [
    {
      "id": "55003493-01ab-4ea1-a22e-d2d97df0fa71",
      "name": "表单提交时",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -1536,
        48
      ],
      "webhookId": "9048da22-9150-4b78-9de3-e07ba9c25f57",
      "parameters": {
        "options": {},
        "formTitle": "LinkedIn Search",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Keywords (comma separated)",
              "requiredField": "={{ false }}"
            },
            {
              "fieldType": "number",
              "fieldLabel": "Pages to fetch",
              "requiredField": "={{ false }}"
            }
          ]
        },
        "responseMode": "lastNode"
      },
      "typeVersion": 2.3
    },
    {
      "id": "9a9b9b56-a179-41b6-a7ae-8723d92510de",
      "name": "格式化关键词",
      "type": "n8n-nodes-base.set",
      "position": [
        -1296,
        48
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "name": "keywords",
              "type": "string",
              "value": "={{ \n  (() => {\n    const keywords = $json[\"Keywords (comma separated)\"]\n      .split(',')\n      .map(k => k.trim())\n      .filter(Boolean);\n    return '(\"' + keywords.join('\") (\"') + '\")';\n  })()\n}}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "50b03fa5-2e7c-4e4a-a575-8ca09aa95e71",
      "name": "构建页面列表",
      "type": "n8n-nodes-base.code",
      "position": [
        -1008,
        48
      ],
      "parameters": {
        "jsCode": "// Build one item per requested page with the proper SerpAPI start offsets\nconst pagesRequested = parseInt($('On form submission').item.json['Pages to fetch'] ?? 1, 10) || 1;\nconst perPage = 10;\nconst ctx = {\n  keywordsGrouped: $('Format Keywords').item.json.keywords,\n  rawKeywords: $('On form submission').item.json['Keywords (comma separated)'],\n  submittedAt: $('On form submission').item.json.submittedAt\n};\nreturn Array.from({ length: pagesRequested }, (_, i) => ({\n  json: {\n    page: i,\n    start: $('On form submission').first().json['Page (offset)'] * perPage,\n    ...ctx\n  }\n}));"
      },
      "typeVersion": 2
    },
    {
      "id": "bc93179f-578b-4fd1-9701-8fefb5f3f650",
      "name": "SerpAPI 搜索",
      "type": "n8n-nodes-serpapi.serpApi",
      "position": [
        -480,
        64
      ],
      "parameters": {
        "q": "=site:pl.linkedin.com/in/ {{$json.keywordsGrouped}}",
        "location": "Warsaw,Masovian Voivodeship,Poland",
        "requestOptions": {},
        "additionalFields": {
          "start": "={{$json.start}}"
        }
      },
      "credentials": {
        "serpApi": {
          "id": "Jl6rNySnLrJlaonK",
          "name": "SerpApi account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "e3a373df-29f4-408d-a286-9a2761c30b49",
      "name": "检查返回了多少结果",
      "type": "n8n-nodes-base.switch",
      "position": [
        -256,
        64
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "Empty list",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "loose"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "number",
                      "operation": "equals"
                    },
                    "leftValue": "={{ parseInt($json.search_information.total_results) }}",
                    "rightValue": "=0"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Not empty list",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "loose"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "number",
                      "operation": "gt"
                    },
                    "leftValue": "={{ $json.search_information.total_results }}",
                    "rightValue": 0
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {},
        "looseTypeValidation": true
      },
      "typeVersion": 3.3
    },
    {
      "id": "aaa5aa78-d3c0-474b-8329-2a9f17012540",
      "name": "未找到个人资料",
      "type": "n8n-nodes-base.form",
      "position": [
        -80,
        -160
      ],
      "webhookId": "25b9af18-87bd-4e8f-b25c-2b7ee230b12a",
      "parameters": {
        "options": {},
        "operation": "completion",
        "completionTitle": "Response",
        "completionMessage": "No profiles found based on params."
      },
      "typeVersion": 2.3
    },
    {
      "id": "7529e706-afb5-4878-a388-2ff04fd67842",
      "name": "拆分输出",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        -80,
        288
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "organic_results"
      },
      "typeVersion": 1
    },
    {
      "id": "20e568aa-9be7-4d97-85f1-a01725300699",
      "name": "将全名获取为对象属性",
      "type": "n8n-nodes-base.code",
      "position": [
        112,
        288
      ],
      "parameters": {
        "jsCode": "for (const item of $input.all()) {\n  if (typeof item.json.title === 'string') {\n    item.json.fullName = item.json.title.split('-')[0].trim();\n  }\n}\nreturn $input.all();"
      },
      "typeVersion": 2
    },
    {
      "id": "c7331bd5-8680-4651-97f4-6a09c0b40fe2",
      "name": "在表格中追加个人资料",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        368,
        288
      ],
      "parameters": {
        "columns": {
          "value": {
            "Date": "={{ $('On form submission').item.json.submittedAt }}",
            "Profile": "={{ $json.link }}",
            "Keywords": "={{ $('On form submission').item.json['Keywords (comma separated)'] }}",
            "Full name": "={{ $json.fullName }}"
          },
          "schema": [
            {
              "id": "Date",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Full name",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Full name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Profile",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Profile",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Keywords",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Keywords",
              "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/1f_wxWdSr2hfmmRTWIHqpCKn6-63J0UUflFJnLj_M7ls/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1f_wxWdSr2hfmmRTWIHqpCKn6-63J0UUflFJnLj_M7ls",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1f_wxWdSr2hfmmRTWIHqpCKn6-63J0UUflFJnLj_M7ls/edit?usp=drivesdk",
          "cachedResultName": "[LI Profiles]"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "sgj6aGeryqEVmS3h",
          "name": "GSheets - Piotr.Sikora.Ck@gmail.com"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "119be8c8-5b9e-44a8-a845-2a2e34ed2baa",
      "name": "表单回复",
      "type": "n8n-nodes-base.form",
      "position": [
        -480,
        -384
      ],
      "webhookId": "25b9af18-87bd-4e8f-b25c-2b7ee230b12a",
      "parameters": {
        "options": {},
        "operation": "completion",
        "completionTitle": "Response",
        "completionMessage": "Check linked file"
      },
      "typeVersion": 2.3
    },
    {
      "id": "87fe340d-f481-4158-954a-136150adbdad",
      "name": "遍历项目",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -768,
        48
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "0b168e74-c995-4bd0-9b24-9bdf997c1570",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1392,
        -224
      ],
      "parameters": {
        "width": 288,
        "height": 432,
        "content": "## 将表单数据更改为查询"
      },
      "typeVersion": 1
    },
    {
      "id": "367edf17-e444-426b-aeb6-f6385fbbdff4",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -560,
        -64
      ],
      "parameters": {
        "color": 5,
        "height": 304,
        "content": "## Google 查询"
      },
      "typeVersion": 1
    },
    {
      "id": "6915509d-bba4-4ce3-83c5-65faa6599fbc",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        288,
        -16
      ],
      "parameters": {
        "color": 4,
        "height": 464,
        "content": "## 在 Google Sheet 中保存个人资料"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {
    "On form submission": [
      {
        "json": {
          "formMode": "test",
          "submittedAt": "2025-10-20T12:17:44.944+02:00",
          "Page (offset)": 4,
          "Pages to fetch": 2,
          "Keywords (comma separated)": "automotive, plant manager, kierownik, kielce"
        }
      }
    ]
  },
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "50438f28-0644-4777-b599-a257510b1f55",
  "connections": {
    "Split Out": {
      "main": [
        [
          {
            "node": "Get Full Name to property of object",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SerpAPI Search": {
      "main": [
        [
          {
            "node": "Check how many results are returned",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Page List": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Keywords": {
      "main": [
        [
          {
            "node": "Build Page List",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [
          {
            "node": "Form Response",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "SerpAPI Search",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On form submission": {
      "main": [
        [
          {
            "node": "Format Keywords",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Append profile in sheet": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check how many results are returned": {
      "main": [
        [
          {
            "node": "No profiles found",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Split Out",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Full Name to property of object": {
      "main": [
        [
          {
            "node": "Append profile in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 潜在客户开发

需要付费吗?

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

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

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

外部链接
在 n8n.io 查看

分享此工作流