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": "INSTA 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": "INSTA動画ダウンロード",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -1824,
        -368
      ],
      "parameters": {
        "url": "={{ $json.videoUrlClean }}",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "d3ef124d-61c4-46d1-98aa-c411e9d88117",
      "name": "FB動画ダウンロード",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -1904,
        -80
      ],
      "parameters": {
        "url": "={{ $json.downloadUrl }}",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "16dfda54-ea22-4c09-904d-8ca4ea937b09",
      "name": "INSTA動画送信",
      "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": "FB動画送信",
      "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": "## Getting link from usr"
      },
      "typeVersion": 1
    },
    {
      "id": "c603ccb2-7812-4d8f-b4dd-ec0db9fdbd72",
      "name": "FB IGリンク正規表現",
      "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": "## Checking FB or IG"
      },
      "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 NODE"
      },
      "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 NODE"
      },
      "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": "## CHECKING VALID LINK"
      },
      "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": "## SENDING ERROR MSG IF INVALID LINK"
      },
      "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": "\n"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "cddc9f65-7935-4126-99ca-a3a6967907a2": {
      "main": [
        [
          {
            "node": "c4b39d39-8923-4205-9ae1-3fb58b41a5f8",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "230b0026-fbf1-405c-a96c-a6c5fce519d8",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "c4fc0f16-fa4b-4594-bab7-8dcc09e46baf": {
      "main": [
        [
          {
            "node": "bad84de5-9038-41d2-baeb-c54450b422df",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "bad84de5-9038-41d2-baeb-c54450b422df": {
      "main": [
        [
          {
            "node": "63b7d8c9-2161-4208-a338-10851ff231cf",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "230b0026-fbf1-405c-a96c-a6c5fce519d8": {
      "main": [
        [
          {
            "node": "3ef62436-4c2f-49a5-a19c-4113666cbb82",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "2b13d770-8da9-4435-a251-a50a5e0993cd",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "f30aea16-7135-485b-8054-fb760d6ff58e": {
      "main": [
        []
      ]
    },
    "11611fbd-a8ff-45bf-aca8-15fea2cead1b": {
      "main": [
        [
          {
            "node": "8fcc67ba-589a-4fd0-8a81-bc4b8f28632e",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "d3ef124d-61c4-46d1-98aa-c411e9d88117": {
      "main": [
        [
          {
            "node": "f30aea16-7135-485b-8054-fb760d6ff58e",
            "type": "main",
            "index": 0
          },
          {
            "node": "d781ba41-6168-414a-a5e4-7444de71f9e4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "3ef62436-4c2f-49a5-a19c-4113666cbb82": {
      "main": [
        [
          {
            "node": "11611fbd-a8ff-45bf-aca8-15fea2cead1b",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "c603ccb2-7812-4d8f-b4dd-ec0db9fdbd72": {
      "main": [
        [
          {
            "node": "cddc9f65-7935-4126-99ca-a3a6967907a2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "c8eada7d-335b-4861-aae7-5d39f2cf1301": {
      "main": [
        [
          {
            "node": "c603ccb2-7812-4d8f-b4dd-ec0db9fdbd72",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "63b7d8c9-2161-4208-a338-10851ff231cf": {
      "main": [
        [
          {
            "node": "16dfda54-ea22-4c09-904d-8ca4ea937b09",
            "type": "main",
            "index": 0
          },
          {
            "node": "d9487499-bf52-4954-91cc-546ad723a15f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "c4b39d39-8923-4205-9ae1-3fb58b41a5f8": {
      "main": [
        [
          {
            "node": "c4fc0f16-fa4b-4594-bab7-8dcc09e46baf",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "8fcc67ba-589a-4fd0-8a81-bc4b8f28632e": {
      "main": [
        [
          {
            "node": "d3ef124d-61c4-46d1-98aa-c411e9d88117",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
よくある質問

このワークフローの使い方は?

上記のJSON設定コードをコピーし、n8nインスタンスで新しいワークフローを作成して「JSONからインポート」を選択、設定を貼り付けて認証情報を必要に応じて変更してください。

このワークフローはどんな場面に適していますか?

上級 - コンテンツ作成, マルチモーダルAI

有料ですか?

このワークフローは完全無料です。ただし、ワークフローで使用するサードパーティサービス(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で表示

このワークフローを共有

カテゴリー

カテゴリー: 34