N
n8n Store
Workflow Market
Add the most popular videos from a specific YT channel to sheets

Add the most popular videos from a specific YT channel to sheets

by taiki0 views

描述

分类

📢 Marketing

使用的节点

n8n-nodes-base.splitOutn8n-nodes-base.splitOutn8n-nodes-base.stickyNoten8n-nodes-base.stickyNoten8n-nodes-base.httpRequestn8n-nodes-base.httpRequestn8n-nodes-base.googleSheetsn8n-nodes-base.googleSheetsn8n-nodes-base.googleSheetsn8n-nodes-base.googleSheets
价格免费
浏览量0
最后更新11/28/2025
workflow.json
{
  "id": "M0TnkjeDHSBlsVLQ",
  "meta": {
    "instanceId": "1995ed9acdcea54e44032fa9fdaaa756a5f5932c630ba083376b6895162377f6",
    "templateCredsSetupCompleted": true
  },
  "name": "Add the most popular videos from a specific YT channel to sheets",
  "tags": [],
  "nodes": [
    {
      "id": "038873e2-0e74-4644-be10-b485c1e40d81",
      "name": "When clicking ‘Execute workflow’",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -160,
        60
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "1a8d863a-8c74-4f94-9adf-503ca37ad584",
      "name": "Fetch Most-Viewed Videos via YouTube API",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        300,
        40
      ],
      "parameters": {
        "url": "https://www.googleapis.com/youtube/v3/search",
        "options": {},
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "key",
              "value": "YOUR_YOUTUBE_API_KEY"
            },
            {
              "name": "part",
              "value": "snippet"
            },
            {
              "name": "channelId",
              "value": "={{ $json.ChannelID }}"
            },
            {
              "name": "maxResults",
              "value": "={{ $json.video_num_to_get }}"
            },
            {
              "name": "order",
              "value": "viewCount"
            },
            {
              "name": "type",
              "value": "video"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "69553f6a-c563-4389-9618-3b402e497e3b",
      "name": "Read Channel Info from Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        80,
        40
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_INPUT_SHEET_NAME"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_SPREADSHEET_ID"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "6b51fd78-6868-41a6-90de-fb7ba05db9cc",
      "name": "Split Into Individual Videos",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        520,
        40
      ],
      "parameters": {
        "include": "allOtherFields",
        "options": {},
        "fieldToSplitOut": "items"
      },
      "typeVersion": 1
    },
    {
      "id": "5fa2c6ec-6b92-4ba4-9ab6-37718d3354af",
      "name": "Append Video Details to Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        740,
        40
      ],
      "parameters": {
        "columns": {
          "value": {
            "title": "={{ $json.items.snippet.title }}",
            "videoId": "={{ $json.items.id.videoId }}",
            "videoLink": "=https://www.youtube.com/watch?v={{ $json.items.id.videoId }}",
            "channelName": "={{ $json.items.snippet.channelTitle }}"
          },
          "schema": [
            {
              "id": "channelName",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "channelName",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "title",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "title",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "videoId",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "videoId",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "videoLink",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "videoLink",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_OUTPUT_SHEET_NAME"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_SPREADSHEET_ID"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "a494ab3e-f3ba-446c-a7b9-c347c34d9cc8",
      "name": "Setup Instructions & Guide",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -480,
        -220
      ],
      "parameters": {
        "content": "## this is note\n\nplease write how to use this node in markdown here!"
      },
      "typeVersion": 1
    },
    {
      "id": "43af9899-b3cb-4300-8bbd-38142457b3fa",
      "name": "Fetch Most-Viewed Videos via YouTube API1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1820,
        760
      ],
      "parameters": {
        "url": "https://www.googleapis.com/youtube/v3/search",
        "options": {},
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "key",
              "value": "YOUR_YOUTUBE_API_KEY"
            },
            {
              "name": "part",
              "value": "snippet"
            },
            {
              "name": "channelId",
              "value": "={{ $json.ChannelID }}"
            },
            {
              "name": "maxResults",
              "value": "={{ $json.video_num_to_get }}"
            },
            {
              "name": "order",
              "value": "viewCount"
            },
            {
              "name": "type",
              "value": "video"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "b9efce22-129d-4971-a6d5-ddc1a46757b3",
      "name": "Read Channel Info from Sheet1",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1600,
        760
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_INPUT_SHEET_NAME"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_SPREADSHEET_ID"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "edc478de-26a7-4a2e-be8e-fa7a47b3da30",
      "name": "Split Into Individual Videos1",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        2040,
        760
      ],
      "parameters": {
        "include": "allOtherFields",
        "options": {},
        "fieldToSplitOut": "items"
      },
      "typeVersion": 1
    },
    {
      "id": "81ec042b-6a6c-48af-8b68-03c90366c87c",
      "name": "Append Video Details to Sheet1",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2260,
        760
      ],
      "parameters": {
        "columns": {
          "value": {
            "title": "={{ $json.items.snippet.title }}",
            "videoId": "={{ $json.items.id.videoId }}",
            "videoLink": "=https://www.youtube.com/watch?v={{ $json.items.id.videoId }}",
            "channelName": "={{ $json.items.snippet.channelTitle }}"
          },
          "schema": [
            {
              "id": "channelName",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "channelName",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "title",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "title",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "videoId",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "videoId",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "videoLink",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "videoLink",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_OUTPUT_SHEET_NAME"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_SPREADSHEET_ID"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "178043b9-528c-45bc-956c-98663bad69b2",
      "name": "Setup Instructions & Guide1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1040,
        500
      ],
      "parameters": {
        "width": 500,
        "height": 1460,
        "content": "## Workflow Setup Guide\n\nThis workflow collects the most-viewed videos from specified YouTube channels and saves the data to a Google Sheet. Follow these steps to set it up:\n\n## 1. Credentials Setup\n\n*   **Google Sheets:** You need to have a Google Sheets credential configured in your n8n instance. If you don't have one, go to the 'Credentials' section in n8n and add a new credential for Google Sheets.\n*   **YouTube API Key:** You need a YouTube Data API v3 key.\n    1.  Go to the [Google Cloud Console](https://console.cloud.google.com/).\n    2.  Create a new project or select an existing one.\n    3.  Go to 'APIs & Services' > 'Library' and enable the **YouTube Data API v3**.\n    4.  Go to 'APIs & Services' > 'Credentials', click 'Create Credentials', and choose 'API key'.\n    5.  Copy the generated API key.\n\n## 2. Google Sheet Setup\n\nYou will need one Google Sheet with two separate sheets (tabs) inside it.\n\n### Input Sheet\nUse [Template](https://docs.google.com/spreadsheets/d/1EwALToSWKp4EyzPCx4q3rhMHMaJ3MMfwXQoZmC2BWZk/edit?usp=sharing)\nThis sheet provides the list of YouTube channels to process.\n*   **Required Columns:** Create a sheet with the following two columns:\n    *   `ChannelID`: The ID of the YouTube channel (e.g., `T7M3PpjBZzw`).\n    *   `video_num_to_get`: The number of top videos to retrieve for that channel (e.g., `5`).\n\n### Output Sheet\nThis sheet is where the results will be saved.\n*   **Required Columns:** The workflow will automatically append data to the following columns. You can create them beforehand or let the workflow do it.\n    *   `channelName`\n    *   `title`\n    *   `videoId`\n    *   `videoLink`\n\n## 3. Node Configuration\n\n*   **Read Channel Info from Sheet:** \n    *   Select your Google Sheets credential.\n    *   Enter your **Spreadsheet ID**.\n    *   Enter the **name of your Input Sheet**.\n*   **Fetch Most-Viewed Videos via YouTube API:** \n    *   Replace `YOUR_YOUTUBE_API_KEY` with the API key you generated in Step 1.\n*   **Append Video Details to Sheet:**\n    *   Select your Google Sheets credential.\n    *   Enter your **Spreadsheet ID** (the same one as before).\n    *   Enter the **name of your Output Sheet**."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "f642b6b7-f174-4ea0-9e8c-ad033597d947",
  "connections": {
    "Read Channel Info from Sheet": {
      "main": [
        [
          {
            "node": "Fetch Most-Viewed Videos via YouTube API",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Into Individual Videos": {
      "main": [
        [
          {
            "node": "Append Video Details to Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read Channel Info from Sheet1": {
      "main": [
        [
          {
            "node": "Fetch Most-Viewed Videos via YouTube API1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Into Individual Videos1": {
      "main": [
        [
          {
            "node": "Append Video Details to Sheet1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "Read Channel Info from Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Most-Viewed Videos via YouTube API": {
      "main": [
        [
          {
            "node": "Split Into Individual Videos",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Most-Viewed Videos via YouTube API1": {
      "main": [
        [
          {
            "node": "Split Into Individual Videos1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

相关工作流