8
n8n 中文网amn8n.com

周边旧货集市(展示)

高级

这是一个Other领域的自动化工作流,包含 20 个节点。主要使用 If, Set, Html, Filter, SplitOut 等节点。 📍 通过Telegram发送每日附近旧货集市提醒

前置要求
  • Telegram Bot Token
  • 可能需要目标 API 的认证凭证

分类

工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "xR7g6JLAHXJScFEG",
  "meta": {
    "instanceId": "89af474e60c70a1e45bf242e266e9ca1446dd974ab86f6d185b8ccded3effed2",
    "templateCredsSetupCompleted": true
  },
  "name": "周边旧货集市(展示)",
  "tags": [
    {
      "id": "NabIyPgRf7ZggE5B",
      "name": "Showcase",
      "createdAt": "2025-06-03T15:41:30.076Z",
      "updatedAt": "2025-06-03T15:41:30.076Z"
    }
  ],
  "nodes": [
    {
      "id": "edb6065a-738e-41c8-9719-0ae928f8cace",
      "name": "当点击\"测试工作流\"时",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -1200,
        -1005
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "6ee2fbb2-3f5b-496d-97a3-74c9a33c5166",
      "name": "获取 Brocabrac",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -540,
        -880
      ],
      "parameters": {
        "url": "={{ $json.URL }}",
        "options": {},
        "responseFormat": "string"
      },
      "typeVersion": 1
    },
    {
      "id": "1e824e88-b943-4b58-80c2-3761a821bd64",
      "name": "分离输出",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        340,
        -880
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "ev"
      },
      "typeVersion": 1
    },
    {
      "id": "c11bbebc-cae5-4f55-a65c-3eaa943c117f",
      "name": "遍历项目",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        560,
        -880
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "42a7ed20-b88c-4ae7-8299-e753a4311982",
      "name": "每天上午 7 点",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -1200,
        -800
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "cronExpression",
              "expression": "30 7 * * *"
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "cabda7f6-6c14-4bbc-863f-403e129c1517",
      "name": "获取位置",
      "type": "n8n-nodes-base.homeAssistant",
      "position": [
        -980,
        -880
      ],
      "parameters": {
        "entityId": "Your_Smartphone_location_sensor",
        "resource": "state"
      },
      "credentials": {
        "homeAssistantApi": {
          "id": "VurjB0xfUjis4pXd",
          "name": "Home Assistant account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "3098fb12-99a0-4bf8-9cbc-a782c1b62663",
      "name": "设置要解析的 URL",
      "type": "n8n-nodes-base.set",
      "position": [
        -760,
        -880
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "54a5f609-4267-4367-bbbb-2c692730b536",
              "name": "URL",
              "type": "string",
              "value": "=https://brocabrac.fr/{{ $json.attributes.postal_code.slice(0,2) }}/{{ $json.attributes.locality }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "de23ed8b-d907-4bbb-ac22-08378c48e457",
      "name": "提取日期和区块",
      "type": "n8n-nodes-base.html",
      "position": [
        -320,
        -880
      ],
      "parameters": {
        "options": {},
        "operation": "extractHtmlContent",
        "extractionValues": {
          "values": [
            {
              "key": "Date",
              "attribute": "data-date",
              "cssSelector": "div.block.ev-list > div:nth-child(1) > div.section-title",
              "returnValue": "attribute"
            },
            {
              "key": "HTMLBlock",
              "cssSelector": "div.block.ev-list > div",
              "returnValue": "html"
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "44b70afd-e751-4817-b853-187e290db2b4",
      "name": "获取排名和距离",
      "type": "n8n-nodes-base.set",
      "position": [
        1000,
        -880
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "f5d111d1-3790-41c9-a395-69f1f327ef09",
              "name": "Distance",
              "type": "number",
              "value": "={{ $json.Distance.slice(0,-3) }}"
            },
            {
              "id": "6f72f72c-3a16-4a1a-87d9-13fdff32b25d",
              "name": "Rank",
              "type": "string",
              "value": "={{ $json.Rank.replaceAll('•','x') }}"
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "e3da6c6a-0a45-4cb7-abd7-f4fc49555a06",
      "name": "筛选邻近且规模较大的活动",
      "type": "n8n-nodes-base.filter",
      "position": [
        800,
        -1660
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "143b57f3-23e9-4675-b667-4a08e74db9c1",
              "operator": {
                "type": "string",
                "operation": "contains"
              },
              "leftValue": "={{ $json.Rank }}",
              "rightValue": ""
            },
            {
              "id": "3cfb49b7-5e8b-4783-af0b-b0b9f658b14c",
              "operator": {
                "type": "number",
                "operation": "lte"
              },
              "leftValue": "={{ $json.Distance }}",
              "rightValue": 20
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "76ed047f-ddc9-4fff-b8f6-1c2b36f06be1",
      "name": "今天有活动吗?",
      "type": "n8n-nodes-base.if",
      "position": [
        -100,
        -880
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "03b76adc-e818-44cc-9a99-12d03a33b099",
              "operator": {
                "type": "dateTime",
                "operation": "equals"
              },
              "leftValue": "={{ $json.Date.toDateTime() }}",
              "rightValue": "={{ $today.plus({days}) }}"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "7c9021a5-6907-4956-9b86-c8d6a960fff5",
      "name": "提取旧货集市活动",
      "type": "n8n-nodes-base.html",
      "position": [
        120,
        -880
      ],
      "parameters": {
        "options": {},
        "operation": "extractHtmlContent",
        "dataPropertyName": "HTMLBlock",
        "extractionValues": {
          "values": [
            {
              "key": "ev",
              "cssSelector": "div.ev",
              "returnArray": true,
              "returnValue": "html"
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "ba984d37-184f-4a8d-b2aa-b06f78222292",
      "name": "获取每个旧货集市信息",
      "type": "n8n-nodes-base.html",
      "position": [
        780,
        -880
      ],
      "parameters": {
        "options": {},
        "operation": "extractHtmlContent",
        "dataPropertyName": "ev",
        "extractionValues": {
          "values": [
            {
              "key": "City",
              "cssSelector": "span.city"
            },
            {
              "key": "Distance",
              "cssSelector": "span.dist"
            },
            {
              "key": "Rank",
              "cssSelector": "span.dots"
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "a790ab8e-746b-46ba-bcb3-a611662636df",
      "name": "发送提醒",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1500,
        -1660
      ],
      "webhookId": "42c6d21a-ea60-4b37-8822-46a41ef9bdf1",
      "parameters": {
        "text": "={{ $json.message }}",
        "chatId": "Your_Chat_ID",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "ANiBkg3Tng36ZRwP",
          "name": "Telegram account (n8n)"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "c05d53df-98f2-4f29-8b69-e3652e9443f6",
      "name": "格式化响应",
      "type": "n8n-nodes-base.set",
      "position": [
        1020,
        -1660
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "3516d92b-fda3-4441-a059-639db5bd29cf",
              "name": "Brocante",
              "type": "string",
              "value": "={{ $json.City }} ({{ $json.Rank }} à {{ $json.Distance }} km)"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "ec425780-841b-451d-8160-b66890828fd4",
      "name": "设置消息",
      "type": "n8n-nodes-base.set",
      "position": [
        1240,
        -1660
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "22ff618b-d768-46bf-83b6-64c60ed1407b",
              "name": "message",
              "type": "string",
              "value": "=📦🏡 Voici les brocantes : - {{ $json.Brocante }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "ea4f3e9d-291e-4557-b242-eea7dac2dd5c",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -820,
        -1320
      ],
      "parameters": {
        "width": 640,
        "height": 660,
        "content": "## 1️⃣ 获取并解析旧货集市数据\\n### 执行过程:\\n- HTTP 请求获取当前地点 Brocabrac 页面的 HTML 内容。\\n- 工作流提取两条数据:\\n  - 日期(活动列出的日期)\\n  - HTMLBlock(完整的旧货集市信息区块)\\n- 检查今天是否有任何活动安排。\\n- 如果有,则提取所有代表单个旧货集市的 div.ev 条目。\\n\\n### 目的:\\n将静态网页转换为结构化数据,为后续处理做好准备。"
      },
      "typeVersion": 1
    },
    {
      "id": "6692692d-c5f7-427f-a95b-ebe00042bb91",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -140,
        -1320
      ],
      "parameters": {
        "width": 1400,
        "height": 660,
        "content": "## 2️⃣ 处理、筛选并提取相关活动\\n执行过程:\\n- 分割旧货集市条目列表并遍历每个条目。\\n- 从每个区块中提取:\\n  - 城市\\n  - 距离\\n  - 排名(使用圆点表示活动重要性的指标)\\n- 清理数据(例如,从距离中移除\"km\",替换排名中的\"•\")。\\n- 基于两个标准筛选活动:\\n  - 距离 ≤ 20 公里\\n  - 必须存在排名(表明显著的规模或受欢迎度)\\n\\n目的:\\n筛选掉不相关或过远的活动,仅呈现附近的最佳选择。"
      },
      "typeVersion": 1
    },
    {
      "id": "33aa481c-f216-4fee-aa0f-01fdd0db92ae",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        680,
        -2040
      ],
      "parameters": {
        "width": 1020,
        "height": 620,
        "content": "## 3️⃣ 通过 Telegram 格式化并发送通知\\n### 执行过程:\\n- 将剩余的筛选后活动格式化为整洁的字符串,如:\\n  ```\\n  城市(排名 à 距离 km)\\n  ```\\n- 这些内容组合成单个消息,如:\\n  ```\\n  📦🏡 以下是旧货集市:- 城市1 (...) - 城市2 (...)\\n  ```\\n- 最终消息通过 Telegram 发送给用户。\\n\\n### 目的:\\n以用户友好的方式,及时传递有关今日旧货集市的相关提醒。"
      },
      "typeVersion": 1
    },
    {
      "id": "05b97c78-ece0-4b20-8d4a-9814aaabaf4c",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1380,
        -1320
      ],
      "parameters": {
        "width": 520,
        "height": 660,
        "content": "## 0️⃣ 每日触发器与地理位置设置\\n### 执行过程:\\n- 工作流每天上午 7 点通过计划触发器节点手动或自动触发。\\n- 使用 Home Assistant 传感器获取手机的当前位置。\\n- 然后基于用户的地理位置(邮政编码和地区)构建动态 URL,以查询 Brocabrac.fr 获取本地旧货集市信息。\\n\\n### 目的:\\n确保获取的数据具有位置感知能力,并始终与用户当前位置相关。"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "ab2abd4b-1f04-4e48-bd2f-79ff028962c4",
  "connections": {
    "Split Out": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Any today?": {
      "main": [
        [
          {
            "node": "Extract Garage Sales Events",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "Get location": {
      "main": [
        [
          {
            "node": "Set URL to parse",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Brocabrac": {
      "main": [
        [
          {
            "node": "Extract Date & Blocks",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [
          {
            "node": "Filter on close and bigger events",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get each Garage Sale info",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set the message": {
      "main": [
        [
          {
            "node": "Send an Alert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set URL to parse": {
      "main": [
        [
          {
            "node": "Get Brocabrac",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Every day at 7 AM": {
      "main": [
        [
          {
            "node": "Get location",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Shape the response": {
      "main": [
        [
          {
            "node": "Set the message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Rank & Distance": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Date & Blocks": {
      "main": [
        [
          {
            "node": "Any today?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get each Garage Sale info": {
      "main": [
        [
          {
            "node": "Get Rank & Distance",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Garage Sales Events": {
      "main": [
        [
          {
            "node": "Split Out",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter on close and bigger events": {
      "main": [
        [
          {
            "node": "Shape the response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Test workflow’": {
      "main": [
        [
          {
            "node": "Get location",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 其他

需要付费吗?

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

工作流信息
难度等级
高级
节点数量20
分类1
节点类型12
难度说明

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

作者
Thibaud

Thibaud

@tderouze

Automation consultant with over 10 years experience helping Sales & Marketing teams to streamline their processes.

外部链接
在 n8n.io 查看

分享此工作流