8
n8n 中文网amn8n.com

🌳 欧盟绿色法规追踪器(GPT-4o、Google Sheets 和任务)

高级

这是一个Other, AI领域的自动化工作流,包含 17 个节点。主要使用 If, Set, Html, Merge, GoogleTasks 等节点,结合人工智能技术实现智能自动化。 🌳 使用 GPT-4o、Google Sheets 和任务功能的欧盟绿色法规追踪器

前置要求
  • 可能需要目标 API 的认证凭证
  • Google Sheets API 凭证
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "="
  },
  "nodes": [
    {
      "id": "4dfef9cb-d66a-4818-b5b2-6be81f0bd7c3",
      "name": "遍历项目",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        1160,
        500
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "3fd73086-62cc-49c4-9c56-b2467a27601c",
      "name": "合并",
      "type": "n8n-nodes-base.merge",
      "position": [
        1980,
        360
      ],
      "parameters": {
        "mode": "combineBySql"
      },
      "notesInFlow": true,
      "typeVersion": 3
    },
    {
      "id": "a894cc7b-7e2c-40af-bbdd-de03c9fdf71c",
      "name": "条件判断",
      "type": "n8n-nodes-base.if",
      "position": [
        2200,
        440
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "e3956615-6ad2-4df7-a15f-63f1f21d10fe",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.sustainability }}",
              "rightValue": "yes"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "b1b1616c-68f7-4911-b58d-8792ac4e822c",
      "name": "提取昨日记录",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        280,
        500
      ],
      "parameters": {
        "url": "=https://oeil.secure.europarl.europa.eu/oeil/en/search?sessionDay.allDays=false&sessionDay.day={{$now.minus(18,'days').format('yyyyMMdd')}}&sessionDay.type=ALL",
        "options": {}
      },
      "notesInFlow": true,
      "typeVersion": 4.2
    },
    {
      "id": "707ae04c-51d3-4547-9868-1c603d359cc0",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        0
      ],
      "parameters": {
        "color": 7,
        "width": 1080,
        "height": 660,
        "content": "### 1. 第一模块:抓取页面以提取昨日安排辩论的所有立法程序"
      },
      "typeVersion": 1
    },
    {
      "id": "721a14b6-c860-431e-8475-b877d5a83768",
      "name": "提取 HTML 区块",
      "type": "n8n-nodes-base.html",
      "position": [
        500,
        500
      ],
      "parameters": {
        "options": {},
        "operation": "extractHtmlContent",
        "extractionValues": {
          "values": [
            {
              "key": "Blocks",
              "cssSelector": ".erpl_document-wrapper",
              "returnArray": true,
              "returnValue": "html"
            }
          ]
        }
      },
      "notesInFlow": true,
      "typeVersion": 1.2
    },
    {
      "id": "fe609066-0f08-40b7-b8a8-13acd8338468",
      "name": "解析区块",
      "type": "n8n-nodes-base.html",
      "position": [
        720,
        500
      ],
      "parameters": {
        "options": {},
        "operation": "extractHtmlContent",
        "dataPropertyName": "Blocks",
        "extractionValues": {
          "values": [
            {
              "key": "Reference Number",
              "cssSelector": "h3 span.t-item"
            },
            {
              "key": "Committee",
              "cssSelector": "span.erpl_badge-committee"
            },
            {
              "key": "Rapporteur",
              "cssSelector": "span.erpl_document-subtitle-author"
            },
            {
              "key": "Title/Description",
              "cssSelector": "div.erpl_document-body p"
            },
            {
              "key": "PDF Link\t",
              "attribute": "href",
              "cssSelector": "a.erpl_document-subtitle-pdf",
              "returnValue": "attribute"
            },
            {
              "key": "Date",
              "cssSelector": "div.mt-1 p"
            }
          ]
        }
      },
      "notesInFlow": true,
      "typeVersion": 1.2
    },
    {
      "id": "75770b01-0c98-4077-97d7-3bbc82166372",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1100,
        0
      ],
      "parameters": {
        "color": 7,
        "width": 1020,
        "height": 660,
        "content": "### 2. 使用 LLM 仅保留与可持续性相关的程序"
      },
      "typeVersion": 1
    },
    {
      "id": "bfdc9844-7d9c-4582-83bb-9e945276864e",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2140,
        20
      ],
      "parameters": {
        "color": 7,
        "width": 500,
        "height": 660,
        "content": "### 3. 与可持续性相关的主题存储在 Google Sheet 中"
      },
      "typeVersion": 1
    },
    {
      "id": "38a6d477-0a95-4177-a5d4-10f4c97bcf0c",
      "name": "Google Tasks",
      "type": "n8n-nodes-base.googleTasks",
      "position": [
        2400,
        940
      ],
      "parameters": {
        "task": "MTIxODU0NDk4MzM3NzAxMTQ0NzY6MDow",
        "title": "=Study {{ $json['Reference Number'] }} - EU Legislation",
        "additionalFields": {
          "notes": "=Title: {{ $json['Title/Description'] }}\nReference Number: {{ $json['Reference Number'] }}\nCommittee: {{ $json.Committee }}\nRapporteur: {{ $json.Rapporteur }}\nPDF Link: {{ $json['PDF Link\t'] }}\nDate: {{ $json.Date }}",
          "status": "needsAction"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "9d27672c-2434-46d3-ae52-e0ba07b3a181",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2140,
        700
      ],
      "parameters": {
        "color": 7,
        "width": 500,
        "height": 440,
        "content": "### 4. 创建可持续性研究任务"
      },
      "typeVersion": 1
    },
    {
      "id": "8196fd1c-3223-402b-935b-a6a135795999",
      "name": "当点击“测试工作流”时",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        60,
        500
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "ff6f948b-9db4-479d-afab-3db6176abad6",
      "name": "分类代理",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        1380,
        280
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4-turbo",
          "cachedResultName": "GPT-4-TURBO"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "=Is the following legislative document related to sustainability? Answer \"yes\" or \"no\".\n\nTitle: {{ $json['Title/Description'] }}\nCommittee: {{ $json[\"Committee\"] }}\n\nBe strict: Only answer \"yes\" if the topic directly impacts environmental or climate sustainability, circular economy, resource conservation, or pollution reduction.\n"
            },
            {
              "role": "system",
              "content": "Sample output:\n{\"answer\": \"yes\"}\n"
            }
          ]
        },
        "jsonOutput": true
      },
      "typeVersion": 1.8
    },
    {
      "id": "01379394-a5e9-4673-bc0e-225e2d3f5214",
      "name": "收集答案",
      "type": "n8n-nodes-base.set",
      "position": [
        1760,
        280
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "19b1ea4c-3c78-4473-9f16-17d37b273735",
              "name": "sustainability",
              "type": "string",
              "value": "={{ $json.message.content.answer }}"
            }
          ]
        }
      },
      "notesInFlow": true,
      "typeVersion": 3.4
    },
    {
      "id": "8f96dfd0-0a38-435c-83a0-7649b350f813",
      "name": "记录可持续性程序",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2420,
        380
      ],
      "parameters": {
        "columns": {
          "value": {
            "Date": "={{ $json.Date }}",
            "PDF Link": "={{ $json['PDF Link\t'] }}",
            "Committee": "={{ $json.Committee }}",
            "Rapporteur": "={{ $json.Rapporteur }}",
            "Reference Number": "={{ $json['Reference Number'] }}",
            "Title/Description": "={{ $json['Title/Description'] }}"
          },
          "schema": [
            {
              "id": "Reference Number",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Reference Number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Committee",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Committee",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Rapporteur",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Rapporteur",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Title/Description",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Title/Description",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "PDF Link",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "PDF Link",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Date",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "=",
          "cachedResultName": "EU Legislative Procedure"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "=",
          "cachedResultUrl": "=",
          "cachedResultName": "Sustainability Content"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "rnPYZIig8l6seOd5",
          "name": "Google Sheets Temporary"
        }
      },
      "notesInFlow": true,
      "typeVersion": 4.5
    },
    {
      "id": "c2cf974e-f182-48f8-9d26-8aea4dbdf486",
      "name": "编辑链接",
      "type": "n8n-nodes-base.set",
      "position": [
        940,
        500
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "7a802593-2b9b-42fe-bd0c-66e11510834a",
              "name": "PDF Link\t",
              "type": "string",
              "value": "=https://oeil.secure.europarl.europa.eu{{ $json['PDF Link\t'] }}"
            }
          ]
        },
        "includeOtherFields": true
      },
      "notesInFlow": true,
      "typeVersion": 3.4
    },
    {
      "id": "bdc398f0-a882-4fbe-ac37-7ca7e15a1081",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2660,
        20
      ],
      "parameters": {
        "width": 460,
        "height": 340,
        "content": "![教程](https://www.samirsaci.com/content/images/2025/04/temp-9.png)"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "Record Sustainability Procedures",
            "type": "main",
            "index": 0
          },
          {
            "node": "Google Tasks",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Links": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Tasks": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Blocks": {
      "main": [
        [
          {
            "node": "Edit Links",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Collect Answer": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "Classification Agent",
            "type": "main",
            "index": 0
          },
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract HTML Blocks": {
      "main": [
        [
          {
            "node": "Parse Blocks",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Classification Agent": {
      "main": [
        [
          {
            "node": "Collect Answer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Yesterday Records": {
      "main": [
        [
          {
            "node": "Extract HTML Blocks",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Test workflow’": {
      "main": [
        [
          {
            "node": "Extract Yesterday Records",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 其他, 人工智能

需要付费吗?

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

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

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

作者
Samir Saci

Samir Saci

@samirsaci

Automation, AI and Analytics for Supply Chain & Business Optimization Helping businesses streamline operations using n8n, AI agents, and data science to enhance efficiency and sustainability. Linkedin: www.linkedin.com/in/samir-saci

外部链接
在 n8n.io 查看

分享此工作流