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

AI 驱动 YouTube niche 趋势发现器

输入 niche 关键词 → AI 生成搜索词并调用 YouTube API 抓取近2天视频 → 过滤时长并提取标签/统计 → AI 总结趋势与热门主题

有一点经验步骤流程提示词
给谁
YouTube 创作者、内容营销人员
你会得到
获取指定 niche 近2天的热门视频趋势、常见主题、标签模式及互动数据
你需要
n8n

硬约束

前置条件:n8n 实例;OpenAI API 密钥;YouTube OAuth2 API 凭证(youTubeOAuth2Api)。模板含主工作流与可被抽象为子工作流的 YouTube 搜索链。AI Agent 使用 window_buffer_memory 保持上下文。子工作流过滤时长 >3分30秒的视频,清洗描述中的链接与表情,以 ### NEXT VIDEO FOUND: ### 分隔返回。

他们做了什么

模板作者 leonardogrig 构建了一个 n8n 工作流,通过 Chat Trigger 接收用户查询,由 GPT 驱动的 AI Agent 理解 niche 并生成搜索词,调用内嵌的 YouTube 搜索子工作流抓取近2天视频数据,过滤掉短于3分30秒的内容,清洗描述与表情符号后返回结构化数据,最终由 AI Agent 生成趋势洞察报告。

效果如何

模板在 n8n.io 上发布,展示了一个可运行的示例输出:针对 "digital marketing" niche,AI 识别出 "mental triggers" 和 "psychological marketing" 为热门主题,相关视频超20万观看量(author_report)。本站未实测该工作流的实际运行效果。

值得知道

1. 子工作流(youtube_search 引用的 workflowId=N9DveO781xbNf8qs)在模板中为内部引用,实际部署时需确保该子工作流存在或自建等效流程。2. YouTube 节点使用 OAuth2 凭证,HTTP Request 节点依赖环境变量 GOOGLE_API_KEY。3. 时长过滤条件(>210秒)硬编码在 If 节点中,如需调整需手动修改表达式。4. 数据清洗(移除链接、表情、多余空格)通过 Code 节点实现,运行于全局静态数据,多实例部署时需注意并发覆盖风险。5. 模板未提供 ROI 或长期稳定性数据。

n8n 工作流模板

结构已检查 · 未实际运行

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

配置与测试清单

需要绑定的凭证

  • get_videos1 节点:绑定YouTube OAuth2 凭证。

需要替换的配置

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

测试输入与预期结果

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

模板处理说明

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

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

步骤

  1. 配置 Chat Trigger

    在工作流中添加 When chat message received 节点(chat_message_received)。保持默认配置或按需调整 webhook 路径。此节点接收用户输入的 niche 关键词;若用户未提供,AI Agent 会主动询问。

  2. 配置 AI Agent 与模型

    添加 AI Agent 节点,连接 OpenAI Chat Model(openai_llm)作为语言模型,Window Buffer Memory(window_buffer_memory)作为记忆。在 AI Agent 的 Options → System Message 中填入下方提示词。该提示词定义 Agent 的行为:验证 niche、调用 youtube_search 工具最多3次、解析返回数据并生成趋势洞察。

    运行提示词 · 来源原文。AI Agent 节点的 Options → System Message 字段

    =You help youtube creators find trending videos based on a specific niche.
    
    Verify if the user informed a niche before doing anything. If not, then ask him for one by giving him suggestions for him to select from.
    
    After you know what type of content the user might produce, use the "youtube_search" tool up to 3 times with different search terms based on the user's content type and niche.
    
    The tool will answer with a list of videos from the last 2 days that had the most amount of relevancy. It returns a list of json's covering each video's id, view count, like count, comment count, description, channel title, tags and channel id. Each video is separated by "### NEXT VIDEO FOUND: ###".
    
    You should then proceed to understand the data received then provide the user with insightful data of what could be trending from the past 2 days. Provide the user links to the trending videos which should be in this structure:
    
    https://www.youtube.com/watch?v={video_id}
    
    to reach the channel's link you should use:
    
    https://www.youtube.com/channel/{channel_id}
    
    Find patterns in the tags, titles and especially in the related content for the videos found.
    
    Your mission isn't to find the trending videos. It's to provide the user with valuable information of what is trending in that niche in terms of content news. Remember to provide the user with the numbers of views, likes and comments while commenting about any video. So you should not talk about any particular video, focus rather in explaining the overall senario of all that was found.
    
    Example of response:
    
    "It seems like what is trending in digital marketing right now is talking about mental triggers, since 3 of the most trending videos in the last 2 days were about..."
  3. 配置 YouTube 搜索子工作流

    添加或引用 youtube_search 工具工作流(Call n8n Workflow Tool)。该子工作流需包含以下节点链:YouTube 节点(get_videos1)搜索近2天视频 → Loop Over Items 分批处理 → HTTP Request(find_video_data1)获取视频详情 → If 节点过滤时长>210秒(3分30秒)→ Edit Fields(group_data1)提取 id/viewCount/likeCount/commentCount/description/title/channelTitle/tags/channelId → Code(save_data_to_memory1)清洗并拼接为 ### NEXT VIDEO FOUND: ### 格式 → Code(retrieve_data_from_memory1)读取全局静态数据 → Edit Fields(response1)返回结果。注意:YouTube 节点需配置 youTubeOAuth2Api 凭证;HTTP Request 节点使用 $env.GOOGLE_API_KEY 调用 YouTube Data API v3。

  4. 运行与验证

    激活工作流,在 Chat Trigger 中输入 niche(如 "digital marketing")。观察 AI Agent 是否生成最多3组搜索词、调用 youtube_search、并返回带视频链接与互动统计的趋势总结。若子工作流未返回数据,检查 YouTube API 配额、凭证有效期及搜索词是否过窄。

可复制提示词

搭建指导 · 本站建议版本。搭建助手启动词,用于理解模板结构和配置顺序

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

你是一个 YouTube 内容趋势分析助手。用户会提供一个 niche 或内容方向。你的任务是:
1. 若用户未提供 niche,主动询问并给出建议选项;
2. 根据 niche 生成最多3组不同的搜索词;
3. 调用 youtube_search 工具获取近2天相关视频数据;
4. 分析返回的标签、标题、描述和互动数据(观看、点赞、评论数);
5. 不聚焦单个视频,而是总结整体趋势,输出常见主题、标签模式、热门频道链接及互动统计。

将 AI Agent 的 systemMessage 完整粘贴到节点 System Message 字段;确保 youtube_search 子工作流已正确引用或自建等效流程。

来源

AI YouTube trend finder based on niche · leonardogrig · n8n.io · 2024-12-05

留言与反馈

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

正在加载…

    相关用例