8
n8n 中文网amn8n.com

提取PDF的模板

高级

这是一个Document Extraction, AI Summarization领域的自动化工作流,包含 24 个节点。主要使用 Set, Code, Html, Merge, Discord 等节点。 用于Google Sheets跟踪的Llama AI模型

前置要求
  • Discord Bot Token 或 Webhook
  • 可能需要目标 API 的认证凭证
  • Google Sheets API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "7W7d0YwVNAq2e1ia",
  "meta": {
    "instanceId": "3cc1878486c4b89b99f849786349de8096d559c2a7d28662583b888d19dabd2f"
  },
  "name": "提取 PDF 的模板",
  "tags": [],
  "nodes": [
    {
      "id": "e8790514-92e0-4f1f-bf17-94833512d86e",
      "name": "当点击“执行工作流”时",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -400,
        -96
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "8dea3c26-0cb2-4607-8135-d45963200c6a",
      "name": "HTTP 请求",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -192,
        -240
      ],
      "parameters": {
        "url": "PUT THE URL OF THE WEBSITE YOU WANT TO EXTRACT PDFS FROM",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "aacd88bc-e89b-47fc-af70-7c85f5e6c4f8",
      "name": "HTML",
      "type": "n8n-nodes-base.html",
      "position": [
        -48,
        -96
      ],
      "parameters": {
        "options": {},
        "operation": "extractHtmlContent",
        "extractionValues": {
          "values": [
            {
              "key": "pdf",
              "attribute": "href",
              "cssSelector": "a[href$=\".pdf\"]",
              "returnArray": true,
              "returnValue": "attribute"
            },
            {
              "key": "tittle",
              "cssSelector": "a[href$=\".pdf\"]",
              "returnArray": true
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "963ff0ab-af77-4e66-8339-11b7d105c318",
      "name": "代码",
      "type": "n8n-nodes-base.code",
      "notes": "Lista los pdfs",
      "position": [
        96,
        -96
      ],
      "parameters": {
        "jsCode": "const baseUrl = \"https://www.playway.com\";\n\nreturn $input.first().json.pdf.map(link => {\n  return {\n    json: {\n      url: `${baseUrl}${link}`\n    }\n  };\n});"
      },
      "notesInFlow": true,
      "typeVersion": 2
    },
    {
      "id": "e305771c-6ad1-43ea-a8c1-61ba61be5df7",
      "name": "HTTP 请求1",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueErrorOutput",
      "position": [
        -416,
        208
      ],
      "parameters": {
        "url": "={{ $json.url }}",
        "options": {
          "response": {
            "response": {
              "neverError": true,
              "responseFormat": "file"
            }
          }
        }
      },
      "retryOnFail": true,
      "typeVersion": 4.2
    },
    {
      "id": "1306f74c-cf7a-4f4b-897a-abc15281eac2",
      "name": "从文件提取",
      "type": "n8n-nodes-base.extractFromFile",
      "onError": "continueRegularOutput",
      "position": [
        -176,
        208
      ],
      "parameters": {
        "options": {},
        "operation": "pdf"
      },
      "typeVersion": 1
    },
    {
      "id": "ddaba8bb-676b-4c1e-9986-47b55503520d",
      "name": "计划触发器",
      "type": "n8n-nodes-base.scheduleTrigger",
      "notes": "Ejecución semanal",
      "position": [
        -400,
        -288
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "weeks"
            }
          ]
        }
      },
      "notesInFlow": true,
      "typeVersion": 1.2
    },
    {
      "id": "f56b233d-f303-4845-be9e-7cde10110f87",
      "name": "Discord",
      "type": "n8n-nodes-base.discord",
      "position": [
        1024,
        144
      ],
      "webhookId": "b30b5012-4bb4-4a31-a291-f7490b21e4f6",
      "parameters": {
        "content": "={{ $json.message }}",
        "options": {},
        "authentication": "webhook"
      },
      "typeVersion": 2
    },
    {
      "id": "4c946a75-11bd-4c5e-9e29-9b95b56b342b",
      "name": "获取表格中的行",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        336,
        -80
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1eJVTi79GRuz05MRn55KsQGKnn9R3yX8BBH212POrcKA",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1eJVTi79GRuz05MRn55KsQGKnn9R3yX8BBH212POrcKA/edit?usp=drivesdk",
          "cachedResultName": "PlayWay_BabelBots"
        }
      },
      "executeOnce": true,
      "typeVersion": 4.6,
      "alwaysOutputData": true
    },
    {
      "id": "792b65d0-3e97-44d2-994b-7ddbb765c9dd",
      "name": "OpenRouter 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        -464,
        592
      ],
      "parameters": {
        "model": "meta-llama/llama-4-maverick",
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "377311e1-ee99-48a9-8b23-fc9b09b4abbf",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        32,
        208
      ],
      "parameters": {
        "text": "=Analyze the following company report and provide an executive summary in English, highlighting:\n\n* Key financial information (if available)\n* Relevant actions announced by the company\n* Changes in the board of directors or other important decisions\n* Any potential impact for investors\n\nReport text:\n{{ \\$json.text }}\n",
        "options": {},
        "promptType": "define"
      },
      "typeVersion": 2.1
    },
    {
      "id": "73691e8d-3eb0-4918-8f57-e42ffda2ff1e",
      "name": "简单记忆",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        144,
        432
      ],
      "parameters": {
        "sessionKey": "playway-agent",
        "sessionIdType": "customKey"
      },
      "typeVersion": 1.3
    },
    {
      "id": "f6a43984-cc3f-4a02-aadc-575ba322778f",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -192,
        160
      ],
      "parameters": {
        "color": 3,
        "width": 768,
        "height": 400,
        "content": "这是 AI 处理过程 — 进入并根据您的喜好更改提示。"
      },
      "typeVersion": 1
    },
    {
      "id": "1928302e-8082-4d28-a553-4a7bb295547e",
      "name": "编辑字段 1",
      "type": "n8n-nodes-base.set",
      "position": [
        656,
        496
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "657129da-9b3f-43c2-ac71-a41799949ff1",
              "name": "url",
              "type": "string",
              "value": "={{ $('HTTP Request1').item.json.url }}"
            },
            {
              "id": "a3583044-d67b-4576-a9b9-b87181ce34c1",
              "name": "enviado_discord",
              "type": "string",
              "value": "true"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "bfd92648-dc17-4dec-b1a0-089b949b990e",
      "name": "在表格中更新行",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        864,
        496
      ],
      "parameters": {
        "columns": {
          "value": {
            "url": "={{ $json.url }}",
            "enviado_discord": "={{ $json.enviado_discord }}"
          },
          "schema": [
            {
              "id": "url",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "enviado_discord",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "enviado_discord",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "url"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1eJVTi79GRuz05MRn55KsQGKnn9R3yX8BBH212POrcKA/edit#gid=0",
          "cachedResultName": "PDFs"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1eJVTi79GRuz05MRn55KsQGKnn9R3yX8BBH212POrcKA",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1eJVTi79GRuz05MRn55KsQGKnn9R3yX8BBH212POrcKA/edit?usp=drivesdk",
          "cachedResultName": "PlayWay_BabelBots"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "2996662d-4710-4340-96d0-3f6272a756ea",
      "name": "在表格中追加或更新行",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        672,
        -80
      ],
      "parameters": {
        "columns": {
          "value": {},
          "schema": [
            {
              "id": "url",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "enviado_discord",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "enviado_discord",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "autoMapInputData",
          "matchingColumns": [
            "url"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1eJVTi79GRuz05MRn55KsQGKnn9R3yX8BBH212POrcKA/edit#gid=0",
          "cachedResultName": "PDFs"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1eJVTi79GRuz05MRn55KsQGKnn9R3yX8BBH212POrcKA",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1eJVTi79GRuz05MRn55KsQGKnn9R3yX8BBH212POrcKA/edit?usp=drivesdk",
          "cachedResultName": "PlayWay_BabelBots"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "3bf5e883-58dc-4035-b0fd-a87a00702da8",
      "name": "合并",
      "type": "n8n-nodes-base.merge",
      "position": [
        512,
        -128
      ],
      "parameters": {
        "mode": "combine",
        "options": {},
        "joinMode": "keepNonMatches",
        "fieldsToMatchString": "url"
      },
      "typeVersion": 3.2
    },
    {
      "id": "570fdfd2-e438-4b5c-86d2-e0729389b653",
      "name": "最大字符过滤器",
      "type": "n8n-nodes-base.code",
      "position": [
        416,
        192
      ],
      "parameters": {
        "jsCode": "const input = $input.all();\nconst chunkSize = 1900;\nconst result = [];\n\nfor (const item of input) {\n  const text = item.json.output;\n  for (let i = 0; i < text.length; i += chunkSize) {\n    result.push({\n      json: {\n        message: text.slice(i, i + chunkSize)\n      }\n    });\n  }\n}\n\nreturn result;\n\n"
      },
      "typeVersion": 2
    },
    {
      "id": "23a4e1dc-5535-43a9-8f5e-0e4e7f757044",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -704,
        -400
      ],
      "parameters": {
        "width": 432,
        "height": 448,
        "content": "## 开始"
      },
      "typeVersion": 1
    },
    {
      "id": "807096dc-8460-4ce2-80e8-d08ce64e4141",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -224,
        -368
      ],
      "parameters": {
        "color": 2,
        "width": 480,
        "height": 432,
        "content": "## 网站访问和 PDF 搜索"
      },
      "typeVersion": 1
    },
    {
      "id": "2eac5cae-923f-49c3-8897-ffc22801c882",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        304,
        -272
      ],
      "parameters": {
        "width": 496,
        "height": 336,
        "content": "## Google 连接"
      },
      "typeVersion": 1
    },
    {
      "id": "b03fe146-3fce-464e-9f91-5edff8c9b769",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -576,
        384
      ],
      "parameters": {
        "color": 6,
        "width": 320,
        "height": 368,
        "content": "## 模型连接"
      },
      "typeVersion": 1
    },
    {
      "id": "446111cd-3794-4812-a379-9b69ea2ebf85",
      "name": "便签5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        624,
        368
      ],
      "parameters": {
        "color": 4,
        "width": 448,
        "height": 288,
        "content": "## 标记已注册的 URL"
      },
      "typeVersion": 1
    },
    {
      "id": "511215dc-2ba6-4e62-a622-565e765d4244",
      "name": "便签6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        864,
        16
      ],
      "parameters": {
        "color": 4,
        "width": 448,
        "height": 288,
        "content": "## 发送到 Discord"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "b3ef412b-aeec-4a6e-89e3-f03acdc1e845",
  "connections": {
    "Code": {
      "main": [
        [
          {
            "node": "Get row(s) in sheet",
            "type": "main",
            "index": 0
          },
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTML": {
      "main": [
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge": {
      "main": [
        [
          {
            "node": "Append or update row in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Filtro caracteres max",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields1": {
      "main": [
        [
          {
            "node": "Update row in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "HTML",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request1": {
      "main": [
        [
          {
            "node": "Extract from File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract from File": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          },
          {
            "node": "Edit Fields1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get row(s) in sheet": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Filtro caracteres max": {
      "main": [
        [
          {
            "node": "Discord",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenRouter Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Append or update row in sheet": {
      "main": [
        [
          {
            "node": "HTTP Request1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 文档提取, AI 摘要总结

需要付费吗?

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

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

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

作者
Cristian Baño Belchí

Cristian Baño Belchí

@babelbots

Técnico en automatización y robótica, compartiré todo tipo de automatizaciones con la comunidad hispanohablante a través de youtube.

外部链接
在 n8n.io 查看

分享此工作流