8
n8n 中文网amn8n.com

使用 ScrapegraphAI 自动抓取新闻文章并存储到 Google Sheets

中级

这是一个Market Research, AI Summarization领域的自动化工作流,包含 8 个节点。主要使用 Code, GoogleSheets, ScheduleTrigger, ScrapegraphAi 等节点。 使用ScrapegraphAI自动抓取新闻文章并存储到Google Sheets

前置要求
  • Google Sheets API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "MIllJmbqayQrZM1F",
  "meta": {
    "instanceId": "521567c5f495f323b77849c4cfd0c9f4f2396c986e324e0e66c8425b6f124744",
    "templateCredsSetupCompleted": true
  },
  "name": "使用 ScrapegraphAI 自动抓取新闻文章并存储到 Google Sheets",
  "tags": [],
  "nodes": [
    {
      "id": "37df323b-5c75-495f-ba19-b8642c02d96f",
      "name": "自动化新闻收集触发器",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        700,
        820
      ],
      "parameters": {
        "rule": {
          "interval": [
            {}
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "efd61ca5-e248-4027-b705-6d9c5dabe820",
      "name": "AI 驱动的新闻文章抓取器",
      "type": "n8n-nodes-scrapegraphai.scrapegraphAi",
      "position": [
        1380,
        820
      ],
      "parameters": {
        "userPrompt": "Extract all the articles from this site. Use the following schema for response {   \"request_id\": \"5a9de102-8a43-4e89-8aae-397c9ca80a9b\",   \"status\": \"completed\",   \"website_url\": \"https://www.bbc.com/\",   \"user_prompt\": \"Extract all the articles from this site.\",   \"title\": \"'My friend died right in front of me' - Student describes moment air force jet crashed into school\",   \"url\": \"https://www.bbc.com/news/articles/cglzw8y5wy5o\",   \"category\": \"Asia\" }",
        "websiteUrl": "https://www.bbc.com/"
      },
      "credentials": {
        "scrapegraphAIApi": {
          "id": "",
          "name": ""
        }
      },
      "typeVersion": 1
    },
    {
      "id": "976d9123-7585-4700-9972-5b2838571a44",
      "name": "Google Sheets 新闻存储",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2980,
        820
      ],
      "parameters": {
        "columns": {
          "value": {},
          "schema": [
            {
              "id": "title",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "title",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "url",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "category",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "category",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "autoMapInputData",
          "matchingColumns": []
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": ""
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "",
          "name": ""
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "6d11ae64-e2f8-47ed-854a-c749881ce72c",
      "name": "新闻数据格式化与处理",
      "type": "n8n-nodes-base.code",
      "notes": "Hey this is where \nyou \nformat results ",
      "position": [
        2140,
        820
      ],
      "parameters": {
        "jsCode": "// Get the input data\nconst inputData = $input.all()[0].json;\n\n// Extract articles array\nconst articles = inputData.result.articles;\n\n// Map each article and return only title, url, category\nreturn articles.map(article => ({\n  json: {\n    title: article.title,\n    url: article.url,\n    category: article.category\n  }\n}));"
      },
      "notesInFlow": true,
      "typeVersion": 2
    },
    {
      "id": "ca78baaf-0480-490d-aa9a-3663ca93f5d0",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1180,
        460
      ],
      "parameters": {
        "color": 5,
        "width": 574.9363634768473,
        "height": 530.4701664623029,
        "content": "# 步骤 2:AI 驱动的新闻文章抓取器 🤖"
      },
      "typeVersion": 1
    },
    {
      "id": "51a1337b-6a50-43a5-8d6f-8345bc771c7b",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1920,
        460
      ],
      "parameters": {
        "color": 5,
        "width": 574.9363634768473,
        "height": 530.4701664623029,
        "content": "# 步骤 3:新闻数据格式化与处理 🧱"
      },
      "typeVersion": 1
    },
    {
      "id": "2e8cde8e-f534-4f37-a1f9-bcf0fe0b09f9",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        460,
        460
      ],
      "parameters": {
        "color": 5,
        "width": 574.9363634768473,
        "height": 530.4701664623029,
        "content": "# 步骤 1:自动化新闻收集触发器 ⏱️"
      },
      "typeVersion": 1
    },
    {
      "id": "5606537c-a531-490a-b4ff-6d0dc5e642b4",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2680,
        460
      ],
      "parameters": {
        "color": 5,
        "width": 574.9363634768473,
        "height": 530.4701664623029,
        "content": "# 步骤 4:Google Sheets 新闻存储 📊"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "c2fee060-f99e-48aa-a280-ac5492715fd9",
  "connections": {
    "AI-Powered News Article Scraper": {
      "main": [
        [
          {
            "node": "News Data Formatting and Processing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Automated News Collection Trigger": {
      "main": [
        [
          {
            "node": "AI-Powered News Article Scraper",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "News Data Formatting and Processing": {
      "main": [
        [
          {
            "node": "Google Sheets News Storage",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

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

需要付费吗?

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

工作流信息
难度等级
中级
节点数量8
分类2
节点类型5
难度说明

适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流

外部链接
在 n8n.io 查看

分享此工作流