读取站点地图并过滤URL
中级
这是一个Engineering, Marketing领域的自动化工作流,包含 10 个节点。主要使用 Set, Xml, Filter, SplitOut, HttpRequest 等节点。 从sitemap.xml中提取和处理特定链接
前置要求
- •可能需要目标 API 的认证凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "7fdJOvYNILCr24fH",
"meta": {
"instanceId": "568298fde06d3db80a2eea77fe5bf45f0c7bb898dea20b769944e9ac7c6c5a80"
},
"name": "读取站点地图并过滤 URL",
"tags": [],
"nodes": [
{
"id": "38910330-5286-4f3f-b62e-9216acccd503",
"name": "‘测试工作流’触发器",
"type": "n8n-nodes-base.manualTrigger",
"position": [
-460,
-60
],
"parameters": {},
"typeVersion": 1
},
{
"id": "d4e5991b-62d9-45ca-962f-c1077f3bce19",
"name": "设置站点地图 URL",
"type": "n8n-nodes-base.set",
"position": [
-280,
-60
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "d6c5ac86-6d67-42fb-96ec-9826caf452e2",
"name": "sitemapUrl",
"type": "string",
"value": "https://duckduckgo.com/sitemap.xml"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "0d957deb-5830-4077-97e4-437dc7c0e527",
"name": "分离输出",
"type": "n8n-nodes-base.splitOut",
"position": [
260,
-60
],
"parameters": {
"options": {},
"fieldToSplitOut": "urlset.url"
},
"typeVersion": 1
},
{
"id": "7021088c-dfa1-4aae-b2e7-15b0ca10a750",
"name": "获取站点地图",
"type": "n8n-nodes-base.httpRequest",
"position": [
-100,
-60
],
"parameters": {
"url": "={{ $json.sitemapUrl }}",
"options": {}
},
"typeVersion": 4.2
},
{
"id": "d3b86577-01fc-40f8-ab65-93ba420187b8",
"name": "将站点地图转换为 JSON",
"type": "n8n-nodes-base.xml",
"position": [
80,
-60
],
"parameters": {
"options": {
"trim": true,
"normalize": true,
"mergeAttrs": true,
"ignoreAttrs": true,
"normalizeTags": true
}
},
"typeVersion": 1
},
{
"id": "bc0758ae-06eb-4a29-a91e-414407ec8ade",
"name": "过滤 URL",
"type": "n8n-nodes-base.filter",
"position": [
440,
-60
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "0bf8e98c-b6c5-4129-852c-0d3e63f32f9f",
"operator": {
"type": "string",
"operation": "endsWith"
},
"leftValue": "={{ $json.loc }}",
"rightValue": ".pdf"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "1d3fed97-1e72-426c-a48d-1a9683f40c4c",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-300,
-140
],
"parameters": {
"color": 6,
"width": 150,
"height": 240,
"content": "**在此设置您的 sitemap.xml URL。**"
},
"typeVersion": 1
},
{
"id": "521ec74d-6707-47fd-992d-eecebed415ab",
"name": "便签2",
"type": "n8n-nodes-base.stickyNote",
"position": [
420,
-140
],
"parameters": {
"color": 6,
"width": 150,
"height": 240,
"content": "**在此创建您的过滤器。**"
},
"typeVersion": 1
},
{
"id": "07e6c3de-cc72-490d-b614-67034ce04bfb",
"name": "便签3",
"type": "n8n-nodes-base.stickyNote",
"position": [
-140,
-180
],
"parameters": {
"color": 7,
"width": 540,
"height": 300,
"content": "## 获取并处理 sitemap.xml 文件"
},
"typeVersion": 1
},
{
"id": "abf5f02d-d2a0-43f1-9a1f-386cc4f9861b",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-780,
-220
],
"parameters": {
"width": 280,
"height": 420,
"content": "## Sitemap.xml 读取器"
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "74793599-4c7d-4532-bbd5-a2ce4761fbc8",
"connections": {
"Split Out": {
"main": [
[
{
"node": "Filter URLs",
"type": "main",
"index": 0
}
]
]
},
"Get Sitemap": {
"main": [
[
{
"node": "Convert Sitemap to JSON",
"type": "main",
"index": 0
}
]
]
},
"Set sitemap URL": {
"main": [
[
{
"node": "Get Sitemap",
"type": "main",
"index": 0
}
]
]
},
"Convert Sitemap to JSON": {
"main": [
[
{
"node": "Split Out",
"type": "main",
"index": 0
}
]
]
},
"‘Test workflow’ trigger": {
"main": [
[
{
"node": "Set sitemap URL",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
中级 - 工程, 营销
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
网页内部链接提取
从网页中提取内部链接
If
Set
Html
+6
13 节点Audun
工程
(Duc)深度研究市场模板
集成PerplexityAI研究和OpenAI内容的多层级WordPress博客生成器
If
Set
Xml
+28
132 节点Daniel Ng
人工智能
使用GPT-4o AI分析和多格式报告运行完整技术SEO审计
使用GPT-4o AI分析和多格式报告运行完整技术SEO审计
Set
Xml
Code
+14
45 节点Oriol Seguí Rotllant
人工智能
实时Notion Todoist双向同步模板
使用Redis的Notion Todoist实时双向同步
If
Set
Code
+26
246 节点Mario
销售
基于视觉的AI代理爬虫 - 使用Google Sheets、ScrapingBee和Gemini
✨ 基于视觉的AI代理爬虫 - 使用Google Sheets、ScrapingBee和Gemini
Set
Markdown
Split Out
+9
29 节点Dataki
销售
API架构提取器
API架构提取器
If
Set
Code
+22
88 节点Polina Medvedieva
工程