按关键词抓取文章
高级
这是一个Content Creation, Miscellaneous, Multimodal AI领域的自动化工作流,包含 16 个节点。主要使用 Code, GoogleDrive, HttpRequest, SplitInBatches, Agent 等节点。 使用Mistral AI和Google Drive从网络搜索生成SEO博客文章
前置要求
- •Google Drive API 凭证
- •可能需要目标 API 的认证凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "uAafXfQMgdewr4Nu",
"meta": {
"instanceId": "37315237609ef3dde64e7bd2340c634cfe54cfcb72be2bb432e6b054bb7562b5",
"templateCredsSetupCompleted": true
},
"name": "按关键词抓取文章",
"tags": [],
"nodes": [
{
"id": "9993cc2b-317f-45c2-9126-b98243be6c1c",
"name": "当收到聊天消息时",
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"position": [
-1280,
512
],
"webhookId": "7e2a56e1-dd08-4733-9f92-a78e9eb8ead2",
"parameters": {
"options": {}
},
"typeVersion": 1.1
},
{
"id": "c7f941f5-64a8-4f0e-9255-5221fc7480c5",
"name": "代码",
"type": "n8n-nodes-base.code",
"position": [
-928,
512
],
"parameters": {
"jsCode": "// Get the 'results' array from the HTTP Request Node output\nconst results = $json.results;\n\n// Extract the URLs from each result\nconst extractedUrls = results.map(result => ({\n url: result.url,\n title: result.title,\n // Optional: Include title if needed for context\n description: result.description,\n // Optional: Include description if needed\n}));\n\n// Return structured output\nreturn extractedUrls;\n"
},
"typeVersion": 2
},
{
"id": "59caec66-ca59-49d9-9f46-7d249d7ec09c",
"name": "遍历项目",
"type": "n8n-nodes-base.splitInBatches",
"position": [
-752,
512
],
"parameters": {
"options": {}
},
"typeVersion": 3
},
{
"id": "d3b8b486-22f5-4893-84b1-ce634844fb07",
"name": "从URL获取内容",
"type": "n8n-nodes-base.httpRequest",
"position": [
-560,
512
],
"parameters": {
"url": "={{ $json.url }}",
"options": {}
},
"typeVersion": 4.2
},
{
"id": "1ab856bb-c79b-4f3c-ba34-d95c1006f1de",
"name": "循环遍历项目1",
"type": "n8n-nodes-base.splitInBatches",
"position": [
-448,
128
],
"parameters": {
"options": {}
},
"typeVersion": 3
},
{
"id": "81bd2156-1d61-455b-935b-1de0d465c115",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1312,
464
],
"parameters": {
"width": 940,
"height": 280,
"content": "## 抓取前3篇文章"
},
"typeVersion": 1
},
{
"id": "0547bc88-a94f-41ae-b605-98974a9b4c02",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-528,
48
],
"parameters": {
"color": 6,
"width": 460,
"height": 380,
"content": "## 清理数据"
},
"typeVersion": 1
},
{
"id": "1fa72a0c-bff0-4133-9102-2b576ad312ea",
"name": "便签2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-32,
32
],
"parameters": {
"color": 4,
"width": 520,
"height": 600,
"content": "## 创建改进的文章"
},
"typeVersion": 1
},
{
"id": "3b1dd383-0ae2-4344-8001-e686f0996d82",
"name": "创建正文文本代码",
"type": "n8n-nodes-base.code",
"position": [
-256,
64
],
"parameters": {
"jsCode": "// Ensure we process multiple items from the input\nconst results = items.map(item => item.json.bodyText); // Collect `bodyText` from each iteration\n\n// Define a separator to distinguish pages\nconst separator = \"\\n\\n─── Page Break ───\\n\\n\";\n\n// Combine all body text into a single string\nconst combinedBodyText = results.join(separator);\n\n// Return the concatenated result\nreturn {\n combinedBodyText\n};\n"
},
"typeVersion": 2
},
{
"id": "bcff25e5-225a-4f67-a387-bf3c2e0bbdd9",
"name": "清理正文文本",
"type": "n8n-nodes-base.code",
"position": [
-256,
240
],
"parameters": {
"jsCode": "// Get the input HTML from json.data\nconst html = $json.data || \"\";\n\nif (!html) {\n throw new Error(\"No HTML content provided in json.data. Ensure the input contains valid HTML.\");\n}\n\n// Function to extract and clean content from specified tags\nfunction extractAndCleanContent(html, tag) {\n const regex = new RegExp(`<${tag}[^>]*>(.*?)<\\/${tag}>`, \"gis\");\n const matches = [...html.matchAll(regex)];\n\n // Remove nested HTML tags and return plain text\n return matches.map(match => match[1].replace(/<[^>]+>/g, \"\").trim());\n}\n\n// Extract and clean body text (from <p> and <span> tags)\nconst bodyText = [\n ...extractAndCleanContent(html, \"p\"),\n ...extractAndCleanContent(html, \"span\")\n];\n\n// Return the clean text as an array\nreturn {\n bodyText\n};"
},
"typeVersion": 2
},
{
"id": "2b38b897-9e59-41f2-84b1-a39927e3da39",
"name": "Google Drive",
"type": "n8n-nodes-base.googleDrive",
"position": [
368,
512
],
"parameters": {
"name": "=blog_post_({{ $now }})",
"content": "={{ $json.output }}",
"driveId": {
"__rl": true,
"mode": "list",
"value": "My Drive"
},
"options": {},
"folderId": {
"__rl": true,
"mode": "list",
"value": "1VWWC9wby04xopZAatnTu4YPywLjCRIj5",
"cachedResultUrl": "https://drive.google.com/drive/folders/1VWWC9wby04xopZAatnTu4YPywLjCRIj5",
"cachedResultName": "Seo content"
},
"operation": "createFromText"
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "lz1dw1l72HgkVylN",
"name": "Google Drive account"
}
},
"typeVersion": 3
},
{
"id": "7ea2cf25-e8bc-4cce-9a0b-cba5bdca60df",
"name": "数据提取器和摘要生成器1",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
80,
80
],
"parameters": {
"text": "=**Role**: A precise data extractor and summarizer.\n\n**Instructions**: Analyze the body text provided from three scraped web pages and produce a structured, detailed summary of key information contained within. Focus on identifying unique, relevant, and actionable insights that align with the goal of informing a high-quality blog post.\n\n**Steps**:\n1. **Input Analysis**: Examine the combined body text input from the three web pages provided: '{{ $json.combinedBodyText }}'.\n2. **Topic Identification**: Determine the overarching themes or topics discussed in the combined text.\n3. **Content Extractions**: Extract key details such as:\n - Major points or arguments.\n - Supporting facts, statistics, or evidence.\n - Unique insights or perspectives.\n4. **Organized Summary**: Structure the information in a format that is easy to use for a blog writer. Use sections like:\n -Introduction/Overview.\n -Key Insights/Findings (list format).\n -Supporting Evidence/Examples.\n -Implications or Potential Applications.\n5. **Clarity and Relevance**: Ensure the summary is concise, devoid of unnecessary repetition, and directly relevant to producing a blog post. \n\n**End Goal**: To generate a coherent and detailed summary that contains all the critical information from the input text. This summary will serve as the foundational content for the subsequent blog-writing step.\n\n**Narrowing**: Emphasize extracting content that provides depth and value for readers, such as unique data points, expert opinions, or practical applications. Avoid duplicating generic information, and instead highlight specifics unique to the combined web pages. \n\nExample Output Structure:\n\n''\n**Overview**\n[Brief description of the overall topic(s) covered in the three web pages.]\n\n**Key Insights/Findings**\n- [Insight 1]\n- [Insight 2]\n- [Insight 3]\n\n**Supporting Evidence/Examples**\n1. [Fact or example from Page 1]\n2. [Fact or example from Page 2]\n3. [Fact or example from Page 3]\n\n**Implications or Applications**\n[Analysis of how the information could be applied or its broader implications.]\n''",
"options": {},
"promptType": "define"
},
"typeVersion": 2.2
},
{
"id": "c7c11922-eb61-4d3d-afa4-9b78bd3f99df",
"name": "SEO内容1",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
80,
304
],
"parameters": {
"text": "=Role:\n\"You are an experienced SEO Content Writer with expertise in crafting high-quality, search engine-optimized articles. You are skilled at analyzing competitive content and creating superior versions that outshine the existing top results.\"\n\nInstructions:\n\"You’ll receive a summary: {{ $json.message.content }} that contains the key content extracted from the top-ranking SERP results for the given topic. This factual information represents what is already performing well in search engine results. Your task is to take this content, analyze it, and craft a blog article that is not only engaging and informative but also outperforms these competitors in terms of value, depth, and user experience.\"\n\nSteps:\n\nContent Analysis:\nReview the summary thoroughly, which contains the best information from top-ranking pages. Identify areas where the existing content can be improved in terms of depth, clarity, and value. Take note of any gaps or overlooked points in the competitor's content that you can address.\n\nStructuring the Article:\nOrganize the content into a well-structured format, with a clear introduction, engaging body, and a strong conclusion. Ensure each section is optimized for readability, with logical flow and appropriate use of headers (H1, H2, H3) for easy navigation. \nBreak down complex information into digestible chunks, using short paragraphs, bullet points and numbered lists where appropriate.\n\nEnhancing Readability:\nWrite in a conversational, easy-to-understand tone while maintaining professionalism and authority. Use transition words and varied sentence lengths to keep the reader engaged. Avoid jargon or overly complex terms unless they add value, and provide definitions or explanations for technical terms.\n\nSEO Optimization:\nIntegrate relevant primary and secondary keywords naturally throughout the article to improve rankings.\nEnsure keyword usage is contextually relevant and does not disrupt the natural flow of the content.\nOptimize for on-page SEO by incorporating internal links, external authoritative references, and a compelling meta description.\n\nAdding Unique Value:\nProvide actionable insights, real-world examples, or tips that add unique value to the reader, going beyond what is offered in the current top-ranking content.\nInclude data, case studies, or expert quotes to support your points and further differentiate your article from competitors. Where applicable, add multimedia (images, graphs, charts) to enhance comprehension and engagement.\n\nFinal Review:\nDouble-check the article for grammar, spelling, and consistency. Make sure all content is fact-checked and up-to-date with the most relevant, accurate information.\nReview the tone and readability to ensure it appeals to the target audience, balancing SEO needs with user engagement. \n\nEnd Goal:\n\"Your ultimate goal is to create a superior, SEO-optimized blog article that not only outranks the current top competitors but also provides more value, engages the reader, and is easily digestible. The content should be authoritative, well-researched, and designed to convert visitors into loyal readers or customers.\"\n\nNarrowing:\n\"Focus strictly on factual information from the top-ranking pages, improving and expanding upon it. Avoid including off-topic or unrelated content. Stay aligned with the search intent of the target audience, which is to find actionable, in-depth, and reliable information on the topic. Do not overstuff keywords: ensure the writing flows naturally and is reader-focused.\" ",
"options": {},
"promptType": "define"
},
"typeVersion": 2.2
},
{
"id": "d2588e5f-98f3-4524-a6b0-7fe4e7e121fa",
"name": "优化内容1",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
80,
512
],
"parameters": {
"text": "=Role:\n\"You are a skilled human-like writing assistant, tasked with transforming blog content into highly engaging, empathetic, and conversational writing without altering its factual or structural integrity.\"\n\nInstructions:\n\"You'll receive content from the Blog Writer agent node:{{ $json.message.content }}. Your goal is to refine the tone, style, and flow of this content to make it feel more human, approachable, and relatable while adhering to these guidelines:\n\nCore Guidelines\nPreserve Factual Accuracy and Structure:\nMaintain the original facts, structure, and organization of the content. Focus solely on tone and language adjustments.\n\nHumanized Word Choice:\nRewrite the text with a more conversational and engaging tone. Use natural, reader-friendly language while maintaining clarity and professionalism. Avoid overly complex words or jargon, and make it feel like a friendly conversation rather than a formal essay. Where appropriate, add warmth, storytelling, and relatable examples to keep the reader engaged. Vary paragraph lengths to maintain reader interest.\n\nValue-Driven Content:\nEliminate fluff. Every sentence should contribute meaningful information, insight, or emotional connection.\n\nStylistic Improvements:\nUse active voice wherever possible. Avoid clichés, repetitive phrases, and awkward transitions.\nAdd relatable examples or brief anecdotes where appropriate, enhancing the reader's emotional connection to the content.\nProhibited Language\nLimit Words: Avoid using the words \"unique,\" \"ensure,\" and \"utmost\" more than three times.\n\nForbidden Words: Avoid these entirely:\n\"meticulous,\" \"complexities,\" \"bespoke,\" \"tailored,\" \"underpins,\" \"amongst,\" \"the secrets,” “unveil the secrets,” “robust,” and similar overused or corporate terms.\nAvoid passive voice constructions. Always aim\nfor clarity and engagement.\n\nExamples of Transformation:\nBefore: “This tool can improve your workflow.”\nAfter: “Picture yourself gliding through your tasks with ease, thanks to a tool that takes the heavy lifting off your plate.”\n\nBefore: “It is advisable to review all options before making a decision.”\nAfter: “Take a moment to consider your choices—what works best for you?”\n\nEnd Goal:\n“Produce content that feels natural, engaging, and human while staying aligned with the original structure and facts. Aim to captivate readers, keep their attention, and foster a genuine connection. Always prioritize readability, relatability, and emotional resonance.”",
"options": {},
"promptType": "define"
},
"typeVersion": 2.2
},
{
"id": "6994702b-1fb6-4880-924c-9f68c97f638e",
"name": "Ollama聊天模型",
"type": "@n8n/n8n-nodes-langchain.lmChatOllama",
"position": [
736,
256
],
"parameters": {
"model": "mistral:7b",
"options": {}
},
"credentials": {
"ollamaApi": {
"id": "GnkkBpnB97t7l5kM",
"name": "Ollama account"
}
},
"typeVersion": 1
},
{
"id": "9979b2bc-f4cf-4568-89a2-7cddd79d5563",
"name": "Google搜索 (rapid api)",
"type": "n8n-nodes-base.httpRequest",
"position": [
-1088,
512
],
"parameters": {
"url": "https://google-search74.p.rapidapi.com/?",
"options": {},
"sendQuery": true,
"sendHeaders": true,
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"queryParameters": {
"parameters": [
{
"name": "query",
"value": "={{ $json.chatInput }}"
},
{
"name": "limit",
"value": "3"
}
]
},
"headerParameters": {
"parameters": [
{
"name": "x-rapidapi-host",
"value": "google-search74.p.rapidapi.com"
}
]
}
},
"credentials": {
"httpHeaderAuth": {
"id": "Th8ZMqNa3sRgPCmK",
"name": "Header Auth account"
}
},
"typeVersion": 4.2
}
],
"active": true,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "ae0ba9f8-b8cf-4f9e-a0fc-811a8eb8d49e",
"connections": {
"Code": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"Seo Content1": {
"main": [
[
{
"node": "Refine Content1",
"type": "main",
"index": 0
}
]
]
},
"Clean body text": {
"main": [
[
{
"node": "Loop Over Items1",
"type": "main",
"index": 0
}
]
]
},
"Loop Over Items": {
"main": [
[
{
"node": "Loop Over Items1",
"type": "main",
"index": 0
}
],
[
{
"node": "Get content from URL",
"type": "main",
"index": 0
}
]
]
},
"Refine Content1": {
"main": [
[
{
"node": "Google Drive",
"type": "main",
"index": 0
}
]
]
},
"Loop Over Items1": {
"main": [
[
{
"node": "Create Body Text Code",
"type": "main",
"index": 0
}
],
[
{
"node": "Clean body text",
"type": "main",
"index": 0
}
]
]
},
"Ollama Chat Model": {
"ai_languageModel": [
[
{
"node": "Data extractor and summarizer1",
"type": "ai_languageModel",
"index": 0
},
{
"node": "Seo Content1",
"type": "ai_languageModel",
"index": 0
},
{
"node": "Refine Content1",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Get content from URL": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"Create Body Text Code": {
"main": [
[
{
"node": "Data extractor and summarizer1",
"type": "main",
"index": 0
}
]
]
},
"Google Search (rapid api)": {
"main": [
[
{
"node": "Code",
"type": "main",
"index": 0
}
]
]
},
"When chat message received": {
"main": [
[
{
"node": "Google Search (rapid api)",
"type": "main",
"index": 0
}
]
]
},
"Data extractor and summarizer1": {
"main": [
[
{
"node": "Seo Content1",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - 内容创作, 杂项, 多模态 AI
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
YouTube视频转博客
使用Mistral AI和Gemini图像生成从YouTube视频创建博客文章
Set
Code
Merge
+14
56 节点Zakwan
内容创作
使用Replicate和OpenAI制作无面孔恐怖短片
通过OpenAI TTS、Replicate视频生成和YouTube上传制作无面孔恐怖短片
If
Code
Wait
+13
50 节点Deb Mukherjee
内容创作
✨🩷自动化社交媒体内容发布工厂 + 系统提示组合
基于动态系统提示和GPT-4o的AI驱动多平台社交媒体内容工厂
If
Set
Code
+20
100 节点Amit Mehta
内容创作
💥 使用NanoBanana、Seedream 4、ChatGPT Image和Veo 3自动化视频广告 - VIDE
使用AI(NanoBanana、Seedream、GPT-4o、Veo 3)自动化和发布视频广告活动
Set
Code
Wait
+16
63 节点Dr. Firas
内容创作
使用OpenAI、RunwayML和ElevenLabs自动化无脸短视频
使用OpenAI、RunwayML和ElevenLabs自动化无脸短视频:从脚本到社交媒体
Set
Code
Wait
+18
56 节点LeeWei
内容创作
PDF 转订单
使用AI将PDF采购订单自动化转换为Adobe Commerce销售订单
If
Set
Code
+19
96 节点JKingma
文档提取