8
n8n 中文网amn8n.com

使用 Bright Data 抓取即将发生的事件

中级

这是一个AI领域的自动化工作流,包含 11 个节点。主要使用 Code, Html, HttpRequest, GoogleSheets, ScheduleTrigger 等节点,结合人工智能技术实现智能自动化。 使用 Bright Data 和 n8n 的自动化事件发现

前置要求
  • 可能需要目标 API 的认证凭证
  • Google Sheets API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "NY5tq9f8iYwpvPC6",
  "meta": {
    "instanceId": "60046904b104f0f72b2629a9d88fe9f676be4035769f1f08dad1dd38a76b9480"
  },
  "name": "使用 Bright Data 抓取即将发生的事件",
  "tags": [],
  "nodes": [
    {
      "id": "5012cf3e-7fa6-4971-906b-760baeb51396",
      "name": "触发器 - 每周运行",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -440,
        1160
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "weeks",
              "triggerAtDay": [
                1
              ],
              "triggerAtHour": 8
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "8962483b-d095-4ade-bf9c-c3bfa5fe1831",
      "name": "使用 Bright Data 抓取活动网站",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -200,
        1160
      ],
      "parameters": {
        "url": "https://api.brightdata.com/request",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "sendHeaders": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "zone",
              "value": "n8n_unblocker"
            },
            {
              "name": "url",
              "value": "https://www.eventbrite.com/d/online/technology--events/"
            },
            {
              "name": "country",
              "value": "us"
            },
            {
              "name": "format",
              "value": "raw"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer API_KEY"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "12d62c8b-047d-4890-85f7-c9a8097fcc2d",
      "name": "解析 HTML - 提取活动卡片",
      "type": "n8n-nodes-base.html",
      "position": [
        60,
        1160
      ],
      "parameters": {
        "options": {},
        "operation": "extractHtmlContent",
        "extractionValues": {
          "values": [
            {
              "key": "Title",
              "cssSelector": "h3",
              "returnArray": true
            },
            {
              "key": "Date and Time",
              "cssSelector": "div.Stack_root__1ksk7 > p:nth-of-type(1)",
              "returnArray": true
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "df0d0e23-1afe-4c74-b408-e5b3123c13a4",
      "name": "格式化活动数据",
      "type": "n8n-nodes-base.code",
      "position": [
        280,
        1160
      ],
      "parameters": {
        "jsCode": "// Get the input data from the previous node\nconst inputData = items[0].json;\n\n// Access the arrays from the input object\nconst titles = inputData.Title;\nconst dates = inputData['Date and Time'];\n\n// Use a Set to track titles we've already processed to remove duplicates\nconst seenTitles = new Set();\nconst cleanedEvents = [];\n\n// Get the number of actual events (the input has duplicates)\nconst eventCount = dates.length;\n\nfor (let i = 0; i < eventCount; i++) {\n  const title = titles[i];\n  const date = dates[i];\n\n  // 1. Skip if the title is empty or we've already processed this event\n  if (!title || seenTitles.has(title)) {\n    continue;\n  }\n\n  // 2. Filter out irrelevant \"Trends\" items that start with a number (e.g., \"1. Tickets\")\n  if (/^\\d+\\.\\s/.test(title)) {\n    continue;\n  }\n  \n  // 3. Add the unique event to our results (without the URL)\n  cleanedEvents.push({\n    \"Title\": title,\n    \"Date and Time\": date\n  });\n\n  // 4. Mark this title as seen to avoid adding it again\n  seenTitles.add(title);\n}\n\n// Return the newly structured and cleaned array of event objects\nreturn cleanedEvents;"
      },
      "typeVersion": 2
    },
    {
      "id": "c58d917f-d756-45ad-a38a-b52254250154",
      "name": "保存到 Google Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        580,
        1160
      ],
      "parameters": {
        "columns": {
          "value": {
            "Title": "={{ $json.Title }}",
            "Date & Time": "={{ $json['Date and Time'] }}"
          },
          "schema": [
            {
              "id": "Title",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Title",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Date & Time",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Date & Time",
              "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/157HRnzYP9IShr4jTQH7_y3r35cq2NVu0hv7kAW9kqn0/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "157HRnzYP9IShr4jTQH7_y3r35cq2NVu0hv7kAW9kqn0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/157HRnzYP9IShr4jTQH7_y3r35cq2NVu0hv7kAW9kqn0/edit?usp=drivesdk",
          "cachedResultName": "Events"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "r2mDaisH6e9VkwHl",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "ed7d1601-99b4-4191-b75c-cb7060a42bc5",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -480,
        460
      ],
      "parameters": {
        "color": 5,
        "width": 440,
        "height": 880,
        "content": "## 🧩 第一部分:🔄 **触发器 + 抓取网站内容**"
      },
      "typeVersion": 1
    },
    {
      "id": "24726d95-f802-45e8-868d-575ce6453580",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        0
      ],
      "parameters": {
        "color": 6,
        "width": 420,
        "height": 1340,
        "content": "## 🧩 第二部分:🔍 **提取和构建活动数据**"
      },
      "typeVersion": 1
    },
    {
      "id": "834b6789-b284-49e0-86ba-a9d803fb52aa",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        460,
        540
      ],
      "parameters": {
        "color": 3,
        "width": 340,
        "height": 800,
        "content": "## 🧩 第三部分:📄 **将活动存储到 Google Sheets**"
      },
      "typeVersion": 1
    },
    {
      "id": "48ecec93-c46c-4398-ab14-bcfe617b0728",
      "name": "便签9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2140,
        480
      ],
      "parameters": {
        "color": 4,
        "width": 1300,
        "height": 320,
        "content": "======================================="
      },
      "typeVersion": 1
    },
    {
      "id": "4bceecb8-56d2-47d7-8833-92f29af8f2fa",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2140,
        820
      ],
      "parameters": {
        "color": 4,
        "width": 1289,
        "height": 2298,
        "content": "### 🎓 **自动网络研讨会采集器**"
      },
      "typeVersion": 1
    },
    {
      "id": "197d2ec1-609e-4905-8671-e41ed6ceb92f",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        900,
        540
      ],
      "parameters": {
        "color": 7,
        "width": 380,
        "height": 240,
        "content": "## 如果您通过此链接加入Bright Data,我将获得少量佣金——感谢您支持更多免费内容!"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "b59d50da-e665-47a2-975b-432971342df5",
  "connections": {
    "Format Event Data": {
      "main": [
        [
          {
            "node": "Save to Google Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Trigger - Weekly Run": {
      "main": [
        [
          {
            "node": "Scrape event website using bright data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse HTML - Extract Event Cards": {
      "main": [
        [
          {
            "node": "Format Event Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Scrape event website using bright data": {
      "main": [
        [
          {
            "node": "Parse HTML - Extract Event Cards",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 人工智能

需要付费吗?

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

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

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

作者
Yaron Been

Yaron Been

@yaron-nofluff

Building AI Agents and Automations | Growth Marketer | Entrepreneur | Book Author & Podcast Host If you need any help with Automations, feel free to reach out via linkedin: https://www.linkedin.com/in/yaronbeen/ And check out my Youtube channel: https://www.youtube.com/@YaronBeen/videos

外部链接
在 n8n.io 查看

分享此工作流