-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathworkflow.json
More file actions
284 lines (284 loc) · 9.67 KB
/
Copy pathworkflow.json
File metadata and controls
284 lines (284 loc) · 9.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
{
"id": "2fWnDQqsPy4mECqD",
"meta": {
"instanceId": "14e4c77104722ab186539dfea5182e419aecc83d85963fe13f6de862c875ebfa",
"templateCredsSetupCompleted": true
},
"name": "YouTube Transcription, Summarization & Translation to Google Docs",
"tags": [],
"nodes": [
{
"id": "15dc0183-3cf9-4538-b8ae-061e1447932e",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-462,
-320
],
"parameters": {
"width": 1780,
"height": 480,
"content": "## YouTube Transcription, Summarization & Translation to Google Docs"
},
"typeVersion": 1
},
{
"id": "3b60bfc9-4b53-485d-a27f-acf34936d61b",
"name": "Append Summary and Translation",
"type": "n8n-nodes-base.googleDocs",
"position": [
1116,
-200
],
"parameters": {
"actionsUi": {
"actionFields": [
{
"text": "={{ $('Summarize and Translate Text').item.json.text }}",
"action": "insert",
"locationChoice": "location"
}
]
},
"operation": "update",
"documentURL": "={{ $json.id }}"
},
"credentials": {
"googleDocsOAuth2Api": {
"id": "credential-id",
"name": "googleDocsOAuth2Api Credential"
}
},
"typeVersion": 2
},
{
"id": "838ac98e-e39d-4123-9128-a18382ff6127",
"name": "Create Output Document",
"type": "n8n-nodes-base.googleDocs",
"position": [
896,
-200
],
"parameters": {
"title": "={{ $('Format Webhook Input').item.json.videoId }}_{{ $('Format Webhook Input').item.json.language }}",
"folderId": "1FM-kd1_Xi2ikKpK7xAULFWYc_qVH2wwc"
},
"credentials": {
"googleDocsOAuth2Api": {
"id": "credential-id",
"name": "googleDocsOAuth2Api Credential"
}
},
"typeVersion": 2
},
{
"id": "c1464a7e-5f7d-4fc5-9021-dd3560565c50",
"name": "Summarize and Translate Text",
"type": "@n8n/n8n-nodes-langchain.chainLlm",
"position": [
520,
-200
],
"parameters": {
"text": "=This is a transcription that needs processing.\n\nPlease do the following:\n\n1. Generate a complete and accurate translation of the transcript into the specified language.\n2. Generate a concise and clear summary of the transcript\u2019s key points in the same language.\n\nTarget Language:\n{{ $('Combine Transcription Content').item.json.language }}\n\nTranscript:\n{{ $('Combine Transcription Content').item.json.mergedTranscript }}\n\nOutput Format:\nPlease return the result strictly in this JSON structure, with both values written in the target language:\n\n{\n \"translation\": \"Full translated version of the transcript in the specified language.\",\n \"summary\": \"Clear and concise summary of the transcript in the same language.\"\n}\n\nMake sure:\n- Both \"translation\" and \"summary\" keys are present.\n- The summary should not be skipped or embedded inside the translation.\n- Do NOT include markdown formatting (no triple backticks or code blocks).\n- Output must be valid JSON only.\n",
"batching": {},
"promptType": "define"
},
"typeVersion": 1.7
},
{
"id": "c4f73e8b-91fd-48d3-8843-98ce83c8e592",
"name": "Combine Transcription Content",
"type": "n8n-nodes-base.code",
"position": [
300,
-200
],
"parameters": {
"jsCode": "// Get the transcript JSON array from previous node\nconst data = $json[\"content\"];\n\n// Merge all text entries into a single string\nconst mergedText = data.map(entry => entry.text).join(\" \");\n\nreturn [\n {\n json: {\n mergedTranscript: mergedText\n }\n }\n];\n"
},
"typeVersion": 2
},
{
"id": "44103ed5-30af-45ea-b909-9ac8400d627e",
"name": "Transcribe YouTube Video",
"type": "n8n-nodes-base.httpRequest",
"position": [
80,
-200
],
"parameters": {
"url": "https://api.supadata.ai/v1/youtube/transcript?",
"options": {},
"sendQuery": true,
"sendHeaders": true,
"queryParameters": {
"parameters": [
{
"name": "videoId",
"value": "={{ $json.videoId }}"
}
]
},
"headerParameters": {
"parameters": [
{
"name": "x-api-key",
"value": ""
}
]
}
},
"typeVersion": 4.2
},
{
"id": "18941114-4d44-4c6c-a01f-a9d15bcd498a",
"name": "Format Webhook Input",
"type": "n8n-nodes-base.code",
"position": [
-140,
-200
],
"parameters": {
"jsCode": "const url = $json[\"body\"][\"youtube_url\"];\nconst match = url.match(/(?:v=|\\/)([0-9A-Za-z_-]{11})/);\nconst videoId = match ? match[1] : null;\n\nreturn [\n {\n json: {\n videoId,\n language: $json[\"body\"][\"language\"],\n enable_summary: $json[\"body\"][\"enable_summary\"],\n originalUrl: url\n }\n }\n];\n"
},
"typeVersion": 2
},
{
"id": "18b57cc6-5713-44cb-ace2-8d773c18f99e",
"name": "Trigger YouTube Processing Request",
"type": "n8n-nodes-base.webhook",
"position": [
-360,
-200
],
"webhookId": "9b151e87-749b-4ef2-82b4-5c3fec1657cc",
"parameters": {
"path": "youtube",
"options": {},
"httpMethod": "POST"
},
"typeVersion": 2
},
{
"id": "b5a33cf4-b3fd-4397-ac2f-de67b275fdf8",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-460,
200
],
"parameters": {
"width": 1780,
"height": 500,
"content": "# **Node Breakdown & Descriptions:**\n\n### * The workflow starts with a **Webhook** node named **\"Trigger YouTube Processing Request\"**, which activates when an HTTP POST request is made with three parameters: `youtube_url`, `language`, and `enable_summary`. This initiates the transcription and translation process.\n\n### * The next node, named **\"Format Webhook Input\"**, is a Code node that extracts and reformats the incoming data. It converts the input into a structured object containing `videoId`, `originalUrl`, `language`, and `enable_summary`.\n\n### * The **HTTP Request** node named **\"Transcribe YouTube Video\"** sends the `videoId` to Supadata\u2019s API to fetch the full transcription of the provided YouTube video in the source language.\n\n### * The **Code1** node named **\"Combine Transcription Content\"** takes the segmented transcription output and merges it into one coherent string. This prepares the transcription for processing by the language model.\n\n### * The **Basic LLM Chain** node named **\"Summarize and Translate Text\"** passes the merged transcript to the **Google Gemini Chat Model** to summarize and translate the text based on the selected `language` and `enable_summary` flag.\n\n### * The **Google Docs** node named **\"Create Output Document\"** creates a new Google Doc using a title derived from the `videoId` and selected `language`. It initializes the file where the final content will be stored.\n\n### * Finally, the **Google Docs** node named **\"Append Summary and Translation\"** updates the newly created Google Doc by inserting the translated and summarized content into the document body, completing the workflow."
},
"typeVersion": 1
},
{
"id": "f6c249d4-7924-4d53-be62-2f6aef324ee2",
"name": "Google Gemini To Summarize and Translate Text",
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"position": [
608,
20
],
"parameters": {
"options": {},
"modelName": "models/gemini-1.5-flash"
},
"credentials": {
"googlePalmApi": {
"id": "credential-id",
"name": "googlePalmApi Credential"
}
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "ded3d472-ec65-4166-ae4c-cf62179b6684",
"connections": {
"Format Webhook Input": {
"main": [
[
{
"node": "Transcribe YouTube Video",
"type": "main",
"index": 0
}
]
]
},
"Create Output Document": {
"main": [
[
{
"node": "Append Summary and Translation",
"type": "main",
"index": 0
}
]
]
},
"Transcribe YouTube Video": {
"main": [
[
{
"node": "Combine Transcription Content",
"type": "main",
"index": 0
}
]
]
},
"Summarize and Translate Text": {
"main": [
[
{
"node": "Create Output Document",
"type": "main",
"index": 0
}
]
]
},
"Combine Transcription Content": {
"main": [
[
{
"node": "Summarize and Translate Text",
"type": "main",
"index": 0
}
]
]
},
"Trigger YouTube Processing Request": {
"main": [
[
{
"node": "Format Webhook Input",
"type": "main",
"index": 0
}
]
]
},
"Google Gemini To Summarize and Translate Text": {
"ai_languageModel": [
[
{
"node": "Summarize and Translate Text",
"type": "ai_languageModel",
"index": 0
}
]
]
}
}
}