Skip to content

Instantly share code, notes, and snippets.

@mohit-sinha
Last active December 16, 2025 14:08
Show Gist options
  • Select an option

  • Save mohit-sinha/30febdfe7275531a3b41c93dde9701c8 to your computer and use it in GitHub Desktop.

Select an option

Save mohit-sinha/30febdfe7275531a3b41c93dde9701c8 to your computer and use it in GitHub Desktop.
YouTube Transcribe n8n workflow
{
"name": "YouTube to PDF (via PDFShift)",
"nodes": [
{
"parameters": {},
"id": "d71f19df-2737-445f-aaa2-71284ddd9836",
"name": "When clicking ‘Execute workflow’",
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [
12320,
1616
]
},
{
"parameters": {
"values": {
"string": [
{
"name": "search_term",
"value": "how is the surface of sun"
}
]
},
"options": {}
},
"id": "bef8a113-e286-4a03-a3af-821af79a67c1",
"name": "Define Search",
"type": "n8n-nodes-base.set",
"typeVersion": 2,
"position": [
12544,
1616
]
},
{
"parameters": {
"url": "https://www.googleapis.com/youtube/v3/search",
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "part",
"value": "snippet"
},
{
"name": "maxResults",
"value": "10"
},
{
"name": "q",
"value": "={{ $json.search_term }}"
},
{
"name": "type",
"value": "video"
},
{
"name": "key",
"value": "ENTER_YOUR_KEY"
}
]
},
"options": {}
},
"id": "4ff2b520-895a-4f98-a6e4-0474b0208abe",
"name": "Search YouTube",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 3,
"position": [
12768,
1616
]
},
{
"parameters": {
"fieldToSplitOut": "items",
"options": {}
},
"id": "214ddbf7-4be3-4898-914a-79ac072e5a8e",
"name": "Split into Items",
"type": "n8n-nodes-base.itemLists",
"typeVersion": 1,
"position": [
12992,
1616
]
},
{
"parameters": {
"operation": "getTranscript",
"videoUrl": "={{ 'https://www.youtube.com/watch?v=' + $json.id.videoId }}"
},
"id": "0f2ca007-1ede-4ed6-b2d9-98ff5db89a2e",
"name": "Get Transcripts",
"type": "n8n-nodes-supadata.supadata",
"typeVersion": 1,
"position": [
13216,
1616
],
"credentials": {
"supadataApi": {
"id": "XB57p1JAC9RcM5jR",
"name": "Supadata account"
}
},
"onError": "continueRegularOutput"
},
{
"parameters": {
"jsCode": "// Initialize HTML content\nlet htmlContent = `\n<html>\n<head>\n<style>\n body { font-family: Helvetica, Arial, sans-serif; padding: 40px; color: #333; }\n h1 { text-align: center; border-bottom: 2px solid #333; padding-bottom: 20px; }\n .video-block { margin-bottom: 40px; }\n .title { font-size: 18px; font-weight: bold; color: #d32f2f; margin-bottom: 10px; }\n .text { font-size: 14px; line-height: 1.6; text-align: justify; }\n hr { border: 0; border-top: 1px solid #eee; margin: 30px 0; }\n</style>\n</head>\n<body>\n<h1>Video Transcript Report</h1>\n`;\n\n// Loop through all items to build the HTML string\nfor (const item of $input.all()) {\n const transcriptItems = item.json.content;\n \n if (transcriptItems && Array.isArray(transcriptItems) && transcriptItems.length > 0) {\n // Reconstruct full text from segments\n const videoText = transcriptItems.map(t => t.text).join(\" \");\n \n htmlContent += `\n <div class=\"video-block\">\n <div class=\"title\">Video #${item.index + 1}</div>\n <div class=\"text\">${videoText}</div>\n </div>\n <hr>\n `;\n }\n}\n\nhtmlContent += \"</body></html>\";\n\nreturn {\n json: {\n source_html: htmlContent\n }\n};"
},
"id": "cd83fd57-a935-429e-a26d-79c0f364174b",
"name": "Prepare HTML",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
13440,
1616
]
},
{
"parameters": {
"method": "POST",
"url": "https://api.pdfshift.io/v3/convert/pdf",
"sendBody": true,
"bodyParameters": {
"parameters": [
{
"name": "source",
"value": "={{ $json.source_html }}"
},
{
"name": "landscape",
"value": "false"
},
{
"name": "use_print",
"value": "false"
}
]
},
"options": {
"response": {
"response": {
"responseFormat": "file"
}
}
}
},
"id": "ccd94a54-8f9d-44be-a842-d2281062944e",
"name": "Convert to PDF (PDFShift)",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 3,
"position": [
13664,
1616
]
}
],
"pinData": {},
"connections": {
"When clicking ‘Execute workflow’": {
"main": [
[
{
"node": "Define Search",
"type": "main",
"index": 0
}
]
]
},
"Define Search": {
"main": [
[
{
"node": "Search YouTube",
"type": "main",
"index": 0
}
]
]
},
"Search YouTube": {
"main": [
[
{
"node": "Split into Items",
"type": "main",
"index": 0
}
]
]
},
"Split into Items": {
"main": [
[
{
"node": "Get Transcripts",
"type": "main",
"index": 0
}
]
]
},
"Get Transcripts": {
"main": [
[
{
"node": "Prepare HTML",
"type": "main",
"index": 0
}
]
]
},
"Prepare HTML": {
"main": [
[
{
"node": "Convert to PDF (PDFShift)",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "52b6ea1e-4b0d-4696-b3d0-16a7a7ccbf76",
"meta": {
"templateCredsSetupCompleted": true,
"instanceId": "ef15fe301a6b1dc3028661b4d7b53498f8fa0dfab142735ed816a63b7305b659"
},
"id": "KPBlKfimVHTgHdv5",
"tags": []
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment