8
n8n 中文网amn8n.com

新闻自动收集器 → Google表格

高级

这是一个AI Summarization, Multimodal AI领域的自动化工作流,包含 19 个节点。主要使用 If, Set, Code, Merge, HttpRequest 等节点。 使用NewsAPI、OpenAI和Google表格收集并总结多语言新闻

前置要求
  • 可能需要目标 API 的认证凭证
  • Google Sheets API 凭证
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "5NjNI3YAZnLdY5c7",
  "meta": {
    "instanceId": "ad59d09d8e026d0e92690243618d86d51b0293b236148394ca356eae1d1ea59b"
  },
  "name": "新闻自动收集器 → Google Sheets",
  "tags": [],
  "nodes": [
    {
      "id": "9aaf1c30-f25e-4a12-9de8-5fd8b129e707",
      "name": "计划触发器",
      "type": "n8n-nodes-base.scheduleTrigger",
      "notes": "Runs daily at 13:00. Change schedule here if needed.",
      "position": [
        -560,
        144
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 13
            }
          ]
        }
      },
      "notesInFlow": true,
      "typeVersion": 1.2
    },
    {
      "id": "ed496364-3115-46b2-9ef4-b90761a133c3",
      "name": "从表格获取行",
      "type": "n8n-nodes-base.googleSheets",
      "notes": "Read keywords from your Google Sheet.\nRequired columns: Keyword, SearchRequired (values: Yes / No).",
      "position": [
        -336,
        144
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_INPUT_SHEET_NAME_OR_GID"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_SHEET_ID_HERE"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "1rA9hHryjFoOeyM0",
          "name": "Google Sheets account"
        }
      },
      "notesInFlow": true,
      "typeVersion": 4.7
    },
    {
      "id": "ab48f5cb-6d00-4129-b4e6-cb62202b4a68",
      "name": "如果需要搜索",
      "type": "n8n-nodes-base.if",
      "notes": "Continue only if SearchRequired === Yes.",
      "position": [
        -112,
        144
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "combinator": "and",
          "conditions": [
            {
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json['SearchRequired'] }}",
              "rightValue": "Yes"
            }
          ]
        }
      },
      "notesInFlow": true,
      "typeVersion": 2.2
    },
    {
      "id": "22d44aea-7fee-4341-9b8c-de5434735c1a",
      "name": "HTTP 请求(英文)",
      "type": "n8n-nodes-base.httpRequest",
      "notes": "NewsAPI call (English). Insert your own NewsAPI key in query param `apiKey`.",
      "position": [
        112,
        48
      ],
      "parameters": {
        "url": "=https://newsapi.org/v2/everything",
        "options": {},
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "q",
              "value": "={{ $json['Keyword'] }}"
            },
            {
              "name": "language",
              "value": "en"
            },
            {
              "name": "pageSize",
              "value": "5"
            },
            {
              "name": "apiKey",
              "value": "YOUR_API_KEY_HERE"
            }
          ]
        }
      },
      "notesInFlow": true,
      "typeVersion": 4.2
    },
    {
      "id": "68ae47ba-bb06-4fac-b6b8-ce1fec4297a6",
      "name": "HTTP 请求(日文)",
      "type": "n8n-nodes-base.httpRequest",
      "notes": "NewsAPI call (Japanese sources). Insert your own NewsAPI key in query param `apiKey`.",
      "position": [
        112,
        240
      ],
      "parameters": {
        "url": "=https://newsapi.org/v2/everything",
        "options": {},
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "q",
              "value": "={{ $json['Keyword'] }}"
            },
            {
              "name": "domains",
              "value": "nhk.or.jp,asahi.com,nikkei.com,news.yahoo.co.jp,itmedia.co.jp,impress.co.jp,ascii.jp,prtimes.jp"
            },
            {
              "name": "sortBy",
              "value": "publishedAt"
            },
            {
              "name": "pageSize",
              "value": "5"
            },
            {
              "name": "apiKey",
              "value": "YOUR_API_KEY_HERE"
            }
          ]
        }
      },
      "notesInFlow": true,
      "typeVersion": 4.2
    },
    {
      "id": "b68aa0df-1b9f-407c-941e-421039031439",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        0
      ],
      "parameters": {
        "height": 300,
        "content": "## 收集英文和日文新闻文章"
      },
      "typeVersion": 1
    },
    {
      "id": "e3fc1ce3-da2d-4555-bffd-cf1010b815d5",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -640,
        32
      ],
      "parameters": {
        "height": 240,
        "content": "## 每天 13:00 运行(在计划触发器中修改)"
      },
      "typeVersion": 1
    },
    {
      "id": "a17355f0-963d-497e-b4a5-99bb8ef9639d",
      "name": "合并文章",
      "type": "n8n-nodes-base.merge",
      "notes": "Merge both article streams before summarization.",
      "position": [
        704,
        160
      ],
      "parameters": {},
      "notesInFlow": true,
      "typeVersion": 3.2
    },
    {
      "id": "92fe30b8-4d8b-4386-9dba-9d76d9415087",
      "name": "使用 OpenAI 进行摘要",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "notes": "Connect your own OpenAI credentials. Charges apply to your account.",
      "position": [
        912,
        144
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "You are an editor summarizing news articles into concise Japanese sentences (~50 characters). No opinions, no emojis."
            },
            {
              "content": "=Summarize the following article (~50 characters in Japanese).\nTitle: {{$json[\"title\"]}}\nContent: {{$json[\"description\"] || $json[\"content\"] || \"No content\"}}"
            }
          ]
        }
      },
      "credentials": {
        "openAiApi": {
          "id": "xWUO0jq5mcmikNzw",
          "name": "OpenAi account"
        }
      },
      "notesInFlow": true,
      "typeVersion": 1.8
    },
    {
      "id": "0b666902-6e4d-4f46-b520-33e1c88ad933",
      "name": "将行追加到表格",
      "type": "n8n-nodes-base.googleSheets",
      "notes": "Append summarized results to your Google Sheet. Set Spreadsheet ID and output sheet name.",
      "position": [
        1488,
        144
      ],
      "parameters": {
        "columns": {
          "value": {
            "URL": "={{ $('Merge Articles').item.json.url }}",
            "Date": "={{ $('HTTP Request (EN)').item.json.articles[0].publishedAt }}",
            "Keyword": "={{ $('Get rows from sheet').item.json['Keyword'] }}",
            "Summary": "={{ $json.summary }}"
          },
          "mappingMode": "defineBelow"
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_OUTPUT_SHEET_NAME_OR_GID"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_SHEET_ID_HERE"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "1rA9hHryjFoOeyM0",
          "name": "Google Sheets account"
        }
      },
      "notesInFlow": true,
      "typeVersion": 4.7
    },
    {
      "id": "f400b87f-1cfb-4a15-9631-89d585375c3c",
      "name": "拆分文章(英文)",
      "type": "n8n-nodes-base.code",
      "position": [
        336,
        48
      ],
      "parameters": {
        "jsCode": "// Flatten articles array so that 1 item = 1 article\nconst arr = $json.articles ?? [];\nreturn arr.map(a => ({ json: a }));"
      },
      "typeVersion": 2
    },
    {
      "id": "921fc188-9097-48e0-b4fb-c4f2cd6bd7b6",
      "name": "拆分文章(日文)",
      "type": "n8n-nodes-base.code",
      "position": [
        336,
        240
      ],
      "parameters": {
        "jsCode": "// Flatten articles array so that 1 item = 1 article\nconst arr = $json.articles ?? [];\nreturn arr.map(a => ({ json: a }));"
      },
      "typeVersion": 2
    },
    {
      "id": "d2b09870-fe3e-4804-bc50-12b633fc55f9",
      "name": "准备字段",
      "type": "n8n-nodes-base.set",
      "notes": "Prepare fields (Date, Keyword, Summary, URL) for appending to Google Sheets.",
      "position": [
        1264,
        144
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "name": "summary",
              "type": "string",
              "value": "={{$json[\"message\"]?.[\"content\"]}}"
            },
            {
              "name": "link",
              "type": "string",
              "value": "={{$node[\"Merge Articles\"].json[\"url\"]}}"
            }
          ]
        },
        "includeOtherFields": true
      },
      "notesInFlow": true,
      "typeVersion": 3.4
    },
    {
      "id": "ee847bc9-1489-405a-86f6-7616cbd0b31c",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        336,
        0
      ],
      "parameters": {
        "height": 240,
        "content": "## 1 个项目 = 1 篇文章"
      },
      "typeVersion": 1
    },
    {
      "id": "c906f8fa-043f-48f8-881b-36a8f5dde4b0",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -752,
        336
      ],
      "parameters": {
        "height": 200,
        "content": "## 设置您自己的 Google 表格(输入电子表格 ID 和表格名称)"
      },
      "typeVersion": 1
    },
    {
      "id": "3155f915-3ccb-43c4-995b-fb46e49ba915",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -384,
        336
      ],
      "parameters": {
        "width": 192,
        "height": 208,
        "content": "使用以下结构准备您自己的 Google 电子表格:"
      },
      "typeVersion": 1
    },
    {
      "id": "7cba26a3-70b4-429d-a164-b89f2d66c0a6",
      "name": "便签5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -16,
        400
      ],
      "parameters": {
        "content": "## 在此处插入您的 NewsAPI 密钥"
      },
      "typeVersion": 1
    },
    {
      "id": "d3b0b79b-0387-4e5a-81d1-964342358d9a",
      "name": "便签6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        896,
        368
      ],
      "parameters": {
        "width": 272,
        "height": 176,
        "content": "## 在此处连接您自己的 OpenAI 账户(如果不需要,可停用此节点)"
      },
      "typeVersion": 1
    },
    {
      "id": "340bc3d3-c75f-4f60-bbf1-bdde0a0f5722",
      "name": "便签7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1424,
        352
      ],
      "parameters": {
        "width": 272,
        "content": "## 输出表格必须包含列:日期、关键词、摘要、URL(初始为空)"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "7e465735-af5e-4ee3-acf1-8e61d9418420",
  "connections": {
    "Merge Articles": {
      "main": [
        [
          {
            "node": "Summarize with OpenAI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare fields": {
      "main": [
        [
          {
            "node": "Append rows to sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Get rows from sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request (EN)": {
      "main": [
        [
          {
            "node": "Split Articles (EN)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request (JP)": {
      "main": [
        [
          {
            "node": "Split Articles (JP)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If Search Required": {
      "main": [
        [
          {
            "node": "HTTP Request (EN)",
            "type": "main",
            "index": 0
          },
          {
            "node": "HTTP Request (JP)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get rows from sheet": {
      "main": [
        [
          {
            "node": "If Search Required",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Articles (EN)": {
      "main": [
        [
          {
            "node": "Merge Articles",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Articles (JP)": {
      "main": [
        [
          {
            "node": "Merge Articles",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Summarize with OpenAI": {
      "main": [
        [
          {
            "node": "Prepare fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

高级 - AI 摘要总结, 多模态 AI

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
高级
节点数量19
分类2
节点类型9
难度说明

适合高级用户,包含 16+ 个节点的复杂工作流

外部链接
在 n8n.io 查看

分享此工作流