{
  "name": "Blumify — transcribe a link",
  "nodes": [
    {
      "parameters": {},
      "id": "0b8a6c3e-1f0a-4c55-9c1d-6a1f2b3c4d01",
      "name": "When clicking ‘Execute workflow’",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [0, 0]
    },
    {
      "parameters": {
        "url": "https://blumify.io/api/media/v1/transcribe",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            { "name": "url", "value": "https://www.youtube.com/watch?v=dQw4w9WgXcQ" },
            { "name": "summarize", "value": "1" }
          ]
        },
        "options": {
          "response": { "response": { "responseFormat": "text", "outputPropertyName": "stream" } },
          "timeout": 1800000
        }
      },
      "id": "0b8a6c3e-1f0a-4c55-9c1d-6a1f2b3c4d02",
      "name": "Blumify: transcribe",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [240, 0]
    },
    {
      "parameters": {
        "jsCode": "// The answer is a Server-Sent Events stream; the last event is `done` (the\n// transcript, summary and notes) or `error` ({code, message}).\nconst text = $input.first().json.stream || '';\nconst events = text.split(/\\r?\\n\\r?\\n/).map((block) => {\n  const name = (block.match(/^event: (.*)$/m) || [])[1];\n  const data = block.split(/\\r?\\n/).filter((l) => l.startsWith('data: ')).map((l) => l.slice(6)).join('\\n');\n  return { name, data };\n});\nconst last = events.reverse().find((e) => e.name === 'done' || e.name === 'error');\nif (!last) throw new Error('Blumify sent no result. Run the workflow again to join the same job.');\nconst body = JSON.parse(last.data);\nif (last.name === 'error') throw new Error(`Blumify: ${body.code}: ${body.message}`);\nreturn [{ json: {\n  title: body.metadata.title,\n  permalink: body.permalink,\n  source: body.source,\n  summary: body.summary,\n  key_points: body.key_points,\n  chapters: body.chapters,\n  transcript: body.segments.map((s) => s.text).join(' '),\n  segments: body.segments,\n} }];"
      },
      "id": "0b8a6c3e-1f0a-4c55-9c1d-6a1f2b3c4d03",
      "name": "Read the result",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [480, 0]
    }
  ],
  "connections": {
    "When clicking ‘Execute workflow’": { "main": [[{ "node": "Blumify: transcribe", "type": "main", "index": 0 }]] },
    "Blumify: transcribe": { "main": [[{ "node": "Read the result", "type": "main", "index": 0 }]] }
  },
  "settings": { "executionOrder": "v1" },
  "meta": { "templateCredsSetupCompleted": true }
}
