8
n8n 中文网amn8n.com

从HackerNews提取结构化数据,使用Google Gemini导出到Google Docs

高级

这是一个Market Research, AI Summarization领域的自动化工作流,包含 16 个节点。主要使用 Set, GoogleDocs, HackerNews, HttpRequest, ManualTrigger 等节点。 使用Gemini 2.0 Flash提取和转换HackerNews数据到Google Docs

前置要求
  • 可能需要目标 API 的认证凭证
  • Google Gemini API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "qgOiQsPSKD08eiB3",
  "meta": {
    "instanceId": "885b4fb4a6a9c2cb5621429a7b972df0d05bb724c20ac7dac7171b62f1c7ef40",
    "templateCredsSetupCompleted": true
  },
  "name": "从 HackerNews 提取结构化数据,使用 Google Gemini 导出到 Google Docs",
  "tags": [
    {
      "id": "Kujft2FOjmOVQAmJ",
      "name": "Engineering",
      "createdAt": "2025-04-09T01:31:00.558Z",
      "updatedAt": "2025-04-09T01:31:00.558Z"
    },
    {
      "id": "ZOwtAMLepQaGW76t",
      "name": "Building Blocks",
      "createdAt": "2025-04-13T15:23:40.462Z",
      "updatedAt": "2025-04-13T15:23:40.462Z"
    },
    {
      "id": "ddPkw7Hg5dZhQu2w",
      "name": "AI",
      "createdAt": "2025-04-13T05:38:08.053Z",
      "updatedAt": "2025-04-13T05:38:08.053Z"
    }
  ],
  "nodes": [
    {
      "id": "2f6e390d-47d2-46c0-b032-00e1541a8def",
      "name": "当点击\"执行工作流\"时",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -380,
        0
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "da17296e-a0b0-423f-8f6a-6636f77ff79e",
      "name": "Hacker News",
      "type": "n8n-nodes-base.hackerNews",
      "position": [
        60,
        0
      ],
      "parameters": {
        "limit": "={{ $json.Count }}",
        "resource": "all",
        "additionalFields": {}
      },
      "typeVersion": 1
    },
    {
      "id": "8481d533-2ef1-4e97-afe1-8f182d17b390",
      "name": "遍历项目",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        280,
        0
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "5d88db37-0e3b-4900-af10-78a4f7152231",
      "name": "Google Gemini聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        940,
        240
      ],
      "parameters": {
        "options": {},
        "modelName": "models/gemini-2.0-flash-exp"
      },
      "credentials": {
        "googlePalmApi": {
          "id": "YeO7dHZnuGBVQKVZ",
          "name": "Google Gemini(PaLM) Api account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "0fcf5b56-87f8-4dca-9478-7f0753c195e7",
      "name": "创建 Google 文档",
      "type": "n8n-nodes-base.googleDocs",
      "position": [
        1320,
        20
      ],
      "parameters": {
        "title": "={{ $('Set the url, author').item.json.author }}-HackerNews",
        "folderId": "default"
      },
      "credentials": {
        "googleDocsOAuth2Api": {
          "id": "39XPsztp1DX0svZQ",
          "name": "Google Docs account"
        }
      },
      "executeOnce": false,
      "retryOnFail": true,
      "typeVersion": 2,
      "alwaysOutputData": false
    },
    {
      "id": "2855e7e7-ea99-4acc-901a-54bffa7b3113",
      "name": "更新 Google 文档",
      "type": "n8n-nodes-base.googleDocs",
      "position": [
        1500,
        20
      ],
      "parameters": {
        "actionsUi": {
          "actionFields": [
            {
              "text": "={{ $('Extract Human Readable Data').item.json.text }}",
              "action": "insert"
            }
          ]
        },
        "operation": "update",
        "documentURL": "={{ $json.id }}"
      },
      "credentials": {
        "googleDocsOAuth2Api": {
          "id": "39XPsztp1DX0svZQ",
          "name": "Google Docs account"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "ef59d4a1-4176-4702-996d-5a710b432b4b",
      "name": "设置输入字段",
      "type": "n8n-nodes-base.set",
      "position": [
        -160,
        0
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "52ddafbb-536f-45d6-9697-7ddf5b9b3869",
              "name": "Count",
              "type": "string",
              "value": "5"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "aa74a371-94cf-4a0b-93d9-fd503f1abbed",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        200,
        -320
      ],
      "parameters": {
        "content": "## 步骤 1"
      },
      "typeVersion": 1
    },
    {
      "id": "79674295-f331-4e5b-81d4-09d45aedb883",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        460,
        -320
      ],
      "parameters": {
        "content": "## 步骤 2"
      },
      "typeVersion": 1
    },
    {
      "id": "80ed14eb-6ead-46d8-81d0-5502cb5f44db",
      "name": "提取可读数据",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        980,
        20
      ],
      "parameters": {
        "text": "=Extract a human readable content. \n\nHere's the context :\n\n{{ $json.data }}",
        "batching": {},
        "promptType": "define"
      },
      "retryOnFail": true,
      "typeVersion": 1.7
    },
    {
      "id": "d922ad6e-0959-465f-810f-3f0e8d8a3626",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -360,
        -400
      ],
      "parameters": {
        "color": 6,
        "width": 540,
        "height": 240,
        "content": "## 从 Hacker News 提取结构化数据,使用 Google Gemini 导出到 Google 文档"
      },
      "typeVersion": 1
    },
    {
      "id": "79f3eca6-df7d-4e72-816e-b17452f476b5",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        720,
        -320
      ],
      "parameters": {
        "content": "## 步骤 3"
      },
      "typeVersion": 1
    },
    {
      "id": "b3cfee88-735c-4474-b7c0-75511d44e26c",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        200,
        -140
      ],
      "parameters": {
        "color": 5,
        "width": 1060,
        "height": 520,
        "content": "## Hacker News 数据提取"
      },
      "typeVersion": 1
    },
    {
      "id": "36302c89-82a4-4098-9ca6-7822bb4d6c33",
      "name": "便签 5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -360,
        -140
      ],
      "parameters": {
        "color": 3,
        "width": 540,
        "height": 120,
        "content": "## LLM 使用"
      },
      "typeVersion": 1
    },
    {
      "id": "80c3a993-6c82-43c9-9612-e20e989012ef",
      "name": "设置 URL,作者",
      "type": "n8n-nodes-base.set",
      "position": [
        500,
        20
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "267f21f5-d483-4e74-9773-b1d8a02dd984",
              "name": "author",
              "type": "string",
              "value": "={{ $json.author }}"
            },
            {
              "id": "667a3ffb-a07c-4f66-b253-a7c64b2aa8e0",
              "name": "url",
              "type": "string",
              "value": "={{ $json._highlightResult.url.value }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "ad6eb942-17a1-48af-9d41-f728c9127106",
      "name": "创建 HTTP 请求",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        720,
        20
      ],
      "parameters": {
        "url": "={{ $json.url }}",
        "options": {}
      },
      "retryOnFail": true,
      "typeVersion": 4.2,
      "alwaysOutputData": true
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "640bfa35-72c3-4d4d-8e38-a98fee2248e9",
  "connections": {
    "Hacker News": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "Set the url, author",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Google Docs": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create a Google Doc": {
      "main": [
        [
          {
            "node": "Update Google Docs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set the url, author": {
      "main": [
        [
          {
            "node": "Create an HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set the Input Fields": {
      "main": [
        [
          {
            "node": "Hacker News",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create an HTTP Request": {
      "main": [
        [
          {
            "node": "Extract Human Readable Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Extract Human Readable Data",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Extract Human Readable Data": {
      "main": [
        [
          {
            "node": "Create a Google Doc",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "Set the Input Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 市场调研, AI 摘要总结

需要付费吗?

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

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

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

作者
Ranjan Dailata

Ranjan Dailata

@ranjancse

A Professional based out of India specialized in handling AI-powered automations. Contact me at ranjancse@gmail.com

外部链接
在 n8n.io 查看

分享此工作流