通过Telegram机器人下载Instagram和Facebook视频-Reels

高级

这是一个Content Creation、Multimodal AI领域的自动化工作流,包含 24 个节点。主要使用 If、Set、Code、Telegram、HttpRequest 等节点。 使用Telegram机器人下载Instagram和Facebook视频/Reels

前置要求
  • Telegram Bot Token
  • 可能需要目标 API 的认证凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "d529cce40696d1d21bf521d36c9e372844500ecd67389bbd30e1a509958f4757",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "11611fbd-a8ff-45bf-aca8-15fea2cead1b",
      "name": "视频抓取",
      "type": "n8n-nodes-base.set",
      "position": [
        -2352,
        -80
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "bf1ec381-c09a-4e4d-b299-414d197e0c1e",
              "name": "data",
              "type": "string",
              "value": "={{ $json.data }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "8fcc67ba-589a-4fd0-8a81-bc4b8f28632e",
      "name": "生成下载链接",
      "type": "n8n-nodes-base.code",
      "position": [
        -2128,
        -80
      ],
      "parameters": {
        "jsCode": "const html = $json[\"data\"]; // replace 'data' with your actual field name\nconst match = html.match(/https:\\/\\/dl\\.snapcdn\\.app\\/download\\?token=[^\"]+/);\n\nreturn {\n  json: {\n    downloadUrl: match ? match[0] : null\n  }\n};\n"
      },
      "typeVersion": 2
    },
    {
      "id": "c8eada7d-335b-4861-aae7-5d39f2cf1301",
      "name": "Telegram 触发器",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -3552,
        0
      ],
      "webhookId": "563e04dc-8c54-40d7-89cc-a5aa60950a78",
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "e7LqoFypfbJnNxf4",
          "name": "JOY AI"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "230b0026-fbf1-405c-a96c-a6c5fce519d8",
      "name": "链接检查",
      "type": "n8n-nodes-base.if",
      "position": [
        -2864,
        16
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "62b26b58-bd15-4eb8-90e7-235eabe34cc7",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $json.isFacebookLink }}",
              "rightValue": "true"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "cddc9f65-7935-4126-99ca-a3a6967907a2",
      "name": "如果",
      "type": "n8n-nodes-base.if",
      "position": [
        -3104,
        0
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "9f62fc1b-5b1a-41ae-9b44-429bde6795ae",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $json.isInstagramLink }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "3ef62436-4c2f-49a5-a19c-4113666cbb82",
      "name": "FB API获取",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -2576,
        -80
      ],
      "parameters": {
        "url": "https://fbdownloader.to/api/ajaxSearch",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "multipart-form-data",
        "bodyParameters": {
          "parameters": [
            {
              "name": "q",
              "value": "={{ $('Telegram Trigger').item.json.message.text }}"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "c4b39d39-8923-4205-9ae1-3fb58b41a5f8",
      "name": "Instagram API获取",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -2512,
        -368
      ],
      "parameters": {
        "url": "=https://snapdownloader.com/tools/instagram-downloader/download?url={{ $json.instagramUrl }}",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "c4fc0f16-fa4b-4594-bab7-8dcc09e46baf",
      "name": "URL查找器",
      "type": "n8n-nodes-base.code",
      "position": [
        -2272,
        -368
      ],
      "parameters": {
        "jsCode": "// n8n Function node\n// Input: HTTP Request node output (with HTML inside `data` field)\n// Output: Only the video file URL\n\nconst results = [];\n\nfor (const item of items) {\n  const html = item.json.data || \"\";\n  \n  // Regex to capture video .mp4 links\n  const regex = /(https?:\\/\\/[^\\s\"']+\\.mp4[^\\s\"']*)/gi;\n  const matches = html.match(regex);\n\n  if (matches && matches.length > 0) {\n    results.push({ json: { videoUrl: matches[0] } }); // take first video link\n  } else {\n    results.push({ json: { videoUrl: null } });\n  }\n}\n\nreturn results;\n"
      },
      "typeVersion": 2
    },
    {
      "id": "bad84de5-9038-41d2-baeb-c54450b422df",
      "name": "URL解码器",
      "type": "n8n-nodes-base.code",
      "position": [
        -2064,
        -368
      ],
      "parameters": {
        "jsCode": "// Function node\n// Input: items[i].json.videoUrl\n// Output: items[i].json.videoUrlClean\nreturn items.map(item => {\n  const url = (item.json.videoUrl || '').split('&').join('&');\n  return { json: { ...item.json, videoUrlClean: url } };\n});\n"
      },
      "typeVersion": 2
    },
    {
      "id": "63b7d8c9-2161-4208-a338-10851ff231cf",
      "name": "下载Instagram视频",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -1824,
        -368
      ],
      "parameters": {
        "url": "={{ $json.videoUrlClean }}",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "d3ef124d-61c4-46d1-98aa-c411e9d88117",
      "name": "下载Facebook视频",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -1904,
        -80
      ],
      "parameters": {
        "url": "={{ $json.downloadUrl }}",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "16dfda54-ea22-4c09-904d-8ca4ea937b09",
      "name": "发送Instagram视频",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -1520,
        -368
      ],
      "webhookId": "463d572e-9f8d-4f4b-a4ce-02d199ffd1df",
      "parameters": {
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "operation": "sendVideo",
        "binaryData": true,
        "forceReply": {},
        "replyMarkup": "forceReply",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "e7LqoFypfbJnNxf4",
          "name": "JOY AI"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "f30aea16-7135-485b-8054-fb760d6ff58e",
      "name": "发送Facebook视频",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -1520,
        128
      ],
      "webhookId": "463d572e-9f8d-4f4b-a4ce-02d199ffd1df",
      "parameters": {
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "operation": "sendVideo",
        "binaryData": true,
        "forceReply": {},
        "replyMarkup": "forceReply",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "e7LqoFypfbJnNxf4",
          "name": "JOY AI"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "2b13d770-8da9-4435-a251-a50a5e0993cd",
      "name": "无效URL",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -2528,
        368
      ],
      "webhookId": "cf08190a-9534-40ff-9ead-76ab3bdfe48e",
      "parameters": {
        "text": "Please paste only facebook/Instagram link ⚠️",
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "e7LqoFypfbJnNxf4",
          "name": "JOY AI"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "d9487499-bf52-4954-91cc-546ad723a15f",
      "name": "发送文本消息",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -1520,
        -576
      ],
      "webhookId": "2c975f9d-29e4-44bc-a416-567e525b2ea5",
      "parameters": {
        "text": "⏬Downloading.... Please wait ⌛",
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "e7LqoFypfbJnNxf4",
          "name": "JOY AI"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "d781ba41-6168-414a-a5e4-7444de71f9e4",
      "name": "发送文本消息1",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -1520,
        -80
      ],
      "webhookId": "2c975f9d-29e4-44bc-a416-567e525b2ea5",
      "parameters": {
        "text": "⏬Downloading.... Please wait ⌛",
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "e7LqoFypfbJnNxf4",
          "name": "JOY AI"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "438f2deb-64d9-4e63-8fac-43c31088f603",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3584,
        -64
      ],
      "parameters": {
        "color": 3,
        "width": 400,
        "height": 240,
        "content": "## 从用户获取链接"
      },
      "typeVersion": 1
    },
    {
      "id": "c603ccb2-7812-4d8f-b4dd-ec0db9fdbd72",
      "name": "Facebook Instagram链接正则表达式",
      "type": "n8n-nodes-base.code",
      "position": [
        -3312,
        0
      ],
      "parameters": {
        "jsCode": "const url = $input.first().json.message.text; // your input text\n\n// Regex patterns\nconst fbRegex = /https?:\\/\\/([a-zA-Z0-9-]+\\.)?facebook\\.com\\/[^\\s]+/i;\nconst igRegex = /https?:\\/\\/([a-zA-Z0-9-]+\\.)?instagram\\.com\\/[^\\s]+/i;\n\n// Match\nconst fbMatch = url.match(fbRegex);\nconst igMatch = url.match(igRegex);\n\nreturn {\n  json: {\n    isFacebookLink: !!fbMatch,\n    facebookUrl: fbMatch ? fbMatch[0] : null,\n    isInstagramLink: !!igMatch,\n    instagramUrl: igMatch ? igMatch[0] : null\n  }\n};\n"
      },
      "typeVersion": 2
    },
    {
      "id": "a3c4d451-ec17-473f-8c27-14f3129ef114",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3168,
        -48
      ],
      "parameters": {
        "color": 5,
        "height": 176,
        "content": "## 检查Facebook或Instagram"
      },
      "typeVersion": 1
    },
    {
      "id": "d9f31402-cd1f-49b6-9a60-e3dcf67531f4",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2608,
        -128
      ],
      "parameters": {
        "color": 4,
        "width": 1360,
        "height": 400,
        "content": "## FACEBOOK节点"
      },
      "typeVersion": 1
    },
    {
      "id": "1501a1c7-537a-4dbf-b998-98d1e756e5f3",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2608,
        -592
      ],
      "parameters": {
        "color": 6,
        "width": 1360,
        "height": 400,
        "content": "## INSTAGRAM节点"
      },
      "typeVersion": 1
    },
    {
      "id": "db4effe7-e559-444f-aa6e-c83029165eda",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2912,
        -112
      ],
      "parameters": {
        "color": 7,
        "width": 192,
        "height": 304,
        "content": "## 检查有效链接"
      },
      "typeVersion": 1
    },
    {
      "id": "5a522951-eb06-4cb0-900a-0931cf36ab11",
      "name": "便签5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2592,
        304
      ],
      "parameters": {
        "color": 2,
        "width": 416,
        "height": 208,
        "content": "## 如果链接无效则发送错误消息"
      },
      "typeVersion": 1
    },
    {
      "id": "57177adf-1f58-4bcf-8063-3a554d4e8121",
      "name": "便签6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3632,
        -656
      ],
      "parameters": {
        "color": 5,
        "width": 2704,
        "height": 1216,
        "content": ""
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "INSTA API FETCHING",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Link checking",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "URL FINDER": {
      "main": [
        [
          {
            "node": "URL DECODER",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "URL DECODER": {
      "main": [
        [
          {
            "node": "DOWNLOAD INSTA VID",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Link checking": {
      "main": [
        [
          {
            "node": "FB API FETCHING",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "INVALID URL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SEND FB VIDEO": {
      "main": [
        []
      ]
    },
    "video scraping": {
      "main": [
        [
          {
            "node": "Genrate download link",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "DOWNLOAD FB VID": {
      "main": [
        [
          {
            "node": "SEND FB VIDEO",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send a text message1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "FB API FETCHING": {
      "main": [
        [
          {
            "node": "video scraping",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "FB IG LINK REGEX": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "FB IG LINK REGEX",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "DOWNLOAD INSTA VID": {
      "main": [
        [
          {
            "node": "SEND INSTA VIDEO",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send a text message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "INSTA API FETCHING": {
      "main": [
        [
          {
            "node": "URL FINDER",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Genrate download link": {
      "main": [
        [
          {
            "node": "DOWNLOAD FB VID",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

这是一个高级难度的工作流,适用于Content Creation、Multimodal AI等场景。适合高级用户,包含 16+ 个节点的复杂工作流

需要付费吗?

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

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

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

作者
Joy Sutradhar

Joy Sutradhar

@joy-sutradhar

Automation Architect | Built 50+ workflows integrating Slack, Google Sheets, CRM, Payment systems, AI APIs. I solve problems || A techie person

外部链接
在 n8n.io 上查看 →

分享此工作流