YouTube 字幕报告生成器
中级
这是一个自动化工作流,包含 8 个节点。主要使用 Code, Webhook, HttpRequest, RespondToWebhook, ChainLlm 等节点。 YouTube 报告生成器
前置要求
- •HTTP Webhook 端点(n8n 会自动生成)
- •可能需要目标 API 的认证凭证
- •Google Gemini API Key
分类
-
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "nP0jpScffi653CjX",
"meta": {
"instanceId": "92786e96ce436aecd3a1d62d818a74e51ca684bb36c805928bef93a3b46549ad"
},
"name": "YouTube 字幕报告生成器",
"tags": [],
"nodes": [
{
"id": "60e90a8d-d97a-4e9b-91f4-cc24af3bf22d",
"name": "触发 Webhook",
"type": "n8n-nodes-base.webhook",
"position": [
-280,
0
],
"webhookId": "97aa1730-20ba-425c-852d-d08710a7f895",
"parameters": {
"path": "c18956b9-f9b7-4fc8-b01c-67d5c9eeddd9",
"options": {},
"responseMode": "responseNode"
},
"typeVersion": 2
},
{
"id": "8c51d64f-e380-4bee-9ce6-d0417a833167",
"name": "提取字幕 URL",
"type": "n8n-nodes-base.code",
"position": [
320,
0
],
"parameters": {
"jsCode": "// Get the HTML content\nconst html = items[0].json.data;\n\n// Search for the subtitles block in the HTML\nconst match = html.match(/\\\"captions\\\":\\\\{.*?\\\\}/);\n\nif (!match) {\n throw new Error(\"No subtitles information found in the HTML.\");\n}\n\n// Extract the subtitles block\nconst captionsBlock = match[0];\n\n// Search for all base URLs of subtitles\nconst baseUrlMatches = [...captionsBlock.matchAll(/\\\"baseUrl\\\":\\\"(.*?)\\\"/g)];\n\nif (!baseUrlMatches.length) {\n throw new Error(\"No subtitle URLs found.\");\n}\n\n// Decode and clean all base URLs\nconst baseUrls = baseUrlMatches.map(match => \n decodeURIComponent(match[1]).replace(/\\\\\\u0026/g, \"&\")\n);\n\n// Return all URLs as the node's output\nreturn baseUrls.map(url => ({ json: { baseUrl: url } }));\n"
},
"typeVersion": 2
},
{
"id": "87193be8-889e-464c-b4b6-08486b5f187c",
"name": "获取视频 HTML",
"type": "n8n-nodes-base.httpRequest",
"position": [
-20,
0
],
"parameters": {
"url": "https://www.youtube.com/watch",
"options": {},
"sendQuery": true,
"sendHeaders": true,
"queryParameters": {
"parameters": [
{
"name": "v",
"value": "={{ $json.query.id }}"
}
]
},
"headerParameters": {
"parameters": [
{
"name": "User-Agent",
"value": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36"
},
{
"name": "Accept",
"value": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"
},
{
"name": "Accept-Language",
"value": "en-US,en;q=0.5"
},
{
"name": "Connection",
"value": "keep-alive"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "73db26d3-7934-4dfe-af79-4827c64a9872",
"name": "获取字幕内容",
"type": "n8n-nodes-base.httpRequest",
"position": [
660,
0
],
"parameters": {
"url": "={{ $json.baseUrl }}",
"options": {}
},
"typeVersion": 4.2
},
{
"id": "fb7aa63c-9664-4311-ba29-8e46eb3b02e2",
"name": "生成分析报告",
"type": "@n8n/n8n-nodes-langchain.chainLlm",
"position": [
900,
0
],
"parameters": {
"text": "={{ $json.data }}",
"messages": {
"messageValues": [
{
"message": "**Prompt:** \nYour task is to process subtitles in XML format and generate an **analytical report** focusing on the main theme of the transcript. The report should focus solely on the theme and must not explicitly refer to the source of the content (e.g., avoid phrases like \"this video\" or \"this dialogue\"). \n\n**Instructions:** \n1. **Input:** \n - You will receive subtitles in XML format. This format will include tags such as <text>, <cue>, or similar that structure the data. \n2. **Extraction:** \n - Ignore the XML tags and extract only the textual content. \n - Maintain consistency and logical flow of the content during extraction. \n3. **Analysis:** \n - Identify the main ideas, key concepts, recurring themes, and connections between them. \n - Focus on the themes discussed and their overall relevance. \n4. **Report:** \n - Write a direct and analytical report that synthesizes the central theme. \n - Use formal and objective language without referencing the format or source of the subtitles. \n - Ensure the report is clear, well-structured, and centered on the theme. \n\n**Report Format:** \n- **Title:** A brief phrase capturing the essence of the main theme. \n- **Body of the report:** An analytical description of the main theme in **a maximum of 3 paragraphs**, with concise and coherent explanations. \n\n**Example Output:** \n\n**Title:** The Ethical Challenges of Artificial Intelligence \n\n**Report:** \nArtificial intelligence presents significant challenges in areas such as privacy, fairness, and automated decision-making. Its implementation in critical sectors such as healthcare, justice, and security has sparked debates about inherent biases and lack of transparency. Additionally, there is growing concern over the ethical implications of automation, including its impact on employment and the global economy. Finally, the importance of establishing strong regulatory frameworks is highlighted to balance technological innovation with the protection of human rights. \n\nApply this structure to any XML subtitle to transform it into a clear and professional thematic report."
}
]
},
"promptType": "define"
},
"typeVersion": 1.5
},
{
"id": "64604d71-c0ef-465d-a2f2-9dabd8456a89",
"name": "AI 模型配置",
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"position": [
980,
200
],
"parameters": {
"options": {
"temperature": 0.4
},
"modelName": "models/gemini-1.5-flash-002"
},
"credentials": {
"googlePalmApi": {
"id": "ll8OrIkHyNF0nCKT",
"name": "Google Gemini(PaLM) Api account"
}
},
"typeVersion": 1
},
{
"id": "fabb904d-b27d-4202-9b2d-8b1d76c6a597",
"name": "返回分析报告",
"type": "n8n-nodes-base.respondToWebhook",
"position": [
1260,
0
],
"parameters": {
"options": {},
"respondWith": "text",
"responseBody": "={{ $json.text }}"
},
"typeVersion": 1.1
},
{
"id": "c7345678-9abc-4ef0-8bdf-1234567890ab",
"name": "工作流概览",
"type": "n8n-nodes-base.stickyNote",
"position": [
-500,
0
],
"parameters": {
"height": 200,
"content": "此工作流处理 YouTube 视频字幕以生成主题分析报告。"
},
"typeVersion": 1
}
],
"active": true,
"settings": {
"executionOrder": "v1"
},
"versionId": "01e378ed-fb29-4826-9d43-5ed5cf8579de",
"connections": {
"Trigger Webhook": {
"main": [
[
{
"node": "Fetch Video HTML",
"type": "main",
"index": 0
}
]
]
},
"Fetch Video HTML": {
"main": [
[
{
"node": "Extract Subtitles URLs",
"type": "main",
"index": 0
}
]
]
},
"AI Model Configuration": {
"ai_languageModel": [
[
{
"node": "Generate Analytical Report",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Extract Subtitles URLs": {
"main": [
[
{
"node": "Fetch Subtitles Content",
"type": "main",
"index": 0
}
]
]
},
"Fetch Subtitles Content": {
"main": [
[
{
"node": "Generate Analytical Report",
"type": "main",
"index": 0
}
]
]
},
"Generate Analytical Report": {
"main": [
[
{
"node": "Return Analytical Report",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
中级
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
我的工作流
使用 Google Gemini 抓取 ProductHunt
Code
Webhook
Http Request
+5
14 节点Mauricio Perera
产品
Slack 多语言助手(使用 Gemini 2.5 Flash)
使用Gemini 2.5 Flash自动化多语言Slack通信(日语⇄英语)
If
Code
Switch
+6
29 节点Tomohiro Goto
杂项
深度研究智能体
深度研究智能体 - 自动化研究与 Notion 报告生成器
Set
Code
Filter
+17
43 节点Aziz B
市场调研
在可视化参考库中探索n8n节点
在可视化参考库中探索n8n节点
If
Ftp
Set
+93
113 节点I versus AI
其他
智能网络查询与语义重排序
使用Brave和Google Gemini的智能网络查询及语义重排序流程
Code
Webhook
Date Time
+9
20 节点Mind-Front
销售
计算向量集的质心
计算向量集的质心
Set
Code
Webhook
+2
8 节点Mauricio Perera
其他
工作流信息
难度等级
中级
节点数量8
分类-
节点类型7
作者
Mauricio Perera
@rckflrAutomation consultant with over 10 years of experience specializing in AI, no-code, and workflow optimization. I’ve delivered tailored AI and NLP solutions across real estate, healthcare, and more, enhancing efficiency and customer experiences. Proficient in tools like Make, Airtable, and Zapier, I also integrate GPT models to create scalable, innovative automations. Contact me to discuss custom n8n workflows or advanced automations to streamline your processes.
外部链接
在 n8n.io 查看 →
分享此工作流