{
  "name": "08 New YouTube videos -> best Shorts clip moments",
  "nodes": [
    {
      "parameters": {
        "content": "## Shorts clip finder\nWhen your favourite channels post, get the 3 best 20-55s clip moments (timestamps, hook, title) for Shorts/Reels/TikTok.\n\n1. Open **Config** and paste your Apify API token (free account: console.apify.com -> Settings -> API & Integrations).\n2. Paste a Discord/Slack webhook URL and/or a Telegram bot token + chat ID (delete the node you don't use).\n3. Click **Test workflow**, then switch it to **Active**.",
        "height": 340,
        "width": 420
      },
      "name": "How to use",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        0,
        -400
      ],
      "id": "2ed5493b-c860-475a-9ea1-e2a1b2d2a76c"
    },
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "hours",
              "hoursInterval": 6
            }
          ]
        }
      },
      "name": "Schedule",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        0,
        0
      ],
      "id": "93474ace-c73f-4e23-84d6-42fdf1ba7827"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "6c26a55d-3ccb-40e4-920f-e9320fa08073",
              "name": "apifyToken",
              "value": "YOUR_APIFY_TOKEN",
              "type": "string"
            },
            {
              "id": "85a5c069-cfa8-4a20-b8fa-7cc8a360aeb7",
              "name": "webhookUrl",
              "value": "https://discord.com/api/webhooks/...",
              "type": "string"
            },
            {
              "id": "00040980-b5e8-4326-9f54-f329b6bbb146",
              "name": "telegramBotToken",
              "value": "",
              "type": "string"
            },
            {
              "id": "7cadb0bb-4232-4d6f-8846-c20935e0625c",
              "name": "telegramChatId",
              "value": "",
              "type": "string"
            },
            {
              "id": "f5448151-ab40-48f3-b163-d350cf8903a2",
              "name": "channels",
              "value": "https://www.youtube.com/@lexfridman",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "name": "Config",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        220,
        0
      ],
      "id": "28f79b1e-993e-435a-b714-a5e0eef0c2fc"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "=https://api.apify.com/v2/acts/martin10291~youtube-shorts-clip-finder/run-sync-get-dataset-items",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "token",
              "value": "={{ $('Config').item.json.apifyToken }}"
            },
            {
              "name": "timeout",
              "value": "280"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({videoUrls: $('Config').item.json.channels.split(',').map(s => s.trim()), maxVideosPerSource: 1, clipsPerVideo: 3}) }}",
        "options": {
          "timeout": 300000
        }
      },
      "name": "Run Apify scraper",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        440,
        0
      ],
      "id": "91aa5ba3-e35f-4dbf-963e-c895046bd765"
    },
    {
      "parameters": {
        "jsCode": "const rows = $input.all();\nif (!rows.length) return [];\nconst text = 'Clip ideas from new videos:\\n' + rows.slice(0, 9).map(i => `🎬 ${i.json.suggestedTitle || i.json.hook} (${i.json.startSeconds}s-${i.json.endSeconds}s, score ${i.json.viralityScore})\\n${i.json.clipUrl || ''}`).join('\\n');\nreturn [{ json: { text } }];"
      },
      "name": "Format message",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        660,
        0
      ],
      "id": "d39f0261-b725-4b98-9b35-cdcbba503af6"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "={{ $('Config').item.json.webhookUrl }}",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({content: $json.text, text: $json.text}) }}",
        "options": {}
      },
      "name": "Send to Discord or Slack",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        880,
        0
      ],
      "id": "e961ba4b-f35f-42a4-a772-4f0fa863cc3d"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "=https://api.telegram.org/bot{{ $('Config').item.json.telegramBotToken }}/sendMessage",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({chat_id: $('Config').item.json.telegramChatId, text: $json.text, disable_web_page_preview: true}) }}",
        "options": {}
      },
      "name": "Send to Telegram",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        880,
        200
      ],
      "id": "514cf015-a83b-4c6b-bd71-e2b2aafd6d5d"
    }
  ],
  "connections": {
    "Schedule": {
      "main": [
        [
          {
            "node": "Config",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Config": {
      "main": [
        [
          {
            "node": "Run Apify scraper",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Run Apify scraper": {
      "main": [
        [
          {
            "node": "Format message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format message": {
      "main": [
        [
          {
            "node": "Send to Discord or Slack",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send to Telegram",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "pinData": {},
  "active": false
}