YouTube - 動画 統計 データ を取得
中級
これはMarket Research分野の自動化ワークフローで、11個のノードを含みます。主にIf, HttpRequest, GoogleSheets, ManualTrigger, SplitInBatchesなどのノードを使用。 YouTube動画統計データを抽出してGoogle Sheetsに保存
前提条件
- •ターゲットAPIの認証情報が必要な場合あり
- •Google Sheets API認証情報
カテゴリー
ワークフロープレビュー
ノード接続関係を可視化、ズームとパンをサポート
ワークフローをエクスポート
以下のJSON設定をn8nにインポートして、このワークフローを使用できます
{
"id": "9I7wnSTl7wvPjxZQ",
"meta": {
"instanceId": "ed6d846a2fce1f660ede2e7da800724cca01dc3d0685524a3c917881b7cfcfe9"
},
"name": "Youtube - Get Video Statistics",
"tags": [
{
"id": "CEVEeZJa4qgPvdpK",
"name": "youtube",
"createdAt": "2025-05-27T02:29:43.874Z",
"updatedAt": "2025-05-27T02:29:43.874Z"
}
],
"nodes": [
{
"id": "de9aba98-7d3d-4de0-bcb2-020abe4775be",
"name": "「Test workflow」クリック時",
"type": "n8n-nodes-base.manualTrigger",
"position": [
-700,
420
],
"parameters": {},
"typeVersion": 1
},
{
"id": "05f35e6b-52ec-4998-a3ff-99f92d70ac6d",
"name": "If - 成功レスポンス確認",
"type": "n8n-nodes-base.if",
"position": [
180,
120
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "loose"
},
"combinator": "and",
"conditions": [
{
"id": "bce76f94-5904-4fdb-b172-adc1134855f9",
"operator": {
"type": "string",
"operation": "exists",
"singleValue": true
},
"leftValue": "={{ $json.pageInfo.totalResults }}",
"rightValue": 200
}
]
},
"looseTypeValidation": true
},
"typeVersion": 2.2
},
{
"id": "98fdd444-47af-43a0-a8d4-9df561a3eabe",
"name": "Google Sheets - データ更新",
"type": "n8n-nodes-base.googleSheets",
"position": [
400,
120
],
"parameters": {
"columns": {
"value": {
"tags": "={{ $json.items[0].snippet.tags.join(\", \") }}",
"title": "={{ $json.items[0].snippet.title }}",
"status": "finish",
"duration": "={{ (d => d[1] ? `${d[1]}:${String(d[2] || 0).padStart(2, '0')}:${String(d[3] || 0).padStart(2, '0')}` : `${d[2] || 0}:${String(d[3] || 0).padStart(2, '0')}`)($json.items[0].contentDetails.duration.match(/PT(?:(\\d+)H)?(?:(\\d+)M)?(?:(\\d+)S)?/)) }}\n",
"language": "={{ $json.items[0].snippet.defaultLanguage }}",
"channel_id": "={{ $json.items[0].snippet.channelId }}",
"like_count": "={{ $json.items[0].statistics.likeCount }}",
"row_number": "={{ $('Google Sheets - Get Video URLs').item.json.row_number }}",
"thumbnails": "={{ $json.items[0].snippet.thumbnails.default.url }}",
"view_count": "={{ $json.items[0].statistics.viewCount }}",
"description": "={{ $json.items[0].snippet.description }}",
"published_at": "={{ $json.items[0].snippet.publishedAt.toString().slice(0, 19).replace('T', ' ') }}",
"channel_title": "={{ $json.items[0].snippet.channelTitle }}",
"comment_count": "={{ $json.items[0].statistics.commentCount }}",
"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": "video_url",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "video_url",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "last_fetched_time",
"type": "string",
"display": true,
"required": false,
"displayName": "last_fetched_time",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "title",
"type": "string",
"display": true,
"required": false,
"displayName": "title",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "description",
"type": "string",
"display": true,
"required": false,
"displayName": "description",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "thumbnails",
"type": "string",
"display": true,
"required": false,
"displayName": "thumbnails",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "tags",
"type": "string",
"display": true,
"required": false,
"displayName": "tags",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "duration",
"type": "string",
"display": true,
"required": false,
"displayName": "duration",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "view_count",
"type": "string",
"display": true,
"required": false,
"displayName": "view_count",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "like_count",
"type": "string",
"display": true,
"required": false,
"displayName": "like_count",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "comment_count",
"type": "string",
"display": true,
"required": false,
"displayName": "comment_count",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "language",
"type": "string",
"display": true,
"required": false,
"displayName": "language",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "published_at",
"type": "string",
"display": true,
"required": false,
"displayName": "published_at",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "channel_id",
"type": "string",
"display": true,
"required": false,
"displayName": "channel_id",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "channel_title",
"type": "string",
"display": true,
"required": false,
"displayName": "channel_title",
"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/1I9gyb27WiRHz--g-xi-QH1W3WppZJdSfY6L32-DyUw0/edit#gid=426418282",
"cachedResultName": "Video Urls"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1I9gyb27WiRHz--g-xi-QH1W3WppZJdSfY6L32-DyUw0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1I9gyb27WiRHz--g-xi-QH1W3WppZJdSfY6L32-DyUw0/edit?usp=drivesdk",
"cachedResultName": "Youtube - Get Video Statics"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "pe6UD1A6MWIk2X91",
"name": "Google Sheets - toan.ngo"
}
},
"executeOnce": true,
"typeVersion": 4.5
},
{
"id": "f0c76306-d47b-4442-935d-61a7c01bf0bc",
"name": "Google Sheets - データ更新エラー",
"type": "n8n-nodes-base.googleSheets",
"position": [
400,
320
],
"parameters": {
"columns": {
"value": {
"status": "error",
"row_number": "={{ $('Google Sheets - Get Video URLs').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": "video_url",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "video_url",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "last_fetched_time",
"type": "string",
"display": true,
"required": false,
"displayName": "last_fetched_time",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "title",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "title",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "description",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "description",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "thumbnails",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "thumbnails",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "tags",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "tags",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "duration",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "duration",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "view_count",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "view_count",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "like_count",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "like_count",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "comment_count",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "comment_count",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "language",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "language",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "published_at",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "published_at",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "channel_id",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "channel_id",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "channel_title",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "channel_title",
"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/1I9gyb27WiRHz--g-xi-QH1W3WppZJdSfY6L32-DyUw0/edit#gid=426418282",
"cachedResultName": "Video Urls"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1I9gyb27WiRHz--g-xi-QH1W3WppZJdSfY6L32-DyUw0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1I9gyb27WiRHz--g-xi-QH1W3WppZJdSfY6L32-DyUw0/edit?usp=drivesdk",
"cachedResultName": "Youtube - Get Video Statics"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "pe6UD1A6MWIk2X91",
"name": "Google Sheets - toan.ngo"
}
},
"executeOnce": true,
"typeVersion": 4.5
},
{
"id": "0c71b117-aeae-45d3-806d-9e89ef1ffb39",
"name": "HTTP - 動画データ検索",
"type": "n8n-nodes-base.httpRequest",
"onError": "continueRegularOutput",
"position": [
-40,
145
],
"parameters": {
"url": "https://www.googleapis.com/youtube/v3/videos?",
"options": {},
"sendQuery": true,
"authentication": "predefinedCredentialType",
"queryParameters": {
"parameters": [
{
"name": "id",
"value": "={{ $json.video_url.match(/(?:youtube(?:-nocookie)?\\.com\\/(?:[^\\/\\n\\s]+\\/\\S+\\/|(?:v|e(?:mbed)?)\\/|\\S*?[?&]v=)|youtu\\.be\\/)([a-zA-Z0-9_-]{11})/)[1] }}"
},
{
"name": "part",
"value": "contentDetails,snippet,statistics"
}
]
},
"nodeCredentialType": "youTubeOAuth2Api"
},
"credentials": {
"youTubeOAuth2Api": {
"id": "KhD0GLQGWl8MtqCs",
"name": "YouTube - toan.ngo"
}
},
"typeVersion": 4.2,
"alwaysOutputData": false
},
{
"id": "e8e9b10e-0456-4c5b-855c-79602c0f9f9d",
"name": "付箋",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1580,
-160
],
"parameters": {
"width": 720,
"height": 1480,
"content": "## [Agent Circle's N8N Workflow] YouTube Video Statistics Crawler - Try It Out!\n\n**This N8N template makes it easy to extract key YouTube video data - including title, view count, like count, comment count, and many more - and save it directly into a connected Google Sheet.**\n\nUse cases are many: Whether you're **YouTubers**, **content strategists**, **growth marketers**, and **automation engineers**, this tool gives you fast, structured access to video-level insights in seconds.\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 video URLs in the connected Google Sheet. Only the URLs marked with the **Ready** status will be processed.\n- The tool loops through each video and prepares the necessary data for the YouTube API call later.\n- For each available URL, the tool extracts the video ID and sends a request to the YouTube API to fetch key metrics.\n- The response is checked:\n - **If successful**: the video’s statistics are written back to the corresponding row in the Google Sheet and the row's status is marked as **Finished**.\n - **If unsuccessful**: the row's status is updated to **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 Video Statistics** Google Sheet template](https://docs.google.com/spreadsheets/d/1I9gyb27WiRHz--g-xi-QH1W3WppZJdSfY6L32-DyUw0/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 template:\n Node **Google Sheets - Get Video URLs** → connected to Tab **Video URLs**;\n Node **Google Sheets - Update Data** → connected to Tab **Video URLs**;\n Node **Google Sheets - Update Data - Error** → connected to Tab **Video URLs**.\n + For YouTube access, set up a GET method to connect to YouTube API in the following node:\n Node **HTTP - Find Video Data**.\n- In your connected Google Sheet, enter the video URLs 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 rows' status in **Column A** in the **Video URLs** tab to **Finished** and the video metrics will populate. If the call fails, the rows' status in **Column A** in the tab 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 additional video fields or analytics (like tags, category ID, etc.), you can expand the **HTTP - Find Video Data** node to include those.\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": "b9e277aa-b307-4a75-997c-6ef319b13e28",
"name": "Google Sheets - 動画URL取得",
"type": "n8n-nodes-base.googleSheets",
"position": [
-480,
420
],
"parameters": {
"options": {},
"filtersUI": {
"values": [
{
"lookupValue": "ready",
"lookupColumn": "status"
}
]
},
"sheetName": {
"__rl": true,
"mode": "list",
"value": 426418282,
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1I9gyb27WiRHz--g-xi-QH1W3WppZJdSfY6L32-DyUw0/edit#gid=426418282",
"cachedResultName": "Video Urls"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1I9gyb27WiRHz--g-xi-QH1W3WppZJdSfY6L32-DyUw0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1I9gyb27WiRHz--g-xi-QH1W3WppZJdSfY6L32-DyUw0/edit?usp=drivesdk",
"cachedResultName": "Youtube - Get Video Statics"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "pe6UD1A6MWIk2X91",
"name": "Google Sheets - toan.ngo"
}
},
"typeVersion": 4.5
},
{
"id": "331af5c0-428a-41a6-a9ca-268cf9b50da3",
"name": "付箋1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-760,
-140
],
"parameters": {
"color": 7,
"width": 640,
"height": 800,
"content": "## 1. Read Video URLs from Google Sheets\n- We'll read all video URLs listed in your connected Google Sheet – typically from a tab named **Video URLs**. Only \n- The loop iterates over each row that's marked as **Ready** in the status **Column A** for processing."
},
"typeVersion": 1
},
{
"id": "9e1e2bb8-cf50-404f-a637-0f144b60af7f",
"name": "付箋2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-100,
-140
],
"parameters": {
"color": 7,
"height": 800,
"content": "## 2. Fetch Video Statistics From YouTube API\nOnce a video URL is read, the workflow sends a request to the YouTube API to pull essential data for the corresponding video.\n"
},
"typeVersion": 1
},
{
"id": "295fa90d-029e-4b7d-a8e0-e40f8f791c0f",
"name": "付箋3",
"type": "n8n-nodes-base.stickyNote",
"position": [
160,
-140
],
"parameters": {
"color": 7,
"width": 500,
"height": 800,
"content": "## 3. Write Results Back To Google Sheets\n- The API response is validated, in the connected Google Sheet:\n - If successful: the video’s statistics are filled into the corresponding row, and the row's status in **Column A** in the **Video URLs** tab is marked as **Finished**.\n - If unsuccessful: the row's status in **Column A** in the **Video URLs** tab is updated to **Error** for later review.\n- Then, the tool moves on to the next available video, if one exists."
},
"typeVersion": 1
},
{
"id": "e33bf702-f7c8-4174-aedb-6ac0db968a26",
"name": "アイテムループ処理",
"type": "n8n-nodes-base.splitInBatches",
"position": [
-260,
420
],
"parameters": {
"options": {}
},
"typeVersion": 3
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "8f09f1fc-d50e-40c8-b0d8-9867f8b7f7c8",
"connections": {
"e33bf702-f7c8-4174-aedb-6ac0db968a26": {
"main": [
[],
[
{
"node": "0c71b117-aeae-45d3-806d-9e89ef1ffb39",
"type": "main",
"index": 0
}
]
]
},
"0c71b117-aeae-45d3-806d-9e89ef1ffb39": {
"main": [
[
{
"node": "05f35e6b-52ec-4998-a3ff-99f92d70ac6d",
"type": "main",
"index": 0
}
]
]
},
"98fdd444-47af-43a0-a8d4-9df561a3eabe": {
"main": [
[
{
"node": "e33bf702-f7c8-4174-aedb-6ac0db968a26",
"type": "main",
"index": 0
}
]
]
},
"05f35e6b-52ec-4998-a3ff-99f92d70ac6d": {
"main": [
[
{
"node": "98fdd444-47af-43a0-a8d4-9df561a3eabe",
"type": "main",
"index": 0
}
],
[
{
"node": "f0c76306-d47b-4442-935d-61a7c01bf0bc",
"type": "main",
"index": 0
}
]
]
},
"b9e277aa-b307-4a75-997c-6ef319b13e28": {
"main": [
[
{
"node": "e33bf702-f7c8-4174-aedb-6ac0db968a26",
"type": "main",
"index": 0
}
]
]
},
"de9aba98-7d3d-4de0-bcb2-020abe4775be": {
"main": [
[
{
"node": "b9e277aa-b307-4a75-997c-6ef319b13e28",
"type": "main",
"index": 0
}
]
]
},
"f0c76306-d47b-4442-935d-61a7c01bf0bc": {
"main": [
[
{
"node": "e33bf702-f7c8-4174-aedb-6ac0db968a26",
"type": "main",
"index": 0
}
]
]
}
}
}よくある質問
このワークフローの使い方は?
上記のJSON設定コードをコピーし、n8nインスタンスで新しいワークフローを作成して「JSONからインポート」を選択、設定を貼り付けて認証情報を必要に応じて変更してください。
このワークフローはどんな場面に適していますか?
中級 - 市場調査
有料ですか?
このワークフローは完全無料です。ただし、ワークフローで使用するサードパーティサービス(OpenAI APIなど)は別途料金が発生する場合があります。
関連ワークフロー
YouTube視聴者コメント分析ツール
Gemini AIを使ってYouTubeコメントの感情を分析し、Google Sheetsに保存する
If
Split Out
Http Request
+
If
Split Out
Http Request
17 ノードAgent Circle
市場調査
YouTube - 動画のコメントを取得
YouTubeの動画コメントを抽出し、Google Sheetsに保存
If
Split Out
Http Request
+
If
Split Out
Http Request
16 ノードAgent Circle
市場調査
YouTube - チャンネル情報の取得
YouTubeチャンネルの完全なデータをGoogle Sheetsに収集
If
Switch
Http Request
+
If
Switch
Http Request
13 ノードAgent Circle
市場調査
リアルタイムSEOキーワードリサーチツール
DataForSEOとGoogleスプレッドシートを使ってリアルタイムSEOキーワード調査を自動化
Set
Filter
Split Out
+
Set
Filter
Split Out
37 ノードAgent Circle
市場調査
重複しない RSS リーダー
Gemini AIによる要約と重複排除機能を使用した自動RSS監視でGoogleスプレッドシートへ
If
Set
Html
+
If
Set
Html
23 ノードRoman Rozenberger
市場調査
テンプレートv08/02 - Facebook広告ライブラリをAmazonスクレイピング
Apify スクレイピングを使用して Amazon で Facebook 広告製品を自動検索
If
Set
Code
+
If
Set
Code
24 ノードRichard Besier
市場調査
ワークフロー情報
難易度
中級
ノード数11
カテゴリー1
ノードタイプ6
作成者
Agent Circle
@agentcircleAgent Circle - A growing marketplace of AI agents, workflows, and toolkits — built to help teams automate smarter and scale faster
外部リンク
n8n.ioで表示 →
このワークフローを共有