AutomationFlowsWeb Scraping › Find Top-performing Instagram Reels & Save Insights to Notion with Gemini &…

Find Top-performing Instagram Reels & Save Insights to Notion with Gemini &…

Original n8n title: Find Top-performing Instagram Reels & Save Insights to Notion with Gemini & Apify

ByEugene Green @egrnkvch on n8n.io

This workflow contains community nodes that are only compatible with the self-hosted version of n8n.

Event trigger★★★★★ complexity36 nodesNotion@Apify/N8N Nodes ApifyHTTP Request
Web Scraping Trigger: Event Nodes: 36 Complexity: ★★★★★ Added:

This workflow corresponds to n8n.io template #5795 — we link there as the canonical source.

This workflow follows the HTTP Request → Notion recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "name": "Reels Trends Watcher",
  "nodes": [
    {
      "id": "e9aad9c8-d2ad-4e17-93cd-a7faa215a06f",
      "name": "When clicking \u2018Execute workflow\u2019",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -640,
        660
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "81d68000-b6bd-42bf-8335-78e753c1f68e",
      "name": "Get Sources",
      "type": "n8n-nodes-base.notion",
      "position": [
        -200,
        660
      ],
      "parameters": {
        "options": {},
        "resource": "databasePage",
        "operation": "getAll",
        "returnAll": true,
        "databaseId": {
          "__rl": true,
          "mode": "list",
          "cachedResultName": "Sources"
        }
      },
      "credentials": {
        "notionApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "d59e57be-ae56-4853-aa56-c0839b5fd6c1",
      "name": "Variables",
      "type": "n8n-nodes-base.code",
      "position": [
        -420,
        660
      ],
      "parameters": {
        "jsCode": "const variables = {\n  // https://apify.com/apify/instagram-scraper \n  // Instagram Scraper = apify/instagram-scraper, \n  \"scrapingActorId\" : \"shu8hvrXbJbY3Eb9W\", // ID of Apify scraper\n  \"daysLimit\" : 7, // Date limit \n  \"resultsLimit\" : 3, // Results per account\n  \"maxDays\" : 2, // Sleeping || Active\n  \"translationLang\" : \"German\",\n}\n\n\nreturn [{json : variables}]"
      },
      "typeVersion": 2
    },
    {
      "id": "9dc6b692-015d-4749-bd77-a91cace88f73",
      "name": "Apify Payload",
      "type": "n8n-nodes-base.code",
      "position": [
        20,
        660
      ],
      "parameters": {
        "jsCode": "// required Simplify = true\n\nconst query = {\n    \"addParentData\": false,\n    \"directUrls\": [],\n    \"enhanceUserSearchWithFacebookPage\": false,\n    \"isUserReelFeedURL\": false,\n    \"isUserTaggedFeedURL\": false,\n    \"onlyPostsNewerThan\": ($('Variables').first().json.daysLimit ?? 10) + ' days',\n    \"resultsLimit\": $('Variables').first().json.resultsLimit ?? 5,\n    \"resultsType\": \"stories\"\n};\n\nconst urls = [];\nconst map = {};\n\nitems.forEach(item => {\n  const username = item.json.property_username || '';\n  if (username) {\n    urls.push('https://www.instagram.com/' + username + '/');\n    map[username.toLowerCase()] = item.json.id;   // Notion pageId\n  }\n});\n\nquery.directUrls = urls;\n\nreturn [\n  {\n    json: {\n      query,\n      urls,\n      map     \n    }\n  }\n];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "70cb78f1-bbc9-4dca-91a6-3d54444689ec",
      "name": "Switch",
      "type": "n8n-nodes-base.switch",
      "position": [
        680,
        600
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "Done",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "96d0046b-c9ab-429e-b35c-3d7518564c1b",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.status }}",
                    "rightValue": "SUCCEEDED"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Running",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "5b1c311d-10cf-4e6f-a55c-f311c75ef444",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $('Get Status').item.json.status }}",
                    "rightValue": "RUNNING"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Ready",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "8376a12a-87c9-4878-b654-1c91fdfb31a2",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $('Get Status').item.json.status }}",
                    "rightValue": "READY"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "43b693cd-9c70-4b2c-a30b-9ec3d01fe809",
      "name": "Wait",
      "type": "n8n-nodes-base.wait",
      "position": [
        900,
        760
      ],
      "parameters": {
        "unit": "minutes",
        "amount": 1
      },
      "typeVersion": 1.1
    },
    {
      "id": "8114cefb-bf4e-4ccd-9d27-b5858bfa4ca9",
      "name": "Get dataset items",
      "type": "@apify/n8n-nodes-apify.apify",
      "position": [
        900,
        540
      ],
      "parameters": {
        "limit": null,
        "resource": "Datasets",
        "datasetId": "={{ $json.defaultDatasetId }}",
        "operation": "Get items"
      },
      "credentials": {
        "apifyApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "2045d552-7cc9-4670-8729-faec32a2bb49",
      "name": "Get Status",
      "type": "@apify/n8n-nodes-apify.apify",
      "position": [
        460,
        660
      ],
      "parameters": {
        "runId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.id }}"
        },
        "resource": "Actor runs",
        "operation": "Get run"
      },
      "credentials": {
        "apifyApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "e3288a62-aae7-4b7d-9081-63daac01219a",
      "name": "Run an Actor",
      "type": "@apify/n8n-nodes-apify.apify",
      "position": [
        240,
        660
      ],
      "parameters": {
        "actorId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Variables').first().json.scrapingActorId }}"
        },
        "operation": "Run actor",
        "customBody": "={{ $json.query.toJsonString() }}",
        "actorSource": "store"
      },
      "credentials": {
        "apifyApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "cb8d08e4-d245-4f6f-a5e3-98860dc4e04d",
      "name": "Update Accounts",
      "type": "n8n-nodes-base.notion",
      "position": [
        1560,
        540
      ],
      "parameters": {
        "pageId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.notionPageId }}"
        },
        "options": {},
        "resource": "databasePage",
        "operation": "update",
        "propertiesUi": {
          "propertyValues": [
            {
              "key": "Status|select",
              "selectValue": "={{ $json.publishingStatus }}"
            },
            {
              "key": "Title|title",
              "title": "={{ $json.ownerFullName }}"
            },
            {
              "key": "URL|url",
              "urlValue": "={{ $json.inputUrl }}"
            }
          ]
        }
      },
      "credentials": {
        "notionApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "950f0ac1-11d9-4673-b751-feea0b623dc9",
      "name": "Get Reels",
      "type": "n8n-nodes-base.notion",
      "position": [
        2000,
        540
      ],
      "parameters": {
        "filters": {
          "conditions": [
            {
              "key": "Date|date",
              "date": "={{ new Date(Date.now() - $('Variables').first().json.daysLimit * 24 * 60 * 60 * 1000).toISOString().split('T')[0] }}",
              "condition": "after"
            }
          ]
        },
        "options": {},
        "resource": "databasePage",
        "operation": "getAll",
        "returnAll": true,
        "databaseId": {
          "__rl": true,
          "mode": "list",
          "cachedResultName": "Reels"
        },
        "filterType": "manual"
      },
      "credentials": {
        "notionApi": {
          "name": "<your credential>"
        }
      },
      "executeOnce": false,
      "typeVersion": 2.2,
      "alwaysOutputData": true
    },
    {
      "id": "52d274fb-3b99-48c7-8338-83ed7537568e",
      "name": "Many to One",
      "type": "n8n-nodes-base.code",
      "position": [
        1780,
        540
      ],
      "parameters": {
        "jsCode": "const accountsMap = {};\n\nitems.forEach(item => {\n  const username = item.json.property_username || '';\n  if (username) {\n    accountsMap[username.toLowerCase()] = item.json.id;   // Notion pageId\n  }\n});\n\nreturn [\n  {\n    json: {\n      accountsMap,\n      items\n    }\n  }\n];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "6e9b25fe-e3ce-4cd4-91f6-4accd65f532b",
      "name": "Code",
      "type": "n8n-nodes-base.code",
      "position": [
        2220,
        540
      ],
      "parameters": {
        "jsCode": "const existingPages = {};\nfor (const page of $items('Get Reels')) {\n  const source = page.json.property_url ?? '';\n  if (source) existingPages[source] = page.json;\n}\n\nconst output = [];\nconst accountsMap = $('Many to One').first().json.accountsMap;\n\nfor (const reel of $items('Map Reels')) {\n\n  const source   = reel.json.url;          \n\n  const views = reel.json.videoViewCount;\n  var update = {\n    \"Code\": reel.json.shortCode,\n    \"SignedCode\": reel.json.shortCode + '-' + Math.random(),\n    \"IsCreated\" : false,\n    \"notionAccountPageId\" : accountsMap[ reel.json.ownerUsername.toLowerCase() ],\n          \"Views\"       : views ? views : reel.json.videoPlayCount,\n          \"Likes\"       : reel.json.likesCount,\n          \"Comments\"    : reel.json.commentsCount,\n          \"Saves\"       : reel.json.savesCount ?? 0,\n          \"Shares\"      : reel.json.sharesCount ?? 0,\n          \"Updated\"   : new Date().toISOString()\n  };\n\n  /* ------------------------------------------------- */\n  if (existingPages[source]) {\n    \n    update.notionPageId = existingPages[source].id;\n\n  } else {\n    update['IsCreated'] = true;\n    update['Caption'] = reel.json.caption;\n    update['URL'] = reel.json.url;\n    update['Hashtags'] = reel.json.hashtags.join(', ');\n    update['Duration'] = reel.json.videoDuration;\n    update['Date'] = reel.json.timestamp;\n    update['videoUrl'] = reel.json.videoUrl;\n    \n  }\n\n  output.push({json: update});\n}\n\nreturn output;   // n8n continues with one array containing both kinds of items\n"
      },
      "typeVersion": 2
    },
    {
      "id": "242b65f6-a180-4795-b18f-c0b3278dbc3d",
      "name": "Map Reels",
      "type": "n8n-nodes-base.code",
      "position": [
        1120,
        540
      ],
      "parameters": {
        "jsCode": "const maxDays = $('Variables').first()?.json?.maxDays ?? 3;  \nconst now     = new Date();\n\n\nvar results = items;                             \nconst map   = $('Apify Payload').first().json.map;\n\n\nconst acctStatus = {};   // { username: 'Active' | 'Sleeping' }\n\nfor (const itm of results) {\n  const owner = itm.json.ownerUsername.toLowerCase();\n  const ts    = new Date(itm.json.timestamp);\n  const diff  = (now - ts) / 86_400_000;    \n\n  \n  if (!acctStatus[owner] || acctStatus[owner] === 'Sleeping') {\n    acctStatus[owner] = diff <= maxDays ? 'Active' : 'Sleeping';\n  }\n}\n\nfor (const k in results) {\n  const item   = results[k];\n  const owner  = item.json.ownerUsername.toLowerCase();\n\n  // coauthorProducers - !notionPageId\n  item.json.notionPageId     = map[owner];\n  item.json.publishingStatus = acctStatus[owner];\n\n  results[k] = item;\n}\n\nreturn results;\n"
      },
      "typeVersion": 2
    },
    {
      "id": "f6ce6734-6bbf-451b-bc8b-e73fcad9eaac",
      "name": "Create",
      "type": "n8n-nodes-base.notion",
      "onError": "continueRegularOutput",
      "position": [
        1800,
        1360
      ],
      "parameters": {
        "title": "={{ ($json.response.hook ?? $json.Caption).substring(0, 50) }}",
        "options": {},
        "resource": "databasePage",
        "databaseId": {
          "__rl": true,
          "mode": "list",
          "cachedResultName": "Reels"
        },
        "propertiesUi": {
          "propertyValues": [
            {
              "key": "Date|date",
              "date": "={{ $json.Date }}"
            },
            {
              "key": "Caption|rich_text",
              "textContent": "={{ $json.Caption.substring(0, 1995) }}"
            },
            {
              "key": "Duration|number",
              "numberValue": "={{ $json.Duration }}"
            },
            {
              "key": "Likes|number",
              "numberValue": "={{ $json.Likes }}"
            },
            {
              "key": "Parsed Date|date",
              "date": "={{ $now }}"
            },
            {
              "key": "URL|url",
              "urlValue": "={{ $json.URL }}"
            },
            {
              "key": "Views|number",
              "numberValue": "={{ $json.Views }}"
            },
            {
              "key": "Comments|number",
              "numberValue": "={{ $json.Comments }}"
            },
            {
              "key": "Author|relation",
              "relationValue": [
                "={{ $json.notionAccountPageId }}"
              ]
            },
            {
              "key": "Content|rich_text",
              "textContent": "=### HOOK ###\n{{ $json.response.hook }}\n\n### CONTENT ###\n{{ $json.response.transcription.substring(0, 1800) }}"
            },
            {
              "key": "Translation|rich_text",
              "textContent": "=### HOOK ###\n{{ $json.response.translation_hook }}\n\n### CONTENT ###\n{{ $json.response.translation.substring(0, 1800) }}"
            },
            {
              "key": "Type|select",
              "selectValue": "={{ $json.response.format }}"
            },
            {
              "key": "Category|select",
              "selectValue": "={{ $json.response.category }}"
            }
          ]
        }
      },
      "credentials": {
        "notionApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "4f840157-aa84-4e1d-bc01-743b2846e733",
      "name": "Update",
      "type": "n8n-nodes-base.notion",
      "position": [
        60,
        1620
      ],
      "parameters": {
        "pageId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.notionPageId }}"
        },
        "options": {},
        "resource": "databasePage",
        "operation": "update",
        "propertiesUi": {
          "propertyValues": [
            {
              "key": "Comments|number",
              "numberValue": "={{ $json.Comments }}"
            },
            {
              "key": "Likes|number",
              "numberValue": "={{ $json.Likes }}"
            },
            {
              "key": "Views|number",
              "numberValue": "={{ $json.Views }}"
            }
          ]
        }
      },
      "credentials": {
        "notionApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "3cf91952-47b1-4bd9-9b3d-95a0b847a4cc",
      "name": "Download Video",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        40,
        1220
      ],
      "parameters": {
        "url": "={{ $json.videoUrl }}",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "4afd4b50-bb64-4135-9d7a-b4e2da533370",
      "name": "Upload to Gemini",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        260,
        1220
      ],
      "parameters": {
        "url": "https://generativelanguage.googleapis.com/upload/v1beta/files",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "binaryData",
        "authentication": "predefinedCredentialType",
        "inputDataFieldName": "data",
        "nodeCredentialType": "googlePalmApi"
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        },
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "be95f2a7-fd68-472d-b1e9-e7f47e16f61d",
      "name": "Gemini Analyze",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1360,
        1220
      ],
      "parameters": {
        "url": "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n\t\"contents\": [{\n\t\t\"parts\": [{\n\t\t\t\"file_data\": {\n\t\t\t\t\"file_uri\": \"{{ $('Is Uploaded And Active?').item.json.uri }}\",\n\t\t\t\t\"mime_type\": \"{{ $('Is Uploaded And Active?').item.json.mimeType }}\"\n\t\t\t}\n\t\t}, {\n\t\t\t\"text\": \"{{ $('Set Prompt').first().json.AnalyzePrompt.replaceAll(\"\\n\", '\\\\n').replaceAll('\"', '\\\"\"') }}\"\n\t\t}]\n\t}]\n}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "googlePalmApi"
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        },
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "d8a3b6c8-dfab-4d12-ac66-dacf23c379f5",
      "name": "Is Uploaded And Active?",
      "type": "n8n-nodes-base.if",
      "position": [
        920,
        1220
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "8cf67b24-2993-4aed-be9d-00b88a1c5701",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.state }}",
              "rightValue": "ACTIVE"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "849c07c0-c0c9-42bf-94a7-0bb794a8bbdc",
      "name": "Get File State",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        700,
        1160
      ],
      "parameters": {
        "url": "={{ $json.file.uri }}",
        "options": {},
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "googlePalmApi"
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        },
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "bd77d983-4f7a-4330-b461-dd0ebc6223e8",
      "name": "Processing Delay",
      "type": "n8n-nodes-base.wait",
      "position": [
        480,
        1220
      ],
      "parameters": {
        "unit": "minutes",
        "amount": 1
      },
      "typeVersion": 1.1
    },
    {
      "id": "36dce35b-d983-4a45-9617-ac1254f5c77c",
      "name": "Format Response",
      "type": "n8n-nodes-base.code",
      "position": [
        1580,
        1220
      ],
      "parameters": {
        "jsCode": "\nconst rawText = $input.first().json.candidates[0].content.parts[0].text;\n\nconst cleaned = rawText\n  .replace(/^```json\\s*/, '')      \n  .replace(/\\s*```$/, '')          \n  .trim();\n\nlet parsed;\ntry {\n  parsed = JSON.parse(cleaned);\n} catch (e) {\n  return [{ json: { error: 'Invalid JSON', message: e.message } }];\n}\n\nlet item = $('Is Created?').first().json;\n\nparsed.transcription = parsed.transcription ?? '';\nparsed.hook = parsed.hook ?? '';\nparsed.category = parsed.category ?? '';\nparsed.format = parsed.format ?? '';\nparsed.translation = parsed.translation ?? '';\nparsed.translation_hook = parsed.translation_hook ?? '';\n\nitem.response = parsed;\n\n\nreturn [{ json: item }];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "913daa8b-e3c5-48d9-8f1c-16746a847564",
      "name": "Set Prompt",
      "type": "n8n-nodes-base.set",
      "position": [
        1160,
        1240
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "01c3ca92-795f-4528-8df5-204c324c352b",
              "name": "AnalyzePrompt",
              "type": "string",
              "value": "=Perform the following tasks based on the video/audio content:\n\n1. Create a full transcription of the audio \u2014 convert speech to text exactly as spoken, without interpretation or summarization, so it can be easily read or re-voiced later.\n\n2. Identify a strong hook from the first few seconds of the content that can grab attention.\n\n3. Determine the category of the content using the following rules:\n- Business: if the video shares business advice\n- Marketing: if the video shares marketing advice\n- Cooking: if the video shares cooking advice\n- Interview: if the video is an interview with a guest\n- Unknown: if the category cannot be determined\n\n4. Identify the video format using the following options:\n- Head: if it's a talking-head video\n- Animation: if it's animated or presented with drawings\n- Unknown: if the format is unclear\n\n5. Translate the full transcription and the hook into {{ $('Variables').first().json.translationLang }}.\n\nReturn the result in **pure JSON format** with the following fields:  \n`transcription`, `hook`, `category`, `format`, `translation`, `translation_hook`.\n\n**Do not include any commentary or explanations. Only return the JSON.**"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "f623358c-c051-4cf6-9922-1cbf1f944d7b",
      "name": "Owner?",
      "type": "n8n-nodes-base.if",
      "position": [
        1340,
        540
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "7b88be8b-60c6-47b1-8a6a-4f5b97d71234",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.notionPageId }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "6ef695e9-6e2d-4bea-bfb8-ba559e6a803e",
      "name": "Is Created?",
      "type": "n8n-nodes-base.switch",
      "position": [
        -180,
        1300
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "Create",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "bed205cb-cc58-4f99-af5e-7565257ea7c4",
                    "operator": {
                      "type": "boolean",
                      "operation": "true",
                      "singleValue": true
                    },
                    "leftValue": "={{ $json.IsCreated && $json.notionAccountPageId != null }}",
                    "rightValue": ""
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Update",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "042c2e67-6f4d-4909-a73d-eb43864203dd",
                    "operator": {
                      "type": "boolean",
                      "operation": "true",
                      "singleValue": true
                    },
                    "leftValue": "={{ !$json.IsCreated && $json.notionAccountPageId != null }}",
                    "rightValue": ""
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "5b97e7c8-9637-4763-ad8c-53a086ddc8fd",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -400,
        1400
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "635e329a-dda0-40d6-96d1-e7b384ec841b",
      "name": "Stats",
      "type": "n8n-nodes-base.code",
      "position": [
        -180,
        1100
      ],
      "parameters": {
        "jsCode": "// Loop over input items and add a new field called 'myNewField' to the JSON of each one\nfor (const item of $input.all()) {\n  item.json.myNewField = 1;\n}\n\nreturn $input.all();"
      },
      "typeVersion": 2
    },
    {
      "id": "261dc20e-b593-440b-b002-f6d1cbfbfcc0",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -640,
        440
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 4
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "5d8a6022-16bc-4211-b596-089655921209",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1320,
        -220
      ],
      "parameters": {
        "color": 7,
        "width": 520,
        "height": 360,
        "content": "### \ud83d\udcfa How It Works \u2013 Watch the Video  \nI've recorded a video walkthrough to show you how the system works in detail.\n\ud83d\udc49 [https://www.youtube.com/watch?v=rdfRNHpHX8o](https://www.youtube.com/watch?v=rdfRNHpHX8o)\n\n\n### \ud83d\udcc4 Download Notion Database Structure  \nYou can download the Notion table structure (with all required columns and formats) here:  \n\ud83d\udc49 [https://drive.google.com/file/d/1FVaS_-ztp6PDAJbETUb1dkg8IqE4qHqp/view?usp=sharing](https://drive.google.com/file/d/1FVaS_-ztp6PDAJbETUb1dkg8IqE4qHqp/view?usp=sharing)\n\n### \u2615 Support the Project  \nIf you'd like to support my work, there's a version with tips available here:\n\ud83d\udc49 [Coffee + Sandwich Version](https://gr.egrnkvch.com/l/InstagramReelsTrendWatcher)\n"
      },
      "typeVersion": 1
    },
    {
      "id": "b7c81e9f-5d71-4ce1-b6b0-585245e0eb90",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -740,
        -220
      ],
      "parameters": {
        "color": 7,
        "width": 520,
        "height": 580,
        "content": "## \u2699\ufe0f How to Install the Template\n\n1. **Create the databases in Notion.**  \n   Make sure to use the exact column names and formats as shown in the provided structure.\n\n2. **Import the workflow template into n8n.**\n\n3. **Add your Credentials:**\n   - **Notion**: Standard Notion integration  \n   - **Apify**: Create and connect your Apify API key\n\n4. **Gemini API is used via HTTP Request node.**  \n   Use the following settings:  \n   - `Authentication`: **Predefined Credential Type**  \n   - `Credential Type`: **Google Gemini (PaLM) API**  \n   - `Host`: `https://generativelanguage.googleapis.com`  \n   - API key: your personal Gemini API key\n\n5. **Assign these credentials** in the corresponding nodes inside the workflow.\n\n6. **Configure the Variables node** to set parsing parameters.  \n   Test the process with 3\u20135 accounts, each with 3\u20135 Reels.  \n   Once everything works, update the Variables with your full settings.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "af4c205f-6a9c-493f-861d-bda18d346cf5",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1320,
        200
      ],
      "parameters": {
        "color": 7,
        "width": 520,
        "height": 140,
        "content": "### \ud83d\udcfa Video Guide\n\ud83d\udc49 [https://www.youtube.com/watch?v=rdfRNHpHX8o](https://www.youtube.com/watch?v=rdfRNHpHX8o)\n\n@[youtube](rdfRNHpHX8o)"
      },
      "typeVersion": 1
    },
    {
      "id": "5acb33a7-5bc2-439f-a648-450fe97073eb",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -240,
        560
      ],
      "parameters": {
        "width": 180,
        "height": 80,
        "content": "Database = Sources"
      },
      "typeVersion": 1
    },
    {
      "id": "aa226eb7-84f5-41cc-87dd-a18d163ddf8b",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1960,
        420
      ],
      "parameters": {
        "width": 180,
        "height": 80,
        "content": "Database = Reels"
      },
      "typeVersion": 1
    },
    {
      "id": "4efaf2ee-ef7a-4f72-88cc-12eae7210b1b",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1780,
        1260
      ],
      "parameters": {
        "width": 180,
        "height": 80,
        "content": "Database = Reels"
      },
      "typeVersion": 1
    },
    {
      "id": "c641b324-a620-4cf8-a8ec-1b821b942425",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1080,
        1080
      ],
      "parameters": {
        "width": 300,
        "height": 100,
        "content": "This is the prompt used to process video content and classify its category and type. Customize it based on your logic."
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "Code": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "Get Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "Owner?": {
      "main": [
        [
          {
            "node": "Update Accounts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "Get dataset items",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Reels": {
      "main": [
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Map Reels": {
      "main": [
        [
          {
            "node": "Owner?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Variables": {
      "main": [
        [
          {
            "node": "Get Sources",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Status": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Prompt": {
      "main": [
        [
          {
            "node": "Gemini Analyze",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Sources": {
      "main": [
        [
          {
            "node": "Apify Payload",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Is Created?": {
      "main": [
        [
          {
            "node": "Download Video",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Update",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Many to One": {
      "main": [
        [
          {
            "node": "Get Reels",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Run an Actor": {
      "main": [
        [
          {
            "node": "Get Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Apify Payload": {
      "main": [
        [
          {
            "node": "Run an Actor",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download Video": {
      "main": [
        [
          {
            "node": "Upload to Gemini",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gemini Analyze": {
      "main": [
        [
          {
            "node": "Format Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get File State": {
      "main": [
        [
          {
            "node": "Is Uploaded And Active?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Response": {
      "main": [
        [
          {
            "node": "Create",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [
          {
            "node": "Stats",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Is Created?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Accounts": {
      "main": [
        [
          {
            "node": "Many to One",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Processing Delay": {
      "main": [
        [
          {
            "node": "Get File State",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        []
      ]
    },
    "Upload to Gemini": {
      "main": [
        [
          {
            "node": "Processing Delay",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get dataset items": {
      "main": [
        [
          {
            "node": "Map Reels",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Is Uploaded And Active?": {
      "main": [
        [
          {
            "node": "Set Prompt",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Processing Delay",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking \u2018Execute workflow\u2019": {
      "main": [
        [
          {
            "node": "Variables",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

This workflow contains community nodes that are only compatible with the self-hosted version of n8n.

Source: https://n8n.io/workflows/5795/ — original creator credit. Request a take-down →

More Web Scraping workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

Web Scraping

This n8n workflow collects leads from Google Maps, scrapes their websites via direct HTTP requests, and extracts valid email addresses — all while mimicking real user behavior to improve scraping reli

Form Trigger, @Apify/N8N Nodes Apify, HTTP Request +1
Web Scraping

PDF convert. Uses n8n-nodes-pdfco, httpRequest, gmail, n8n-nodes-pdfkit. Event-driven trigger; 19 nodes.

N8N Nodes Pdfco, HTTP Request, Gmail +2
Web Scraping

This n8n template demonstrates how to automatically clone and adapt competitor Facebook ads for your own product using AI. Simply provide a Facebook Ad Library URL and your product image, and the work

Form Trigger, HTTP Request, Google Drive +1
Web Scraping

This workflow is Part 2 of the HR Client Acquisition system and builds on the lead discovery pipeline from the previous workflow:

Google Sheets, HTTP Request, OpenAI +2
Web Scraping

Community nodes are used in this workflow. B2B Sales Teams & SDRs Recruitment Agencies & Tech Recruiters Startup Founders Growth Marketing Teams Scrape Hiring Signals: The workflow starts by using an

Google Sheets, Google Gemini Chat, Output Parser Structured +3