8
n8n 中文网amn8n.com

YouTube频道智能收集器

中级

这是一个Marketing领域的自动化工作流,包含 15 个节点。主要使用 Set, Code, HttpRequest, GoogleSheets, GoogleSheetsTrigger 等节点。 使用Google表格和SerpAPI收集YouTube频道统计数据和联系信息

前置要求
  • 可能需要目标 API 的认证凭证
  • Google Sheets API 凭证

分类

工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "vSYWa1hSKAvedWWp",
  "meta": {
    "instanceId": "84ad02d6104594179f43f1ce9cfe3a81637b2faedb57dafcb9e649b7542988db",
    "templateCredsSetupCompleted": true
  },
  "name": "YouTube频道智能收集器",
  "tags": [],
  "nodes": [
    {
      "id": "c59d8ffd-f78e-4ac5-ae00-19075db988a8",
      "name": "新增频道",
      "type": "n8n-nodes-base.googleSheetsTrigger",
      "position": [
        0,
        0
      ],
      "parameters": {
        "event": "rowAdded",
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1TpaJAx7eM1XogAZWPSHls4H1AhYsrQ_FTcohkoZyedQ/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1TpaJAx7eM1XogAZWPSHls4H1AhYsrQ_FTcohkoZyedQ",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1TpaJAx7eM1XogAZWPSHls4H1AhYsrQ_FTcohkoZyedQ/edit?usp=drivesdk",
          "cachedResultName": "Youtube Channel Intelligence Collector"
        }
      },
      "credentials": {
        "googleSheetsTriggerOAuth2Api": {
          "id": "AO0UQdc9V05KNPDB",
          "name": "Google Sheets Trigger account 2"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "4cd2932b-953c-4ece-af21-6b68e7c7fc7c",
      "name": "获取频道信息",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        220,
        0
      ],
      "parameters": {
        "url": "https://www.googleapis.com/youtube/v3/channels?part=statistics,snippet&id=UC_x5XG1OV2P6uZZ5FSM9Ttw&key=YOUR_KEY"
      },
      "typeVersion": 4.2
    },
    {
      "id": "57841966-eedc-4ac5-b699-1c8241409880",
      "name": "获取频道统计数据",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        440,
        0
      ],
      "parameters": {
        "url": "https://www.googleapis.com/youtube/v3/search",
        "options": {},
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "channelId",
              "value": "={{ $json.items[0].id }}"
            },
            {
              "name": "part",
              "value": "snippet"
            },
            {
              "name": "order",
              "value": "date"
            },
            {
              "name": "maxResults",
              "value": "5"
            },
            {
              "name": "key",
              "value": "YOUR_KEY"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "86b1b984-aa03-4aed-b4d8-3eb861408e1b",
      "name": "获取最近视频观看量",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        740,
        0
      ],
      "parameters": {
        "url": "=https://www.googleapis.com/youtube/v3/videos?part=statistics&id={{ $json.items[0].id.videoId }},{{ $json.items[1].id.videoId }},{{ $json.items[2].id.videoId }},{{ $json.items[3].id.videoId }},{{ $json.items[4].id.videoId }},def456,ghi789&key=YOUR_KEY",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "edbac4ab-c0c6-402a-b579-45ddb9ee7a87",
      "name": "准备要汇总的观看量",
      "type": "n8n-nodes-base.set",
      "position": [
        960,
        0
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "9aaec402-4a0a-4908-a416-35dbe86f4278",
              "name": "Video 1 views",
              "type": "number",
              "value": "={{ $json.items[0].statistics.viewCount }}"
            },
            {
              "id": "5d5eec14-2ca7-41d7-b447-4784de1d77b5",
              "name": "Video 2 views",
              "type": "number",
              "value": "={{ $json.items[1].statistics.viewCount }}"
            },
            {
              "id": "02b2879b-e0bb-4a1e-a0c0-ce59a03bc2de",
              "name": "Video 3 views",
              "type": "number",
              "value": "={{ $json.items[2].statistics.viewCount }}"
            },
            {
              "id": "75d4f2f3-5b07-48d1-b22a-dda29140426e",
              "name": "Video 4 views",
              "type": "number",
              "value": "={{ $json.items[3].statistics.viewCount }}"
            },
            {
              "id": "83e29b86-bb0e-4661-a1a3-6907d46dbc0d",
              "name": "Video 5 views",
              "type": "number",
              "value": "={{ $json.items[4].statistics.viewCount }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "94c8c406-ab91-44f1-aba4-74df7bf2e347",
      "name": "汇总视频观看量",
      "type": "n8n-nodes-base.code",
      "position": [
        1180,
        0
      ],
      "parameters": {
        "jsCode": "// Get the first item (your input object)\nconst data = items[0].json;\n\nlet totalViews = 0;\n\nfor (const key in data) {\n  if (data.hasOwnProperty(key) && key.includes('views')) {\n    totalViews += data[key];\n  }\n}\n\nreturn [\n  {\n    json: {\n      ...data,\n      totalViews\n    }\n  }\n];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "58f38623-d210-45da-9eb3-71f7914859da",
      "name": "获取频道邮箱(SerpAPI)",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1460,
        0
      ],
      "parameters": {
        "url": "=https://serpapi.com/search.json?engine=youtube_channel_about&channel_url=https://www.youtube.com/channel/{{ $('New Channel Added').item.json['Channel ID'] }}&api_key=YOUR_SERPAPI_KEY",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "a8f1aab2-ad08-4711-9a2c-2d4e953407af",
      "name": "准备表格数据",
      "type": "n8n-nodes-base.set",
      "position": [
        1680,
        0
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "9ab4a9fc-15ed-459a-96b6-22d4b8fb05bd",
              "name": "Recent Views",
              "type": "string",
              "value": "={{ $('Sum Video Views').item.json.totalViews }}"
            },
            {
              "id": "4681d235-d066-4d09-9c79-54f2395a6750",
              "name": "Total Subscribers",
              "type": "string",
              "value": "={{ $('Get info about channel').item.json.items[0].statistics.subscriberCount }}"
            },
            {
              "id": "351ec081-ea7f-4ceb-a1f6-038a4747b754",
              "name": "Email",
              "type": "string",
              "value": "={{ $json.channel_about_page.email }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "ac7a8ddc-3347-4860-a080-70efcaded6b6",
      "name": "更新频道洞察",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1980,
        0
      ],
      "parameters": {
        "columns": {
          "value": {
            "Email": "={{ $json.Email }}",
            "Channel ID": "={{ $('New Channel Added').item.json['Channel ID'] }}",
            "Recent Views": "={{ $json['Recent Views'] }}",
            "Total Subscribers": "={{ $json['Total Subscribers'] }}"
          },
          "schema": [
            {
              "id": "Channel ID",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Channel ID",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Recent Views",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Recent Views",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Total Subscribers",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Total Subscribers",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Email",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Channel ID"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1TpaJAx7eM1XogAZWPSHls4H1AhYsrQ_FTcohkoZyedQ/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1TpaJAx7eM1XogAZWPSHls4H1AhYsrQ_FTcohkoZyedQ",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1TpaJAx7eM1XogAZWPSHls4H1AhYsrQ_FTcohkoZyedQ/edit?usp=drivesdk",
          "cachedResultName": "Youtube Channel Intelligence Collector"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "K5yYfUnKFTqaRn6A",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "300c814f-fca0-439e-8b4f-3d7031644b42",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -40,
        -760
      ],
      "parameters": {
        "color": 3,
        "width": 640,
        "height": 960,
        "content": "### 🔹 第一部分:**频道识别与数据获取**"
      },
      "typeVersion": 1
    },
    {
      "id": "c4da8233-ca33-4f73-b9dc-034216af6a78",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        680,
        -720
      ],
      "parameters": {
        "color": 5,
        "width": 640,
        "height": 920,
        "content": "## 🔹 第二部分:**近期视频智能分析**"
      },
      "typeVersion": 1
    },
    {
      "id": "7a4f720e-380b-4557-bbcc-8cf864b32117",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1420,
        -840
      ],
      "parameters": {
        "color": 6,
        "width": 400,
        "height": 1040,
        "content": "### 🔹 第三部分:**联系信息智能获取**"
      },
      "typeVersion": 1
    },
    {
      "id": "c3c77b39-7d8b-4f9e-9f4c-d8ea5c990f06",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1880,
        -960
      ],
      "parameters": {
        "color": 4,
        "width": 340,
        "height": 1160,
        "content": "### 🔹 第四部分:**数据组装与表格更新**"
      },
      "typeVersion": 1
    },
    {
      "id": "3d4d8722-e423-4941-8413-4953ec41487c",
      "name": "便签9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1660,
        -760
      ],
      "parameters": {
        "color": 4,
        "width": 1300,
        "height": 320,
        "content": "======================================="
      },
      "typeVersion": 1
    },
    {
      "id": "9d04bc2b-eea5-4d93-9b43-044011b99876",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1660,
        -420
      ],
      "parameters": {
        "color": 4,
        "width": 1289,
        "height": 1938,
        "content": "## 🎯 **YouTube频道智能收集器 - 分组工作流概述**"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {
    "Get Channel Email (SerpAPI)": [
      {
        "json": {
          "channel_about_page": {
            "email": "contact@googledevs.com",
            "location": "United States",
            "channel_url": "https://www.youtube.com/channel/UC_x5XG1OV2P6uZZ5FSM9Ttw",
            "description": "Welcome to Google Developers!"
          }
        }
      }
    ]
  },
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "7a80e42b-85b9-4bb9-8f43-adea423f228d",
  "connections": {
    "Sum Video Views": {
      "main": [
        [
          {
            "node": "Get Channel Email (SerpAPI)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Channel Stats": {
      "main": [
        [
          {
            "node": "Get Recent Video Views",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "New Channel Added": {
      "main": [
        [
          {
            "node": "Get info about channel",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Sheet Data": {
      "main": [
        [
          {
            "node": "Update Channel Insights",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare views to sum": {
      "main": [
        [
          {
            "node": "Sum Video Views",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Recent Video Views": {
      "main": [
        [
          {
            "node": "Prepare views to sum",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get info about channel": {
      "main": [
        [
          {
            "node": "Get Channel Stats",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Channel Email (SerpAPI)": {
      "main": [
        [
          {
            "node": "Prepare Sheet Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 营销

需要付费吗?

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

工作流信息
难度等级
中级
节点数量15
分类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 查看

分享此工作流