Gemini创意视频AI 评分 · 83/100AI 辅助编辑·未发现明显提示词注入风险n8n.io

用 n8n 自动从 Google Drive 视频生成 YouTube SEO 元数据与缩略图

Google Drive 上传视频 → LemonFox 转录 → Gemini 分析生成标题/描述/标签/缩略图 → 自动上传 YouTube → 清理权限

经验丰富步骤流程提示词贴士
给谁
需要将视频自动发布到 YouTube 并生成 SEO 元数据的内容创作者或运营团队
你会得到
视频上传 Drive 后自动完成转录、SEO 包装、缩略图生成与 YouTube 发布
你需要
n8n · google-drive · lemonfox

硬约束

前置条件:可访问的 n8n 实例;Google Drive OAuth 凭证并授权目标文件夹;LemonFox API Key;Google Gemini API 凭证;YouTube/upload-post.com 的 API 凭证。将模板导入 n8n 后,按节点说明填入凭证与文件夹 ID。视频文件需提前放入 Drive 指定文件夹,赞助商信息文件需按 videotitle_sponsors.txt 命名同目录存放。

他们做了什么

作者 iamvaar 在 n8n 上发布了一个端到端模板:当 Google Drive 的指定文件夹出现新视频文件时,自动触发转录、AI 内容分析、缩略图生成,并通过 upload-post.com 上传至 YouTube,最后清理 Drive 文件的临时公开权限。模板包含 22 个节点,分为触发与访问、转录与数据准备、AI 策略与创意、发布与清理四个阶段。

效果如何

来源未报告具体运行数据或效果指标(如 CTR 提升、发布耗时减少)。模板在 n8n 平台展示为 published 状态,累计 84 次浏览(截至采集日)。

值得知道

1. 本站未实际导入运行该工作流(reproduction=not_tested),不保证各节点在当前 n8n 版本下的兼容性。2. 上传节点依赖第三方服务 upload-post.com,非 YouTube 官方 Data API;需单独注册并获取 API Key,且模板中的 Authorization 头使用 Apikey 前缀格式。3. 赞助商文件必须严格按 videotitle_sponsors.txt 命名,与视频同目录,否则 Search Drive Files 节点将返回空结果。4. Grant Temp File Access 节点将文件权限临时改为 anyoneWithLink,存在短暂公开窗口,敏感内容需谨慎评估。5. 文本分析模型在快照中为 gemini-3.1-flash-lite-preview,图像生成模型为 gemini-2.5-flash-image(Nano Banana),实际可选模型可能随 Gemini 更新而变化。6. 若 LemonFox 转录失败或返回非预期格式,Clean SRT Content 节点的正则可能需调整。

n8n 工作流模板

结构已检查 · 未实际运行

下载后在 n8n 选择“Import from File”,或复制 JSON 后粘贴到编辑器。先配置自己的账号,再用测试数据运行;模板默认未启用。

配置与测试清单

需要绑定的凭证

  • 将 __UKH_BEARER_20__ 替换为实际密钥/令牌(原路径 /nodes/20/parameters/headerParameters/parameters/0/value;literal auth header)。

需要替换的配置

  • 源模板来自 n8n 公开库 #14255(约 22 个节点)。导入后先保持未启用,核对触发器、表达式与外部 API 端点。
  • Sticky Note 中的说明仅供参考;按自己的账号、表结构或频道 ID 替换占位配置。

测试输入与预期结果

  • 在测试环境手动执行一次主路径,确认每个需凭证的节点已连接且无鉴权错误。
  • 用一条合成/脱敏样例数据跑通,核对输出字段与下游写入目标,再考虑生产启用。

模板处理说明

  • 已移除原作者凭证绑定、webhookId 与执行数据,工作流设为未启用;节点、连线与原文提示词保持原样。未在 n8n 中实际运行。
  • 未改业务逻辑;运行前请自行核对密钥、配额与隐私合规。 另将 1 处字面量密钥替换为 __UKH_…__ 占位符。

模板获取日期: 2026-10-24

