{
  "id": "130qXL74wpCNH7rP",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Youtube - Get Channel Videos",
  "tags": [
    {
      "id": "CEVEeZJa4qgPvdpK",
      "name": "youtube",
      "createdAt": "2025-05-27T02:29:43.874Z",
      "updatedAt": "2025-05-27T02:29:43.874Z"
    }
  ],
  "nodes": [
    {
      "id": "1de1cc62-f33f-4d27-b69b-e4fcb2369baf",
      "name": "When clicking \u2018Test workflow\u2019",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -1620,
        350
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "0759bfd3-5a95-4bd2-9bbb-b4204cceeb1b",
      "name": "If - Check Success Response",
      "type": "n8n-nodes-base.if",
      "position": [
        140,
        179
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "bce76f94-5904-4fdb-b172-adc1134855f9",
              "operator": {
                "type": "number",
                "operation": "gt"
              },
              "leftValue": "={{ $json.body.pageInfo.totalResults }}",
              "rightValue": 0
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "c0413724-8cd9-4b66-a978-49ec5c072b79",
      "name": "Google Sheets - Update Data",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        580,
        0
      ],
      "parameters": {
        "columns": {
          "value": {
            "title": "={{ $json.snippet.title }}",
            "video_url": "=https://www.youtube.com/watch?v={{ $json.id.videoId }}",
            "thumbnails": "={{ $json.snippet.thumbnails.default.url }}",
            "channel_url": "={{ $('Google Sheets - Get Channel URLs').item.json.channel_url }}",
            "description": "={{ $json.snippet.description }}",
            "published_at": "={{ $json.snippet.publishedAt.toString().slice(0, 19).replace('T', ' ') }}"
          },
          "schema": [
            {
              "id": "channel_url",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "channel_url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "video_url",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "video_url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "title",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "title",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "description",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "description",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "thumbnails",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "thumbnails",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "published_at",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "published_at",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "video_url"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 2020351526,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1GIdiUUx1PtEZXOzSUP3aJkrDaVcJdxCGRmCOT94BytA/edit#gid=2020351526",
          "cachedResultName": "Videos"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1GIdiUUx1PtEZXOzSUP3aJkrDaVcJdxCGRmCOT94BytA",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1GIdiUUx1PtEZXOzSUP3aJkrDaVcJdxCGRmCOT94BytA/edit?usp=drivesdk",
          "cachedResultName": "YouTube - Get Channel Videos"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "executeOnce": false,
      "typeVersion": 4.5
    },
    {
      "id": "78b83f9d-6c3d-4377-a6a5-f269b49ea5d2",
      "name": "Google Sheets - Update Data - Error",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        360,
        400
      ],
      "parameters": {
        "columns": {
          "value": {
            "status": "error",
            "row_number": "={{ $('Loop').item.json.row_number }}",
            "last_fetched_time": "={{ $now.toISO().toString().slice(0, 19).replace('T', ' ') }}"
          },
          "schema": [
            {
              "id": "status",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "channel_url",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "channel_url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "limit",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "limit",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "last_fetched_time",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "last_fetched_time",
              "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": [
            "row_number"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 426418282,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1easnNMrm8ovxhlZQwPUge6UbPnUVFKBeaQY5EmmG1gM/edit#gid=426418282",
          "cachedResultName": "Channel Urls"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1GIdiUUx1PtEZXOzSUP3aJkrDaVcJdxCGRmCOT94BytA",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1GIdiUUx1PtEZXOzSUP3aJkrDaVcJdxCGRmCOT94BytA/edit?usp=drivesdk",
          "cachedResultName": "YouTube - Get Channel Videos"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "executeOnce": true,
      "typeVersion": 4.5
    },
    {
      "id": "978bdd9e-613b-4f89-bd21-6ff6c679e813",
      "name": "HTTP Request - Get Channel ID",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -520,
        200
      ],
      "parameters": {
        "url": "https://www.googleapis.com/youtube/v3/channels",
        "options": {
          "response": {
            "response": {
              "fullResponse": true,
              "responseFormat": "json"
            }
          }
        },
        "sendQuery": true,
        "authentication": "predefinedCredentialType",
        "queryParameters": {
          "parameters": [
            {
              "name": "part",
              "value": "id"
            },
            {
              "name": "forHandle",
              "value": "={{ $json.channel_username }}"
            }
          ]
        },
        "nodeCredentialType": "youTubeOAuth2Api"
      },
      "credentials": {
        "youTubeOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "05209d93-d96a-4cfc-9fa2-ba9e574702f4",
      "name": "Fields - Set Channel Username",
      "type": "n8n-nodes-base.set",
      "position": [
        -740,
        200
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "c8f0ef52-3e09-46c7-b48c-4a142ce067c8",
              "name": "channel_username",
              "type": "string",
              "value": "={{ $json.channel_url.replace(/^https?:\\/\\/(www\\.)?youtube\\.com\\/@/, '').replace(/^@/, '') || '' }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "ed273bcd-5222-4316-9e5d-475bd83effcf",
      "name": "HTTP Request - Get Channel Videos",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -80,
        179
      ],
      "parameters": {
        "url": "https://www.googleapis.com/youtube/v3/search",
        "options": {
          "response": {
            "response": {
              "fullResponse": true,
              "responseFormat": "json"
            }
          }
        },
        "sendQuery": true,
        "authentication": "predefinedCredentialType",
        "queryParameters": {
          "parameters": [
            {
              "name": "part",
              "value": "snippet"
            },
            {
              "name": "channelId",
              "value": "={{ $json.channel_id }}"
            },
            {
              "name": "order",
              "value": "date"
            },
            {
              "name": "type",
              "value": "video"
            },
            {
              "name": "maxResults",
              "value": "={{ $('Google Sheets - Get Channel URLs').item.json.limit || 10 }}"
            }
          ]
        },
        "nodeCredentialType": "youTubeOAuth2Api"
      },
      "credentials": {
        "youTubeOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "b236306b-1834-4aee-9d1b-f44efb3ce71b",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2540,
        -540
      ],
      "parameters": {
        "width": 680,
        "height": 1780,
        "content": "## [Agent Circle's N8N Workflow] YouTube Channel Videos Crawler - Try It Out!\n\n**This N8N template demonstrates how to use our tool to collect a list of videos from any YouTube channel - including video URLs, titles, descriptions, thumbnail links, publish dates, and more - all saved cleanly into a connected Google Sheet.**\n\nUse cases are many: Whether you're **a YouTube content strategist** tracking competitors, **a marketing team** building dashboards from video metadata, or **an automation pro** connecting YouTube to downstream workflows, **researchers and analysts** collecting structured video data at scale, this tool gives you what you need!\n\n## How It Works\n- The workflow begins when you click **Execute Workflow** or **Test Workflow** manually in N8N.\n- It reads the list of full channel URLs, custom channel URLs or channel IDs from the **Channel URLs** tab in the connected Google Sheet. Only the channels with the **Ready** status will be processed.\n- A **Switch** node detects whether the input is a full/custom channel URL, or a raw channel ID, and routes it accordingly.\n     + If the input is already a **channel ID**, the tool prepares the data structure before sending it to the YouTube API call in the next step.\n     + If the input is a **full channel URL** or a **custom channel URL**, the workflow extracts the **username**, then sends a **HTTP Request** to the YouTube API to retrieve the corresponding Channel ID, and prepares the data structure before continuing.\n- Once the valid **Channel ID** is set, the tool sends a request to YouTube API endpoint to retrieve a list of public videos. By default, the number of videos extracted per channel is limited to 10. \n- The API response is checked for success:\n     + If successful, the video data is split into individual entries, cleaned, and added to the **Videos** tab in the connected Google Sheet. The original rows' status in the **Channel URLs** tab is marked as **Finished**.\n     + If an error occurs, the rows' status in the **Channel URLs** tab is marked as **Error** for later review.\n\n## How To Use\n- Download the workflow package.\n- Import the workflow package into your N8N interface.\n- Duplicate the [**YouTube - Get Channel Videos** Google Sheet template](https://docs.google.com/spreadsheets/d/1GIdiUUx1PtEZXOzSUP3aJkrDaVcJdxCGRmCOT94BytA/edit?gid=426418282#gid=426418282) into your Google Sheets account.\n- Set up **Google Cloud Console** credentials in the following nodes in N8N, ensuring enabled access and suitable rights to Google Sheets and YouTube services:\n    + For Google Sheets access, ensure each node is properly connected to the correct tab in your connected Google Sheet: \n         Node **Google Sheets - Get Channel URLs** \u2192 connected to the **Channel URLs** tab; \n         Node **Google Sheets - Update Data** \u2192 connected to the **Videos** tab; \n         Node **Google Sheets - Update Data - Success** \u2192 connected to the **Channel URLs** tab; \n         Node **Google Sheets - Update Data - Error** \u2192 connected to the **Channel URLs** tab.\n    + For YouTube access, set up a GET method to connect to YouTube API in the following nodes:\n         Node **HTTP Request - Get Channel ID**;\n         Node **HTTP Request - Get Channel Videos**.\n- In your connected Google Sheet, enter the full channel URLs, custom channel URLs or channel IDs that you want to crawl and set the rows' status to **Ready**.\n- Run the workflow by clicking **Execute Workflow** or **Test Workflow** in N8N.\n- View the results in your connected Google Sheet: Successful fetches will update the original rows' status to **Finished** and the videos' information show up in the **Videos** tab. If any URL or ID fails, the rows' status will be marked as **Error**.\n\n## Requirements\n- Basic setup in Google Cloud Console (OAuth or API Key method enabled) with enabled access to YouTube and Google Sheets.\n\n## How To Customize\n- By default, the workflow is manually triggered in N8N. However, you can automate the process by adding **a Google Sheets trigger** that monitors new entries automatically.\n- If you want to fetch more video metadata like durations, or view counts, you can expand the HTTP Request and post-processing nodes to include those.\n- The workflow, by default, collects **up to 10 videos per channel**. If you\u2019d like to fetch more, in the connected Google Sheet, simply enter your desired video number limit in **Column C** in the **Channel URLs** tab. The tool will use that value when calling the YouTube API.\n\n## Need Help?\nJoin our community on different platforms for support, inspiration and tips from others.\n\nWebsite: https://www.agentcircle.ai/\nEtsy: https://www.etsy.com/shop/AgentCircle\nGumroad: http://agentcircle.gumroad.com/\nDiscord Global: https://discord.gg/d8SkCzKwnP\nFB Page Global: https://www.facebook.com/agentcircle/\nFB Group Global: https://www.facebook.com/groups/aiagentcircle/\nX: https://x.com/agent_circle\nYouTube: https://www.youtube.com/@agentcircle\nLinkedIn: https://www.linkedin.com/company/agentcircle"
      },
      "typeVersion": 1
    },
    {
      "id": "d69bf1ad-3aff-4b38-b211-69136560c2ba",
      "name": "Google Sheets - Get Channel URLs",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -1400,
        350
      ],
      "parameters": {
        "options": {},
        "filtersUI": {
          "values": [
            {
              "lookupValue": "ready",
              "lookupColumn": "status"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 426418282,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1GIdiUUx1PtEZXOzSUP3aJkrDaVcJdxCGRmCOT94BytA/edit#gid=426418282",
          "cachedResultName": "Channel Urls"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1GIdiUUx1PtEZXOzSUP3aJkrDaVcJdxCGRmCOT94BytA",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1GIdiUUx1PtEZXOzSUP3aJkrDaVcJdxCGRmCOT94BytA/edit?usp=drivesdk",
          "cachedResultName": "YouTube - Get Channel Videos"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "8967115c-baa3-4931-8669-44d5ae5dbca9",
      "name": "Google Sheets - Update Data - Success",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        360,
        200
      ],
      "parameters": {
        "columns": {
          "value": {
            "status": "finish",
            "row_number": "={{ $('Loop').item.json.row_number }}",
            "last_fetched_time": "={{ $now.toISO().toString().slice(0, 19).replace('T', ' ') }}"
          },
          "schema": [
            {
              "id": "status",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "channel_url",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "channel_url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "limit",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "limit",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "last_fetched_time",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "last_fetched_time",
              "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": [
            "row_number"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 426418282,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1easnNMrm8ovxhlZQwPUge6UbPnUVFKBeaQY5EmmG1gM/edit#gid=426418282",
          "cachedResultName": "Channel Urls"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1GIdiUUx1PtEZXOzSUP3aJkrDaVcJdxCGRmCOT94BytA",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1GIdiUUx1PtEZXOzSUP3aJkrDaVcJdxCGRmCOT94BytA/edit?usp=drivesdk",
          "cachedResultName": "YouTube - Get Channel Videos"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "executeOnce": true,
      "typeVersion": 4.5
    },
    {
      "id": "2d531a54-c4e4-4622-acc5-d4810cd7d44d",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1720,
        -220
      ],
      "parameters": {
        "color": 7,
        "width": 500,
        "height": 840,
        "content": "## 1. Read Channel URLs/IDs From Google Sheets\n- We\u2019ll start by pulling a list of full channel URLs, custom channel URLs or channel IDs from your connected Google Sheet. Only the rows where the status is set to **Ready** will be picked up for processing. \n- You can customize how many videos to fetch by entering a limit value in **Column C** in tab **Channel URLs** of the connected Google Sheet. By default, the result's limit per channel is **10 videos**."
      },
      "typeVersion": 1
    },
    {
      "id": "9c34b1ac-56cd-4f2c-91a7-5436458866cb",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1200,
        -220
      ],
      "parameters": {
        "color": 7,
        "width": 780,
        "height": 840,
        "content": "## 2. Detect Input Type And Normalize It\n- A Switch node checks whether each input is a:\n     - Raw channel ID\n     - Full channel URL or custom channel URL\n- Depending on the input type:\n     - If it\u2019s a raw channel ID, it prepares the data structure for the next step.\n     - If it\u2019s a full channel URL or custom channel URL, the workflow extracts the username, then sends a **HTTP Request** to the YouTube API to retrieve the corresponding Channel ID, and prepares the data structure before continuing."
      },
      "typeVersion": 1
    },
    {
      "id": "a8d67e3f-aef7-4801-abad-64a72c69c928",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        60,
        -220
      ],
      "parameters": {
        "color": 7,
        "width": 720,
        "height": 840,
        "content": "## 4. Check API Response And Update Results\nThe API response is validated, in the connected Google Sheet:\n- If successful, the data is split into individual videos, and each video\u2019s data is saved to the **Videos** tab, and the row's status for that channel in the **Channel URLs** tab is marked as **Finished**.\n- If the API call fails, the row's status for that channel in the **Channel URLs** tab is marked as **Error** for easy follow-up."
      },
      "typeVersion": 1
    },
    {
      "id": "2e8c5bb7-99e6-4ceb-995b-a83742a0e57e",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -400,
        -220
      ],
      "parameters": {
        "color": 7,
        "width": 440,
        "height": 840,
        "content": "## 3. Fetch Videos Using YouTube API\nOnce the valid **channel ID** is ready, the workflow sends a request to the YouTube API to retrieve that channel\u2019s public videos."
      },
      "typeVersion": 1
    },
    {
      "id": "5098ce70-fd30-470f-be61-08953beab4a5",
      "name": "Split Out - Videos",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        360,
        0
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "body.items"
      },
      "typeVersion": 1
    },
    {
      "id": "e2abab80-8fd9-497c-904f-adb5190b8ac7",
      "name": "Switch - Detect Channel ID or Channel URL",
      "type": "n8n-nodes-base.switch",
      "position": [
        -960,
        137
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "loose"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "d7fc8f6c-3c0e-4c50-8986-ca3d7d76fc02",
                    "operator": {
                      "type": "string",
                      "operation": "regex"
                    },
                    "leftValue": "={{ $json.channel_url }}",
                    "rightValue": "^https:\\/\\/www\\.youtube\\.com\\/channel\\/[A-Za-z0-9_-]+\\/?$"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "loose"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "39506a5e-5f21-4a53-b139-686d76cacd65",
                    "operator": {
                      "type": "string",
                      "operation": "regex"
                    },
                    "leftValue": "={{ $json.channel_url }}",
                    "rightValue": "^UC[\\w-]{22}$"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "loose"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "cb81ca70-cc67-457a-b810-20c2e3f726f6",
                    "operator": {
                      "type": "string",
                      "operation": "regex"
                    },
                    "leftValue": "={{ $json.channel_url }}",
                    "rightValue": "^https:\\/\\/www\\.youtube\\.com\\/@[\\w.-]+$"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "loose"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "0a458849-682d-4d99-b277-d10b85501689",
                    "operator": {
                      "type": "string",
                      "operation": "regex"
                    },
                    "leftValue": "={{ $json.channel_url }}",
                    "rightValue": "^@[\\w.-]+$"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "loose"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "6951f4b6-158f-4976-a857-d8c988fbc12f",
                    "operator": {
                      "type": "string",
                      "operation": "regex"
                    },
                    "leftValue": "={{ $json.channel_url }}",
                    "rightValue": "^[\\w.-]+$"
                  }
                ]
              }
            }
          ]
        },
        "options": {},
        "looseTypeValidation": true
      },
      "typeVersion": 3.2
    },
    {
      "id": "23faa7ba-557a-45fb-95e8-c7907a331f24",
      "name": "Fields - Set Channel ID 1",
      "type": "n8n-nodes-base.set",
      "position": [
        -300,
        0
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "c8f0ef52-3e09-46c7-b48c-4a142ce067c8",
              "name": "channel_id",
              "type": "string",
              "value": "={{ $json.channel_url.match(/UC[\\w-]{22}/)?.[0] || '' }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "1f1eb136-81ba-4a39-8d15-cd10db9c34f4",
      "name": "Fields - Set Channel ID 2",
      "type": "n8n-nodes-base.set",
      "position": [
        -300,
        200
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "c8f0ef52-3e09-46c7-b48c-4a142ce067c8",
              "name": "channel_id",
              "type": "string",
              "value": "={{ $json.body.items[0].id }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "68fce9d8-c9ae-40a7-81de-8f6953ab31ee",
      "name": "Wait",
      "type": "n8n-nodes-base.wait",
      "position": [
        -960,
        421
      ],
      "parameters": {
        "amount": 0.01
      },
      "typeVersion": 1.1
    },
    {
      "id": "d7f206a7-1d1c-4376-a463-6c629f7f7ddd",
      "name": "Loop",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -1180,
        350
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "6df165d2-b73c-4d70-92fe-7f05311a4c81",
  "connections": {
    "Loop": {
      "main": [
        [],
        [
          {
            "node": "Switch - Detect Channel ID or Channel URL",
            "type": "main",
            "index": 0
          },
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "Loop",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out - Videos": {
      "main": [
        [
          {
            "node": "Google Sheets - Update Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fields - Set Channel ID 1": {
      "main": [
        [
          {
            "node": "HTTP Request - Get Channel Videos",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fields - Set Channel ID 2": {
      "main": [
        [
          {
            "node": "HTTP Request - Get Channel Videos",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets - Update Data": {
      "main": [
        []
      ]
    },
    "If - Check Success Response": {
      "main": [
        [
          {
            "node": "Split Out - Videos",
            "type": "main",
            "index": 0
          },
          {
            "node": "Google Sheets - Update Data - Success",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Google Sheets - Update Data - Error",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fields - Set Channel Username": {
      "main": [
        [
          {
            "node": "HTTP Request - Get Channel ID",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request - Get Channel ID": {
      "main": [
        [
          {
            "node": "Fields - Set Channel ID 2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets - Get Channel URLs": {
      "main": [
        [
          {
            "node": "Loop",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request - Get Channel Videos": {
      "main": [
        [
          {
            "node": "If - Check Success Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking \u2018Test workflow\u2019": {
      "main": [
        [
          {
            "node": "Google Sheets - Get Channel URLs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets - Update Data - Error": {
      "main": [
        []
      ]
    },
    "Google Sheets - Update Data - Success": {
      "main": [
        []
      ]
    },
    "Switch - Detect Channel ID or Channel URL": {
      "main": [
        [
          {
            "node": "Fields - Set Channel ID 1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Fields - Set Channel ID 1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Fields - Set Channel Username",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Fields - Set Channel Username",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Fields - Set Channel Username",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}