使用 AI 字幕对用户视频进行去重并自动发布到 X 平台
高级
这是一个自动化工作流,包含 25 个节点。主要使用 If, Set, Code, Twitter, HttpRequest 等节点。 使用 OpenRouter AI 字幕和 Google Sheets 去重自动发布 X 视频
前置要求
- •Twitter API 凭证
- •可能需要目标 API 的认证凭证
- •Google Sheets API 凭证
分类
-
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "6SOSDrfhrqAX7DBS",
"meta": {
"instanceId": "15d6057a37b8367f33882dd60593ee5f6cc0c59310ff1dc66b626d726083b48d"
},
"name": "使用AI字幕对用户视频进行去重并自动发布到X平台",
"tags": [],
"nodes": [
{
"id": "b4721eab-d2f9-4687-be1b-15ef709f4eb9",
"name": "定时触发器",
"type": "n8n-nodes-base.scheduleTrigger",
"notes": "設定した時間間隔でワークフローを自動的に開始するトリガーです。",
"position": [
-160,
256
],
"parameters": {
"rule": {
"interval": [
{
"field": "hours"
}
]
}
},
"typeVersion": 1.2
},
{
"id": "ced6b0eb-8a23-4a07-aba2-140f9b1c0480",
"name": "获取用户ID",
"type": "n8n-nodes-base.httpRequest",
"notes": "指定ユーザー名から API で利用する user.id を取得します。",
"position": [
64,
256
],
"parameters": {
"url": "https://api.twitter.com/2/users/by/username/XXXXXXXXX",
"options": {},
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "User-Agent",
"value": "n8n-workflow"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "fd64a087-90ed-43c9-8305-358dd1b58b40",
"name": "获取带视频的推文",
"type": "n8n-nodes-base.httpRequest",
"notes": "ユーザーの最新ツイート(メディア含む)を取得します。",
"position": [
288,
256
],
"parameters": {
"url": "={{ 'https://api.twitter.com/2/users/' + $json.data.id + '/tweets?max_results=10&tweet.fields=attachments&expansions=attachments.media_keys&media.fields=type,url,variants' }}",
"options": {}
},
"typeVersion": 4.2
},
{
"id": "69b14da0-3280-4c55-bc50-c4b7f355af23",
"name": "筛选视频推文",
"type": "n8n-nodes-base.code",
"notes": "動画メディアのみ抽出します。",
"position": [
512,
256
],
"parameters": {
"jsCode": "const tweets = $input.first().json.data || [];\nconst includes = $input.first().json.includes || {};\nconst media = includes.media || [];\nconst out = [];\nfor (const t of tweets) {\n const keys = (t.attachments && t.attachments.media_keys) || [];\n const hasVideo = keys.some(k => (media.find(m => m.media_key===k) || {}).type === 'video');\n if (hasVideo) {\n out.push({ tweet_id: t.id, text: t.text, url: `https://twitter.com/i/status/${t.id}` });\n }\n}\nreturn out;"
},
"typeVersion": 2
},
{
"id": "5ae1e3f9-4821-41ea-b88e-c9041d7a933a",
"name": "检查现有URL",
"type": "n8n-nodes-base.googleSheets",
"notes": "履歴管理のためシートに追記します。",
"position": [
736,
256
],
"parameters": {
"columns": {
"value": {
"URL": "={{ $json.url }}",
"文章": "={{ $json.text }}",
"ツイートID": "={{ $json.tweet_id }}"
},
"schema": [
{
"id": "ツイートID",
"type": "string",
"displayName": "ツイートID",
"canBeUsedToMatch": true
},
{
"id": "文章",
"type": "string",
"displayName": "文章",
"canBeUsedToMatch": true
},
{
"id": "URL",
"type": "string",
"displayName": "URL",
"canBeUsedToMatch": true
},
{
"id": "setURL",
"type": "string",
"displayName": "setURL",
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"row_number"
]
},
"options": {},
"operation": "append",
"sheetName": {
"__rl": true,
"mode": "list",
"value": 89155752,
"cachedResultName": "更新情報"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "19pJoBuba1o2PaJlx0inaGnGi45PpxbfB79MMhwLFH4s",
"cachedResultName": "1.投稿自動収集"
}
},
"typeVersion": 4.5
},
{
"id": "d974879e-f343-4375-b521-4ff6f5780a9e",
"name": "获取简报",
"type": "n8n-nodes-base.set",
"notes": "URL を引用動画形式へ変換します。",
"position": [
960,
256
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "1",
"name": "=setURL",
"type": "string",
"value": "={{ $json.URL }}/video/1"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "325148aa-46c7-447c-badf-5193c567e622",
"name": "在表格中追加或更新行",
"type": "n8n-nodes-base.googleSheets",
"notes": "setURL を upsert します。",
"position": [
1184,
256
],
"parameters": {
"columns": {
"value": {
"setURL": "={{ $json.setURL }}",
"ツイートID": "={{ $('Check Existing URLs').item.json['ツイートID'] }}"
},
"schema": [
{
"id": "ツイートID",
"type": "string",
"displayName": "ツイートID",
"canBeUsedToMatch": true
},
{
"id": "setURL",
"type": "string",
"displayName": "setURL",
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"ツイートID"
]
},
"options": {},
"operation": "appendOrUpdate",
"sheetName": {
"__rl": true,
"mode": "list",
"value": 89155752,
"cachedResultName": "更新情報"
},
"documentId": {
"__rl": true,
"mode": "id",
"value": "=19pJoBuba1o2PaJlx0inaGnGi45PpxbfB79MMhwLFH4s"
}
},
"typeVersion": 4.7
},
{
"id": "380ba318-3a78-488e-9b63-4f820a56d568",
"name": "检查新视频",
"type": "n8n-nodes-base.if",
"notes": "未完了のみ次へ流します。",
"position": [
1408,
256
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 1,
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "1",
"operator": {
"type": "string",
"operation": "notEqual"
},
"leftValue": "={{ $('Append or update row in sheet').item.json['達成状況'] || '' }}",
"rightValue": "完了"
}
]
}
},
"typeVersion": 2
},
{
"id": "5c7f361a-2e63-4eca-9107-a8d7135194f3",
"name": "生成推文文本",
"type": "@n8n/n8n-nodes-langchain.agent",
"notes": "AI が投稿文を生成します。",
"position": [
1632,
256
],
"parameters": {
"text": "={{ $json.text }}\n\nこの内容に基づいて、魅力的な投稿文を日本語で生成してください。\n以下の要素を含めてください:\n- 簡潔で興味を引く説明\n- 適切なハッシュタグ(3-5個)\n- エンゲージメントを促す要素\n\n文字数は100-150文字程度で、最後に動画URLを配置できるようにしてください。",
"options": {
"systemMessage": "あなたはソーシャルメディアのコンテンツ作成の専門家です。提供された内容から魅力的で共有されやすい投稿文を作成してください。"
},
"promptType": "define"
},
"typeVersion": 2
},
{
"id": "44c907e2-890c-4d6e-beb4-34c0bfc22e8d",
"name": "发布到X平台",
"type": "n8n-nodes-base.twitter",
"notes": "自動で X に投稿します。",
"position": [
1984,
256
],
"parameters": {
"text": "={{ $json.output }}\n\n{{ $('Append or update row in sheet').item.json.setURL }}",
"additionalFields": {}
},
"typeVersion": 2
},
{
"id": "16e954d5-8e49-43f8-94a1-90b867531bdc",
"name": "更新电子表格",
"type": "n8n-nodes-base.googleSheets",
"notes": "投稿完了をマークします。",
"position": [
2208,
256
],
"parameters": {
"columns": {
"value": {
"達成状況": "完了",
"ツイートID": "={{ $('Append or update row in sheet').item.json['ツイートID'] }}"
},
"mappingMode": "defineBelow",
"matchingColumns": [
"ツイートID"
]
},
"options": {},
"operation": "appendOrUpdate",
"sheetName": {
"__rl": true,
"mode": "list",
"value": 89155752,
"cachedResultName": "更新情報"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "19pJoBuba1o2PaJlx0inaGnGi45PpxbfB79MMhwLFH4s"
}
},
"typeVersion": 4.5
},
{
"id": "ea0648dc-eda5-417c-a3e1-d5ca7b925c20",
"name": "OpenRouter聊天模型",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
"notes": "LLM の資格情報を参照します。",
"position": [
1696,
480
],
"parameters": {
"options": {}
},
"typeVersion": 1
},
{
"id": "f850486d-8ec9-4a1a-842e-46ca8a92c1b2",
"name": "🟨 置顶:概述",
"type": "n8n-nodes-base.stickyNote",
"position": [
-704,
32
],
"parameters": {
"color": "yellow",
"width": 396,
"height": 260,
"content": "## 模板概述(请先阅读)"
},
"typeVersion": 1
},
{
"id": "2e27e014-ffbe-4cbb-ba7a-e4ecb7016121",
"name": "置顶:计划触发器",
"type": "n8n-nodes-base.stickyNote",
"position": [
-256,
-16
],
"parameters": {
"color": "white",
"width": 268,
"height": 260,
"content": "## 计划触发器 — 使用方法"
},
"typeVersion": 1
},
{
"id": "ff7793b2-6ed8-4dd9-8cf9-bf094084beff",
"name": "置顶:获取用户ID",
"type": "n8n-nodes-base.stickyNote",
"position": [
16,
432
],
"parameters": {
"color": "white",
"width": 300,
"height": 308,
"content": "## 获取用户ID(HTTP请求)"
},
"typeVersion": 1
},
{
"id": "27854651-0068-49d9-87f8-06f4523bf950",
"name": "置顶:获取带视频的推文",
"type": "n8n-nodes-base.stickyNote",
"position": [
80,
-48
],
"parameters": {
"color": "white",
"width": 380,
"height": 292,
"content": "## 获取带视频的推文(HTTP请求)"
},
"typeVersion": 1
},
{
"id": "4f5b8177-7605-40b0-9d7a-b714d21155e0",
"name": "置顶:筛选视频推文",
"type": "n8n-nodes-base.stickyNote",
"position": [
480,
-16
],
"parameters": {
"color": "white",
"width": 300,
"height": 260,
"content": "## 筛选视频推文(代码)"
},
"typeVersion": 1
},
{
"id": "65afa322-a9e1-464b-8cee-1fcccb4222b6",
"name": "置顶:检查现有URL",
"type": "n8n-nodes-base.stickyNote",
"position": [
624,
432
],
"parameters": {
"color": "white",
"width": 396,
"height": 260,
"content": "## 检查现有URL(Google Sheets — 追加)"
},
"typeVersion": 1
},
{
"id": "b3a11fdc-4781-41db-83d7-4b95cc5bd080",
"name": "置顶:编辑字段",
"type": "n8n-nodes-base.stickyNote",
"position": [
880,
0
],
"parameters": {
"color": "white",
"width": 284,
"height": 260,
"content": "## 编辑字段(Set)"
},
"typeVersion": 1
},
{
"id": "a34e1c1d-e631-4de1-baad-818a28dad740",
"name": "置顶:追加/更新(setURL)",
"type": "n8n-nodes-base.stickyNote",
"position": [
1136,
480
],
"parameters": {
"color": "white",
"width": 332,
"height": 260,
"content": "## 在表格中追加或更新行(Google Sheets — Upsert)"
},
"typeVersion": 1
},
{
"id": "064badd6-d0e8-411c-9170-e814952123c0",
"name": "置顶:检查新视频",
"type": "n8n-nodes-base.stickyNote",
"position": [
1280,
-32
],
"parameters": {
"color": "white",
"width": 284,
"height": 260,
"content": "## 检查新视频(IF)"
},
"typeVersion": 1
},
{
"id": "9d337b5b-8b19-4702-9119-c70f3ab977a6",
"name": "置顶:OpenRouter聊天模型",
"type": "n8n-nodes-base.stickyNote",
"position": [
1600,
608
],
"parameters": {
"color": "white",
"width": 348,
"height": 260,
"content": "## OpenRouter聊天模型(凭证)"
},
"typeVersion": 1
},
{
"id": "3204d240-cf45-421b-8f37-43b2aede2bf7",
"name": "置顶:生成推文文本",
"type": "n8n-nodes-base.stickyNote",
"position": [
1600,
-32
],
"parameters": {
"color": "white",
"width": 268,
"height": 260,
"content": "## 生成推文文本(AI Agent)"
},
"typeVersion": 1
},
{
"id": "f26c937b-e425-4e59-bcc6-4e3b3d63145e",
"name": "置顶:发布到X平台",
"type": "n8n-nodes-base.stickyNote",
"position": [
1920,
-16
],
"parameters": {
"color": "white",
"width": 252,
"height": 260,
"content": "## 发布到X平台(Twitter)"
},
"typeVersion": 1
},
{
"id": "96c75931-3078-40b8-a730-8ae0f4e005e3",
"name": "置顶:更新电子表格",
"type": "n8n-nodes-base.stickyNote",
"position": [
2192,
400
],
"parameters": {
"color": "white",
"width": 252,
"height": 276,
"content": "## 更新电子表格(Google Sheets)"
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "1068413b-38d0-45c7-ac4f-81edd645b61a",
"connections": {
"Post to X": {
"main": [
[
{
"node": "Update Spreadsheet",
"type": "main",
"index": 0
}
]
]
},
"Edit Fields": {
"main": [
[
{
"node": "Append or update row in sheet",
"type": "main",
"index": 0
}
]
]
},
"Get User ID": {
"main": [
[
{
"node": "Get Tweets with Videos",
"type": "main",
"index": 0
}
]
]
},
"Check New Videos": {
"main": [
[
{
"node": "Generate Tweet Text",
"type": "main",
"index": 0
}
]
]
},
"Schedule Trigger": {
"main": [
[
{
"node": "Get User ID",
"type": "main",
"index": 0
}
]
]
},
"Check Existing URLs": {
"main": [
[
{
"node": "Edit Fields",
"type": "main",
"index": 0
}
]
]
},
"Filter Video Tweets": {
"main": [
[
{
"node": "Check Existing URLs",
"type": "main",
"index": 0
}
]
]
},
"Generate Tweet Text": {
"main": [
[
{
"node": "Post to X",
"type": "main",
"index": 0
}
]
]
},
"OpenRouter Chat Model": {
"ai_languageModel": [
[
{
"node": "Generate Tweet Text",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Get Tweets with Videos": {
"main": [
[
{
"node": "Filter Video Tweets",
"type": "main",
"index": 0
}
]
]
},
"Append or update row in sheet": {
"main": [
[
{
"node": "Check New Videos",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
内容聚合
使用Gemini AI从网站文章自动化社交媒体帖子发布到LinkedIn和X/Twitter
If
Set
Xml
+16
34 节点Vadim
内容创作
LinkedIn和X病毒内容自动引擎
使用AI生成和发布自动创建LinkedIn和X的病毒内容
If
Set
Wait
+26
156 节点Diptamoy Barman
内容创作
内容生成器 v4
内容农场v4 - 使用ChatGPT 5和Gemini实现WordPress博客自动化
If
Set
Code
+26
168 节点Jay Emp0
使用AI和Freepik将Reddit商业痛点转换为病毒式LinkedIn内容
使用AI和Freepik将Reddit商业痛点转换为病毒式LinkedIn内容
If
Set
Code
+16
48 节点Daniel Lianes
内容创作
使用AI、ElevenLabs和多平台发布创建和审批POV视频
使用AI、ElevenLabs和多平台发布创建和审批POV视频(TikTok/IG/YT)
If
Set
Code
+20
60 节点Immanuel
设计
每日 WhatsApp 群组智能分析:GPT-4.1 分析与语音消息转录
每日 WhatsApp 群组智能分析:GPT-4.1 分析与语音消息转录
If
Set
Code
+20
52 节点Daniel Lianes
杂项