{
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "f5594b16-0952-47ef-9693-e599edbe9cfc",
      "name": "Section \u2014 Extract & Upload",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1360,
        -144
      ],
      "parameters": {
        "color": 5,
        "width": 720,
        "height": 100,
        "content": "## \u2601\ufe0f Step 3 \u2014 Extract, Download & Save Clips\nParses each clip from the API response, downloads the video file, and uploads to Google Drive using the AI-generated clip title as the filename."
      },
      "typeVersion": 1
    },
    {
      "id": "6426887b-805b-41a2-8e6d-7562ce24c4fa",
      "name": "5. Code \u2014 Extract Clip Data",
      "type": "n8n-nodes-base.code",
      "position": [
        1344,
        0
      ],
      "parameters": {
        "jsCode": "const clips = $json.data.clips;\n\nreturn clips.map(clip => ({\n  json: {\n    title: clip.title,\n    export_link: clip.export_link,\n    score: clip.score,\n    tags: clip.tags,\n    desc: clip.desc,\n    begin_ms: clip.begin_ms,\n    end_ms: clip.end_ms\n  }\n}));"
      },
      "typeVersion": 2
    },
    {
      "id": "a8fb58a0-ad71-4dd8-b94b-ecd07ac71ca2",
      "name": "6. HTTP \u2014 Download Clip",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1584,
        0
      ],
      "parameters": {
        "url": "={{ $json.export_link }}",
        "options": {
          "response": {
            "response": {
              "responseFormat": "file"
            }
          }
        }
      },
      "typeVersion": 4.4
    },
    {
      "id": "a5f7f97e-d0e6-47d3-90c8-96bcfdadf1df",
      "name": "7. Google Drive \u2014 Upload Clip",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        1824,
        0
      ],
      "parameters": {
        "name": "={{ $('5. Code \u2014 Extract Clip Data').item.json.title }}",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "id",
          "value": "YOUR_GOOGLE_DRIVE_FOLDER_ID_HERE"
        },
        "inputDataFieldName": "=data"
      },
      "typeVersion": 3
    },
    {
      "id": "6745facf-da05-4ea8-a0dd-fbf5117f1cff",
      "name": "Main \u2014 Overview & Setup1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -64,
        -208
      ],
      "parameters": {
        "color": 2,
        "width": 400,
        "height": 740,
        "content": "## Live Stream Highlight Extractor \u2014 WayinVideo AI\n\n### How it works\nUser submits a live stream recording URL via a form. The workflow sends it to the WayinVideo AI Clipping API, waits 90 seconds for processing, then fetches the generated highlight clips. A Code node extracts each clip's title, export link, score, tags, and timestamps. Each clip is then downloaded and uploaded to Google Drive using the AI-generated clip title as the filename.\n\n### Setup\n1. Replace `YOUR_WAYIN_API_KEY_HERE` in nodes 2 and 4 with your WayinVideo API key\n2. Replace `YOUR_GOOGLE_DRIVE_FOLDER_ID_HERE` in node 7 with your target Drive folder ID\n3. Connect your Google Drive OAuth2 credentials in node 7\n4. Activate the workflow and share the Form URL with streamers\n\n### Customization Tips\n- Change `target_duration` to `DURATION_15_30` for shorter Reels/Shorts clips\n- Swap `ratio` to `RATIO_16_9` for YouTube horizontal highlights\n- Increase the Wait node beyond 90s for streams longer than 2 hours\n- Add a Google Sheets node after node 7 to log clip titles, scores, and Drive links"
      },
      "typeVersion": 1
    },
    {
      "id": "fd9f3374-8e08-4329-8e34-6a909d06a501",
      "name": "Section \u2014 Input1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        384,
        -144
      ],
      "parameters": {
        "color": 5,
        "height": 100,
        "content": "## \ud83d\udce5 Step 1 \u2014 User Input\nCollects the stream recording URL, channel name, category, and number of clips to extract from the user."
      },
      "typeVersion": 1
    },
    {
      "id": "4b63b07e-2087-4b8c-8418-188f94afb76e",
      "name": "Section \u2014 AI Clipping1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        640,
        -144
      ],
      "parameters": {
        "color": 5,
        "width": 720,
        "height": 100,
        "content": "## \ud83e\udd16 Step 2 \u2014 AI Clipping via WayinVideo\nSubmits the video to WayinVideo, waits 90 seconds for processing, then fetches the generated highlight clips with export links."
      },
      "typeVersion": 1
    },
    {
      "id": "48daab8b-8e6d-49eb-97a9-b4481c30cc71",
      "name": "Warning \u2014 Wait Duration1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1072,
        240
      ],
      "parameters": {
        "color": 3,
        "width": 592,
        "height": 140,
        "content": "## \u26a0\ufe0f WARNING \u2014 Wait Time May Be Too Short\nFor live streams longer than 90 minutes, the 90-second wait may not be enough for WayinVideo to finish processing. If clips are missing or the result is empty, increase the Wait node to 180\u2013300 seconds."
      },
      "typeVersion": 1
    },
    {
      "id": "1c83af47-5590-45b0-8cf2-c06ad1d72582",
      "name": "1. Form \u2014 Stream URL + Details1",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        384,
        0
      ],
      "parameters": {
        "options": {},
        "formTitle": "\ud83c\udfae Live Stream Highlight Extractor",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Live Stream Recording URL",
              "placeholder": "https://www.youtube.com/watch?v=xxxxxxx or Twitch/Kick VOD link",
              "requiredField": true
            },
            {
              "fieldLabel": "Streamer / Channel Name",
              "placeholder": "e.g. TechWithRahul / GamingWithAmit",
              "requiredField": true
            },
            {
              "fieldLabel": "Stream Category",
              "placeholder": "e.g. Gaming, Finance, Fitness, Podcast, Commentary",
              "requiredField": true
            },
            {
              "fieldLabel": "Number of Highlight Clips",
              "placeholder": "e.g. 5",
              "requiredField": true
            }
          ]
        },
        "formDescription": "Paste your live stream recording URL \u2014 AI will automatically extract the most viral and exciting highlight moments as ready-to-upload clips."
      },
      "typeVersion": 2.2
    },
    {
      "id": "29d4ad5f-fba6-4a6b-afee-45a5e7ccedbf",
      "name": "2. WayinVideo \u2014 Submit Clipping Task1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        640,
        0
      ],
      "parameters": {
        "url": "https://wayinvideo-api.wayin.ai/api/v2/clips",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"video_url\": \"{{ $json['Live Stream Recording URL'] }}\",\n  \"project_name\": \"Highlights - {{ $json['Streamer / Channel Name'] }}\",\n  \"target_duration\": \"DURATION_30_60\",\n  \"limit\": {{ $json['Number of Highlight Clips'] }},\n  \"enable_export\": true,\n  \"resolution\": \"HD_720\",\n  \"enable_caption\": true,\n  \"caption_display\": \"original\",\n  \"cc_style_tpl\": \"temp-7\",\n  \"enable_ai_hook\": true,\n  \"ai_hook_script_style\": \"excited\",\n  \"ai_hook_position\": \"beginning\",\n  \"enable_ai_reframe\": true,\n  \"ratio\": \"RATIO_9_16\",\n  \"target_lang\": \"en\"\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer YOUR_TOKEN_HERE"
            },
            {
              "name": "x-wayinvideo-api-version",
              "value": "v2"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "2213145d-ea0a-4e20-aa6a-0d6831508d3c",
      "name": "3. Wait \u2014 90 Seconds1",
      "type": "n8n-nodes-base.wait",
      "position": [
        880,
        0
      ],
      "parameters": {
        "amount": 90
      },
      "typeVersion": 1.1
    },
    {
      "id": "d4c37d92-3f3c-40bc-90d5-6846a6b97692",
      "name": "4. WayinVideo \u2014 Get Clips Result1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1120,
        0
      ],
      "parameters": {
        "url": "=https://wayinvideo-api.wayin.ai/api/v2/clips/results/{{ $('2. WayinVideo \u2014 Submit Clipping Task1').item.json.data.id }}",
        "options": {},
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer YOUR_TOKEN_HERE"
            },
            {
              "name": "x-wayinvideo-api-version",
              "value": "v2"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4.2
    }
  ],
  "connections": {
    "3. Wait \u2014 90 Seconds1": {
      "main": [
        [
          {
            "node": "4. WayinVideo \u2014 Get Clips Result1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "6. HTTP \u2014 Download Clip": {
      "main": [
        [
          {
            "node": "7. Google Drive \u2014 Upload Clip",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "5. Code \u2014 Extract Clip Data": {
      "main": [
        [
          {
            "node": "6. HTTP \u2014 Download Clip",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "1. Form \u2014 Stream URL + Details1": {
      "main": [
        [
          {
            "node": "2. WayinVideo \u2014 Submit Clipping Task1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "4. WayinVideo \u2014 Get Clips Result1": {
      "main": [
        [
          {
            "node": "5. Code \u2014 Extract Clip Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "2. WayinVideo \u2014 Submit Clipping Task1": {
      "main": [
        [
          {
            "node": "3. Wait \u2014 90 Seconds1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}