8
n8n 中文网amn8n.com

使用自动分页将LinkedIn Sales Navigator联系人提取到Google Sheets

中级

这是一个Content Creation, Multimodal AI领域的自动化工作流,包含 15 个节点。主要使用 If, Set, Code, Wait, HttpRequest 等节点。 使用自动分页将LinkedIn Sales Navigator联系人提取到Google Sheets

前置要求
  • 可能需要目标 API 的认证凭证
  • Google Sheets API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "8d41476c63702cd0f2be55363b48153c5d4820bb18197ca147e7be50ef236112",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "120b55a2-ed29-4a35-9265-18940cee8b21",
      "name": "抓取 LinkedIn 联系人 API",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -768,
        -32
      ],
      "parameters": {
        "url": "https://api.nickautomations.com/linkedin/scrape",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "authentication": "genericCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "cookies",
              "value": "={{ $json.cookies }}"
            },
            {
              "name": "url",
              "value": "={{ $json.url }}"
            },
            {
              "name": "scraper_type",
              "value": "={{ $json.scraper_type }}"
            },
            {
              "name": "start",
              "value": "={{ $json.start }}"
            }
          ]
        },
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "EIsUiqyM6Juv63hK",
          "name": "[linkedin-scraper-api] Header Auth"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "93f2cf65-a67c-4f8d-9512-6ab51bdfb973",
      "name": "提取联系人数据数组",
      "type": "n8n-nodes-base.code",
      "position": [
        -544,
        -32
      ],
      "parameters": {
        "jsCode": "// Get all items from the previous node\nconst items = $input.all();\n\n// Assuming the payload is in the first item\nconst payload = items[0].json;\n\n// Return the nested 'data' array for the next node\nreturn payload.data;"
      },
      "typeVersion": 2
    },
    {
      "id": "3f8a9eb7-0df9-4464-a3cd-ae2ca5db2d55",
      "name": "保存联系人到 Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -320,
        -32
      ],
      "parameters": {
        "columns": {
          "value": {
            "id": "={{ $json.id }}",
            "title": "={{ $json.title }}",
            "fullName": "={{ $json.fullName }}",
            "industry": "={{ $json.industry }}",
            "lastName": "={{ $json.lastName }}",
            "location": "={{ $json.location }}",
            "firstName": "={{ $json.firstName }}",
            "profileUrl": "={{ 'https://www.linkedin.com/in/' + $json.entityUrn.split('(')[1].split(',')[0] }}",
            "companyName": "={{ $json.companyName }}",
            "companyLocation": "={{ $json.companyLocation }}"
          },
          "schema": [
            {
              "id": "id",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "id",
              "defaultMatch": true,
              "canBeUsedToMatch": true
            },
            {
              "id": "firstName",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "firstName",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "lastName",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "lastName",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "fullName",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "fullName",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "location",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "location",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "title",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "title",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "companyName",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "companyName",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "companyLocation",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "companyLocation",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "industry",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "industry",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "profileUrl",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "profileUrl",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "id"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1IZUmM6cTe4Fmona9tWcfX6A0F4G0Di4VyZUhxKAbp0M/edit#gid=0",
          "cachedResultName": "LinkedIn Contacts"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1IZUmM6cTe4Fmona9tWcfX6A0F4G0Di4VyZUhxKAbp0M",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1IZUmM6cTe4Fmona9tWcfX6A0F4G0Di4VyZUhxKAbp0M/edit?usp=drivesdk",
          "cachedResultName": "LinkedIn Contacts"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "V4NHfo08zBK4IW4e",
          "name": "[Naveen]Google Sheets account"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "a8d46ea2-2543-4f9d-ab03-07f3b0347a87",
      "name": "检查是否有更多页面可用",
      "type": "n8n-nodes-base.if",
      "position": [
        -96,
        -32
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "81c52d64-e7d8-4d23-aaba-6befa2f6e46a",
              "operator": {
                "type": "number",
                "operation": "lt"
              },
              "leftValue": "={{ $('Scrape LinkedIn Contacts API').item.json.paging.start - $('Set Search Parameters').item.json.start/25 }}",
              "rightValue": "={{ $('Set Search Parameters').item.json.total_pages }}"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "e18e663a-f637-4df9-a4fb-c5c9b4b6fcf0",
      "name": "递增页面起始参数",
      "type": "n8n-nodes-base.set",
      "position": [
        128,
        -48
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "9b805fcd-3929-464c-8338-d8c365873c0b",
              "name": "start",
              "type": "number",
              "value": "={{ $('Scrape LinkedIn Contacts API').item.json.paging.start + 25 }}"
            }
          ]
        }
      },
      "executeOnce": true,
      "typeVersion": 3.4
    },
    {
      "id": "ddf0bf2a-6395-4afe-8e50-dc954a0889af",
      "name": "请求间的速率限制延迟",
      "type": "n8n-nodes-base.wait",
      "position": [
        352,
        48
      ],
      "webhookId": "ba610b94-c1e1-40cf-9136-061cdfdebb15",
      "parameters": {
        "amount": "={{ Math.floor(Math.random() * (60 - 30 + 1)) + 30 }}"
      },
      "typeVersion": 1.1
    },
    {
      "id": "b6f3aefc-aae0-48a3-b812-5c628f8d9a98",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1232,
        -224
      ],
      "parameters": {
        "width": 416,
        "height": 224,
        "content": "### 配置设置"
      },
      "typeVersion": 1
    },
    {
      "id": "1110cbb4-a93c-4aa4-b5f9-7229487dda40",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -704,
        -240
      ],
      "parameters": {
        "color": 5,
        "width": 496,
        "height": 192,
        "content": "### 抓取过程"
      },
      "typeVersion": 1
    },
    {
      "id": "15dabc04-686b-4273-b7e7-3d7efe326681",
      "name": "便签 2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -128,
        -240
      ],
      "parameters": {
        "color": 4,
        "width": 416,
        "height": 192,
        "content": "### 分页逻辑"
      },
      "typeVersion": 1
    },
    {
      "id": "fd5eafc2-36c6-4e86-87d5-3d74f2b9396e",
      "name": "便签 3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        112,
        240
      ],
      "parameters": {
        "color": 3,
        "width": 416,
        "content": "### 速率限制保护**(请勿降低此值)**"
      },
      "typeVersion": 1
    },
    {
      "id": "9a22691a-daa3-4fba-bc83-ad90f86134e5",
      "name": "便签 4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1680,
        -48
      ],
      "parameters": {
        "color": 6,
        "width": 400,
        "height": 400,
        "content": "## 获取1个月免费 API 访问"
      },
      "typeVersion": 1
    },
    {
      "id": "d8ec7f32-3a28-45c3-b4ff-1419016af252",
      "name": "便签 5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -944,
        256
      ],
      "parameters": {
        "color": 2,
        "width": 720,
        "height": 352,
        "content": "### 如何获取 LinkedIn Cookies"
      },
      "typeVersion": 1
    },
    {
      "id": "d78e5f9b-2047-4994-83dc-d35d1bd7585e",
      "name": "启动工作流",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -1216,
        48
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "5bdef910-db46-47f9-8e2a-dd2ac16b563f",
      "name": "设置搜索参数",
      "type": "n8n-nodes-base.set",
      "position": [
        -992,
        48
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "ef3bbffa-8a91-4477-b930-b2089fdb5d04",
              "name": "cookies",
              "type": "array",
              "value": "[YOUR_COOKIES_HERE]"
            },
            {
              "id": "26025d17-4e8c-48df-aaa2-60b5bfa0d021",
              "name": "url",
              "type": "string",
              "value": "[YOUR_SALES_NAVIGATOR_SEARCH_URL_HERE]"
            },
            {
              "id": "3fb93134-cc12-4e83-ae2e-387de3c01f74",
              "name": "scraper_type",
              "type": "string",
              "value": "contacts"
            },
            {
              "id": "5bd33944-beb4-4aa0-a617-b25d9759d690",
              "name": "start",
              "type": "number",
              "value": "={{ $input.first()?.json?.start ?? 0 }}"
            },
            {
              "id": "1cfc15c1-6bfb-4ded-bdb8-6076cdd008ef",
              "name": "total_pages",
              "type": "number",
              "value": 2
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "ce0fa21f-039e-43dd-9c56-20f3a69b4cae",
      "name": "便签6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2528,
        -208
      ],
      "parameters": {
        "width": 752,
        "height": 816,
        "content": "## LinkedIn Sales Navigator 到 Google Sheets 抓取器"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "Start Workflow": {
      "main": [
        [
          {
            "node": "Set Search Parameters",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Search Parameters": {
      "main": [
        [
          {
            "node": "Scrape LinkedIn Contacts API",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Contact Data Array": {
      "main": [
        [
          {
            "node": "Save Contacts to Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Scrape LinkedIn Contacts API": {
      "main": [
        [
          {
            "node": "Extract Contact Data Array",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check If More Pages Available": {
      "main": [
        [
          {
            "node": "Increment Page Start Parameter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Increment Page Start Parameter": {
      "main": [
        [
          {
            "node": "Rate Limit Delay Between Requests",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save Contacts to Google Sheets": {
      "main": [
        [
          {
            "node": "Check If More Pages Available",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Rate Limit Delay Between Requests": {
      "main": [
        [
          {
            "node": "Set Search Parameters",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 内容创作, 多模态 AI

需要付费吗?

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

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

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

作者
Naveen Choudhary

Naveen Choudhary

@n8nstein

I create AI-driven n8n workflows that turn repetitive tasks into smooth, hands-off automations. Want to explore an idea? Book a quick consult: https://cal.com/nickchoudhary/30min

外部链接
在 n8n.io 查看

分享此工作流