YouTube - Obtenir les statistiques de la vidéo
Ceci est unMarket Researchworkflow d'automatisation du domainecontenant 11 nœuds.Utilise principalement des nœuds comme If, HttpRequest, GoogleSheets, ManualTrigger, SplitInBatches. Extraire les statistiques des vidéos YouTube et les sauvegarder dans Google Sheets
- •Peut nécessiter les informations d'identification d'authentification de l'API cible
- •Informations d'identification Google Sheets API
Nœuds utilisés (11)
Catégorie
{
"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": "Lors du clic sur 'Tester le workflow'",
"type": "n8n-nodes-base.manualTrigger",
"position": [
-700,
420
],
"parameters": {},
"typeVersion": 1
},
{
"id": "05f35e6b-52ec-4998-a3ff-99f92d70ac6d",
"name": "If - Vérifier la réponse de succès",
"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 - Mettre à jour les données",
"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 - Mettre à jour les données - Erreur",
"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 - Trouver les données vidéo",
"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": "Note autocollante",
"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 - Obtenir les URLs vidéo",
"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": "Note autocollante1",
"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": "Note autocollante2",
"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": "Note autocollante3",
"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": "Boucler sur les éléments",
"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
}
]
]
}
}
}Comment utiliser ce workflow ?
Copiez le code de configuration JSON ci-dessus, créez un nouveau workflow dans votre instance n8n et sélectionnez "Importer depuis le JSON", collez la configuration et modifiez les paramètres d'authentification selon vos besoins.
Dans quelles scénarios ce workflow est-il adapté ?
Intermédiaire - Étude de marché
Est-ce payant ?
Ce workflow est entièrement gratuit et peut être utilisé directement. Veuillez noter que les services tiers utilisés dans le workflow (comme l'API OpenAI) peuvent nécessiter un paiement de votre part.
Workflows recommandés
Agent Circle
@agentcircleAgent Circle - A growing marketplace of AI agents, workflows, and toolkits — built to help teams automate smarter and scale faster
Partager ce workflow