步骤

  1. 配置触发器与临时访问权限

    在 n8n 中导入模板后,配置 Google Drive Trigger 节点:选择 event=fileCreated,triggerOn=specificFolder,填入要监控的 folderToWatch(如 transcript 文件夹)。接着配置 If Video Mime Type 节点,条件为 mimeType contains video,确保仅视频文件触发后续流程。然后配置 Grant Temp File Access 节点,使用 Google Drive OAuth2 凭证,向文件添加 anyoneWithLink 的 reader 权限,使外部服务可下载该视频。

  2. 转录视频并清理字幕

    配置 Post Audio to Lemonfox 节点:方法 POST,URL https://api.lemonfox.ai/v1/audio/transcriptions,认证选 HTTP Bearer Auth 并填入 LemonFox API Key;body 参数 file 指向 Drive 下载链接(模板已引用上游节点 ID),language=english,response_format=srt。运行后,Clean SRT Content 代码节点会自动去除转录结果中的转义引号与换行符,并清理多余空行。随后 Create Text File in Drive 节点将清理后的 .srt 文件写回 Drive 存档。

    运行提示词 · 来源原文。Clean SRT Content 节点的 JS Code 字段

    // Get raw string
    let raw = $json.data;
    
    // Step 1: Remove wrapping quotes if present
    if (raw.startsWith('"') && raw.endsWith('"')) {
      raw = raw.slice(1, -1);
    }
    
    // Step 2: Unescape characters
    raw = raw
      .replace(/\\"/g, '"')   // \" → "
      .replace(/\\n/g, '\n'); // \n → actual newline
    
    // Step 3: Clean extra blank lines (optional but nice)
    raw = raw.replace(/\n{3,}/g, '\n\n').trim();
    
    // Return as clean SRT
    return [
      {
        json: {
          srt: raw
        }
      }
    ];
  3. 提取赞助商信息

    Search Drive Files 节点会自动按视频文件名(去掉扩展名)拼接 _sponsors.txt 作为查询字符串,在同目录下查找赞助商信息文件。若存在,Fetch File Details 通过 Google Drive API 下载该文件,Extract Content from File 节点将其转为文本,输出给下游 AI 节点。若无需赞助商功能,可跳过或留空该分支,但模板默认保留此查询。

  4. AI 分析内容并生成缩略图

    Content Analysis Agent 节点接收转录文本与赞助商信息,调用 Gemini Chat Model(模型 gemini-3.1-flash-lite-preview)执行分析。节点已连接 Parse Structured Output,强制输出严格 JSON。随后 Generate Thumbnail Image 节点使用 gemini-2.5-flash-image(Nano Banana)根据 AI 生成的 thumbnail_prompt 创建 16:9 缩略图。

    运行提示词 · 来源原文。Content Analysis Agent 节点的 Text / System Prompt 字段

    =**You are an expert YouTube Content Strategist and SEO Specialist. Your task is to transform the provided video transcript into a fully optimized YouTube metadata package (Title, Description, Tags, and Hashtags) designed for high CTR and search discoverability.**
    
    ---
    
    **Video Transcript:** `{{ $('Post Audio to Lemonfox').item.json.data }}`
    
    
    
    ---
    
    ### **Instructions:**
    
    1.  **Analyze the Transcript:** Identify the "Big Idea," key takeaways, and the most clickable moment to form the basis of the title and hook.
    2.  **Video Title:** Create a compelling, high-CTR title (under 70 characters). Balance SEO keywords with psychological triggers (curiosity, urgency, or transformation).
    3.  **Video Description:**
        * **The Hook:** A strong opening sentence that summarizes the value.
        * **The Summary:** A concise, engaging breakdown of what the viewer will learn (150–300 words).
        * **Formatting:** Use clean spacing and bullet points for readability.
        * **Call to Action:** Include a prompt for viewers to subscribe or comment on a specific topic from the video.
    4.  **Tags & Hashtags:** * Generate 15–20 relevant SEO tags (comma-separated).
        * Generate 3–5 high-reach hashtags.
    5.  **Thumbnail Prompt:** Create a detailed AI image prompt for a 16:9 YouTube thumbnail. Focus on high contrast, "face-to-camera" emotion (if applicable), and bold text overlay suggestions.
    
    ---
    
    **Sponsors:** `{{ $json.data }}`
    
    ### **Sponsor Handling:**
    
    * Check the "Sponsors" input.
    * **If sponsors exist:** * Include a "Sponsored By" section at the top of the `video_description`.
        * Extract and list their **name** and **email**.
    * **If no sponsors exist:** Return an empty array for the sponsors key.
    * And this sponsors had nothingh to do with the description or title so just extract the sponsor seperately.
    ---
    
    ### **Output Format:**
    
    Return **strictly** a valid JSON object with the following structure:
    
    ```json
    {
      "video_title": "Your optimized YouTube title here",
      "video_description": "Your full SEO description including sponsor mentions...",
      "tags": "tag1, tag2, tag3, tag4...",
      "hashtags": "#hashtag1 #hashtag2 #hashtag3",
      "thumbnail_prompt": "Detailed 16:9 AI image generation prompt here...",
      "sponsors": [
        {
          "sponsor_name": "Sponsor Name",
          "sponsor_email": "[email protected]"
        }
      ]
    }
    ```
  5. 上传 YouTube 并清理权限

    【首次测试安全】首次测试前,建议将 Upload to YouTube API 节点暂时断开或替换为 mock 端点,使用测试视频和测试账号验证元数据与缩略图正确性后再启用真实上传。Upload to YouTube API 节点向 https://api.upload-post.com/api/upload 发送 multipart/form-data POST 请求,包含视频下载链接、AI 生成的标题与描述、平台标识 youtube,以及上一步生成的缩略图二进制数据。需在 header 中填入 upload-post.com 的 API Key(模板中占位为 enter-your-api-key),并在 body 参数中替换 enter-your-username 为实际用户名。上传完成后,Delete Original File permissions in Drive 节点立即删除 anyoneWithLink 权限,恢复文件私有状态。

可复制提示词

搭建指导 · 本站建议版本。交给搭建助手,先确认输入和权限

这一段是提示词,页面不会在这里插入广告。

你是一个 n8n 工作流搭建助手。用户希望复现「从 Google Drive 视频自动生成 YouTube SEO 元数据与缩略图」的模板。请先确认用户已具备以下前提:1)n8n 实例;2)Google Drive OAuth 凭证并授权目标文件夹;3)LemonFox API Key;4)Google Gemini API 凭证;5)upload-post.com 的 API 凭证。然后引导用户按步骤配置 Trigger、转录节点、AI Agent 提示词(可调整风格)、缩略图生成模型与上传凭证。提醒用户将 folderToWatch、API Key、用户名等占位符替换为实际值,并建议先用测试视频验证完整流程。

如需调整生成风格,可修改 Content Analysis Agent 中的 SEO 策略与 thumbnail_prompt 要求;如需更换上传目标,需替换 Upload to YouTube API 的 URL 与参数。

来源

Create YouTube SEO metadata and thumbnails from Google Drive videos with Gemini, LemonFox and upload-post · iamvaar · n8n.io · 2026-03-23

留言与反馈

试过这个方法吗?分享效果、遇到的问题或改进建议。留言审核后公开,请勿填写敏感信息。

正在加载…

    相关用例