【n8n系列教程6】十分钟完成:每日AI总结L站热门贴,并自动推送到你的邮箱

请先看完免费部署教程:

也可以使用官网的,但官网的仅14天试用,可以用临时邮箱薅

效果展示:

工作流展示

快速使用:配置好谷歌云的凭据

:wave:工作流JSON代码 (复制粘贴导入)

{
  "name": "每日热帖推送",
  "nodes": [
    {
      "parameters": {
        "modelName": "models/gemini-1.5-pro-002",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "typeVersion": 1,
      "position": [
        600,
        160
      ],
      "id": "4cd5de62-0230-4a03-b6ee-7c6d2386babe",
      "name": "Google Gemini Chat Model",
      "notesInFlow": true,
      "credentials": {
        "googlePalmApi": {
          "id": "UfZRTL45gYb4TiMq",
          "name": "Google Gemini(PaLM) Api account 4"
        }
      }
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=以下为L站的帖子的内容\n{{ $json.text }}",
        "messages": {
          "messageValues": [
            {
              "message": "你是论坛内容分析助手。针对每篇帖子,请严格按以下的格式提供输出:\n\n    <div class=\"container\">\n        <div class=\"header\">\n            <div class=\"title\">xx(序号).原标题:</div>\n            <div class=\"author\">🖋️作者:作者名</div>\n            <div><a href=\"原链接\" class=\"link\">🔗链接:原链接</a></div>\n        </div>\n\n        <div class=\"content-section\">\n            <h3>📊内容分析:</h3>\n            <ul>\n                <li><span>📌核心内容:</span>用简洁的几个句子全面概括相应帖子内容</li>\n                <li><span>🔑重要信息:</span>列出2-3个关键点</li>\n                <li><span>💡实用价值:</span>提取可操作的信息(如有)</li>\n            </ul>\n        </div>\n    </div>\n\n处理原则:\n- 保持简洁,避免冗长\n- 突出实用性内容\n- 如涉及资源,标注使用条件\n- 如涉及技术,标注关键参数\n- 输出格式统一,方便阅读,不要有多余的类似“```html”的标识\n- 重要信息优先\n"
            }
          ]
        }
      },
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "typeVersion": 1.4,
      "position": [
        540,
        0
      ],
      "id": "ee51f068-62f1-482f-b671-61cb7849c7fb",
      "name": "Gemini总结",
      "retryOnFail": true,
      "notesInFlow": true
    },
    {
      "parameters": {
        "jsCode": "// 获取上一节点传递过来的 items\nconst items = $input.all();\n\n// 创建一个空字符串,用来存储合并后的文本\nlet text = \"\";\n\n// 遍历所有的 items,并提取出所需的信息\nitems.forEach((item, index) => {\n    // 获取当前 item 的信息\n    const creator = item.json.creator;\n    const title = item.json.title;\n    const link = item.json.link;\n    const contentSnippet = item.json.contentSnippet;\n\n    // 按照指定格式将每个 item 的信息拼接\n    text += `第${index + 1}篇帖子标题:${title} \\n 第${index + 1}篇帖子作者:${creator} \\n 第${index + 1}篇帖子链接:${link} \\n 第${index + 1}篇帖子内容:${contentSnippet} \\n\\n`;\n});\n\n// 将合并后的字符串赋值给 text 变量\nreturn {\n    text: text.trim() // 去除最后的多余换行\n};\n"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        380,
        0
      ],
      "id": "67465ac3-413f-40eb-8461-30603662aad9",
      "name": "提取有效内容",
      "retryOnFail": true
    },
    {
      "parameters": {
        "url": "https://linux.do/top.rss?period=daily",
        "options": {}
      },
      "type": "n8n-nodes-base.rssFeedRead",
      "typeVersion": 1.1,
      "position": [
        -40,
        0
      ],
      "id": "02e980e8-2f4f-468d-8678-f340c798a94c",
      "name": "读取L站热门消息",
      "retryOnFail": true
    },
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 23,
              "triggerAtMinute": 30
            }
          ]
        }
      },
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        -220,
        0
      ],
      "id": "20a0881e-26c0-4a9d-8bc8-d4ffb9de522a",
      "name": "每天运行一次",
      "notesInFlow": true
    },
    {
      "parameters": {
        "maxItems": 20
      },
      "type": "n8n-nodes-base.limit",
      "typeVersion": 1,
      "position": [
        180,
        0
      ],
      "id": "2460c13a-1452-42cb-b367-1dd323d98f49",
      "name": "取前20条帖子"
    },
    {
      "parameters": {
        "sendTo": "你要发送到的邮箱",
        "subject": "LinuxDo每日热门消息速递",
        "message": "=<!DOCTYPE html>\n<html lang=\"zh\">\n<head>\n    <meta charset=\"UTF-8\">\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n    <style>\n        body {\n            font-family: 'Arial', sans-serif;\n            line-height: 1.6;\n            margin: 0;\n            padding: 0;\n            background-color: #f4f4f4;\n            color: #333;\n        }\n        .container {\n            max-width: 600px;\n            margin: 20px auto;\n            padding: 20px;\n            background-color: #fff;\n            border-radius: 8px;\n            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);\n        }\n        .header {\n            text-align: center;\n            margin-bottom: 20px;\n        }\n        .title {\n            font-size: 24px;\n            font-weight: bold;\n            color: #2c3e50;\n        }\n        .author {\n            font-size: 16px;\n            color: #7f8c8d;\n        }\n        .link {\n            font-size: 16px;\n            color: #3498db;\n            text-decoration: none;\n        }\n        .content-section {\n            margin-bottom: 20px;\n        }\n        .content-section h3 {\n            font-size: 18px;\n            color: #2980b9;\n        }\n        .content-section ul {\n            list-style-type: none;\n            padding-left: 0;\n        }\n        .content-section ul li {\n            margin: 10px 0;\n            font-size: 16px;\n        }\n        .content-section ul li span {\n            font-weight: bold;\n        }\n    </style>\n</head>\n<body>\n{{ $('Gemini总结').item.json.text }}\n</body>\n</html>",
        "options": {
          "senderName": "小羊每日速递"
        }
      },
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.1,
      "position": [
        900,
        0
      ],
      "id": "8828694f-c944-4263-95c5-8973cda4ddee",
      "name": "发送邮件",
      "webhookId": "a18b6b36-f2ff-46a9-9bbe-0ddeb5c09e51",
      "credentials": {
        "gmailOAuth2": {
          "id": "9FgkTmyY6czIZeGO",
          "name": "Gmail account"
        }
      }
    }
  ],
  "pinData": {},
  "connections": {
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Gemini总结",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "提取有效内容": {
      "main": [
        [
          {
            "node": "Gemini总结",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "读取L站热门消息": {
      "main": [
        [
          {
            "node": "取前20条帖子",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "每天运行一次": {
      "main": [
        [
          {
            "node": "读取L站热门消息",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gemini总结": {
      "main": [
        [
          {
            "node": "发送邮件",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "取前20条帖子": {
      "main": [
        [
          {
            "node": "提取有效内容",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "d670de0c-16d8-482c-8b77-89716f5f66c7",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "273cb072730a54351e245b85466131b67e03b4084264c10b9a2f40e05554ac84"
  },
  "id": "PjUwXkwpkglJMXSY",
  "tags": []
}

若想推送每周热贴内容,同理,在rss read里稍作修改:改成period=weekly

AI使用免费的Gemini pro或Gemini flash均可,填入key即可使用

可随意推送到你觉得方便的地方,n8n还是十分强大的,而且不仅仅局限于L站热门消息,各大网站热门消息都可以,发挥创造力,期待大家的工作流

96 个赞

太强了吧!大佬!

30 个赞

能不能twitter

32 个赞

刚刚试了试grok bata模型,它完全处理不了这类任务 :tieba_087:(Gemini flash都能很好的处理,并保持输出一致性)

还得是Gemini 香

34 个赞


可以,简单配置一下就行

32 个赞

好的,有空再试。

31 个赞

感谢大佬分享,大佬分享下知识库之类的呗

34 个赞

知识库类推荐使用fastgpt或dify,B站有足够详细的教程,我就不卖弄了

34 个赞

大佬谦虚,:grin::grin:

33 个赞

感谢佬友分享tieba_024

32 个赞

我也对知识库感兴趣,用来用去还是用回dify

34 个赞

感谢分享!!!

28 个赞

感谢分享,有空试一下

7 个赞

小白问问 n8n能不能使用New API中转的模型,就是New API接入n8n,n8n使用New API的接口

4 个赞

当然可以的。

1 个赞

感谢,已经用上,之前尝试过dify,放弃了,n8n玩了一晚 感觉良好,刚好有台垃圾服务器,部署上n8n挺流畅

大佬,发送得那个邮箱是填权限那个邮箱吗,到最后一部走不通了

大佬,发送得那个邮箱是填权限那个邮箱吗,到最后一部走不通了。。

1 个赞

打开了n8n 页面登录了? 登录随便填一个有效邮箱就行了吧,会发个激活码,激活社区版。

可能是部署问题?我是自己Docker部署的,没有按照佬的教程,用gemini exp 1121,整理了一下我的部署步骤,需要的话可以参考一下:
飞书链接:https://e3jaiwhzbw.feishu.cn/docx/D5N3dmVa1oRvuzxjDdfcUSzOnZb?from=from_copylink 密码:36Y733@6

18 个赞

哦,你问的是这个工作流啊,我没有搞,就是借楼问问问题而已

4 个赞