{
  "name": "Reddit Multi-Mode Scraper for Posts, Comments & Profiles (long runs)",
  "nodes": [
    {
      "id": "41093516-3977-4d01-a5ba-3158eafed4c3",
      "name": "Run by hand",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        0,
        0
      ],
      "parameters": {}
    },
    {
      "id": "eb294766-3235-4c0b-aaa1-1052ef4f1d4b",
      "name": "Every day",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        0,
        200
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 8
            }
          ]
        }
      },
      "notes": "Activate the workflow to run on this schedule."
    },
    {
      "id": "ee58e472-0af6-4562-a1d1-aeb7397250cb",
      "name": "Start Apify run",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        260,
        100
      ],
      "parameters": {
        "method": "POST",
        "url": "https://api.apify.com/v2/actors/nimbryxo-studio~reddit-multi-mode-scraper-for-posts-comments/runs?waitForFinish=60",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "{\n  \"mode\": \"subreddit\",\n  \"source\": \"archive\",\n  \"subreddits\": [\n    \"programming\"\n  ],\n  \"maxItems\": 2,\n  \"maxPosts\": 2,\n  \"maxComments\": 5,\n  \"maxDepth\": 6,\n  \"includeComments\": false,\n  \"includePost\": true,\n  \"sort\": \"hot\",\n  \"timeFilter\": \"day\",\n  \"commentSort\": \"confidence\",\n  \"includeNSFW\": false,\n  \"includeSubredditInfo\": false,\n  \"includeSubredditRules\": false,\n  \"includeProfileInfo\": true,\n  \"sections\": [\n    \"posts\"\n  ],\n  \"searchPosts\": true,\n  \"searchComments\": false,\n  \"searchCommunities\": false,\n  \"searchUsers\": false,\n  \"maxCommunities\": 0,\n  \"maxUsers\": 0,\n  \"onlyNew\": false,\n  \"stateKey\": \"reddit-mcp-state\",\n  \"failOnEmpty\": false,\n  \"maxProxyBytesMb\": 50,\n  \"proxyMode\": \"none\",\n  \"excludeStickied\": false,\n  \"excludeRemoved\": false,\n  \"excludeCrossposts\": false,\n  \"excludeSpoilers\": false,\n  \"excludeLocked\": false,\n  \"excludeDeletedAuthor\": false,\n  \"excludeArchived\": false,\n  \"onlyWithFlair\": false,\n  \"onlyOriginalContent\": false\n}",
        "options": {
          "timeout": 90000
        }
      },
      "notes": "Actor: nimbryxo-studio/reddit-multi-mode-scraper-for-posts-comments. Starts the run and waits up to 60 s for it. Header Auth credential: name Authorization, value Bearer + your Apify token."
    },
    {
      "id": "d99e420e-674d-43ff-af8d-88b2adfa0be3",
      "name": "Run finished?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        520,
        100
      ],
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "bdaed00e-a976-401d-a3fa-272c8a0c3dab",
              "leftValue": "={{ ['SUCCEEDED', 'FAILED', 'ABORTED', 'TIMED-OUT'].includes($json.data.status) }}",
              "rightValue": "",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      }
    },
    {
      "id": "63d47a42-8793-4cc2-a807-3297e29c25ff",
      "name": "Check the run again",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        520,
        320
      ],
      "parameters": {
        "method": "GET",
        "url": "=https://api.apify.com/v2/actor-runs/{{ $json.data.id }}?waitForFinish=60",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "options": {
          "timeout": 90000
        }
      },
      "notes": "Waits up to 60 s per check, then loops back."
    },
    {
      "id": "74d01146-3459-4e99-abdf-483031943ee3",
      "name": "Run succeeded?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        780,
        0
      ],
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "76e61a56-75c7-448b-a17f-90ae2f893feb",
              "leftValue": "={{ $json.data.status === 'SUCCEEDED' }}",
              "rightValue": "",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      }
    },
    {
      "id": "f227b6ca-e605-4816-a866-662fb364a6d7",
      "name": "Get the results",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1040,
        -100
      ],
      "parameters": {
        "method": "GET",
        "url": "=https://api.apify.com/v2/datasets/{{ $json.data.defaultDatasetId }}/items?clean=true",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "options": {
          "timeout": 120000
        }
      },
      "notes": "Each record of the run's dataset becomes one n8n item. Connect your destination after this node."
    },
    {
      "id": "08a40fb6-0403-4553-aa26-ad6eb5a51d63",
      "name": "Run did not succeed",
      "type": "n8n-nodes-base.stopAndError",
      "typeVersion": 1,
      "position": [
        1040,
        100
      ],
      "parameters": {
        "errorMessage": "={{ 'Apify run ' + $json.data.id + ' ended with status ' + $json.data.status }}"
      }
    },
    {
      "id": "3e4a8666-1d43-41ff-ac8c-377aa7c4d4ab",
      "name": "Setup",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        0,
        -400
      ],
      "parameters": {
        "content": "## Reddit Multi-Mode Scraper for Posts, Comments & Profiles: long runs\n\nSource: [nimbryxo-studio/reddit-multi-mode-scraper-for-posts-comments](https://apify.com/nimbryxo-studio/reddit-multi-mode-scraper-for-posts-comments) on Apify.\n\nFor runs that need more than 5 minutes (the synchronous endpoint answers HTTP 408 after 300 s).\n1. Select the same Header Auth credential (name `Authorization`, value `Bearer YOUR_APIFY_TOKEN`) in the three HTTP Request nodes.\n2. Edit the JSON body of **Start Apify run** to change the input.\n3. Connect your destination after **Get the results**.\n\nGenerated by recipeforagents.com. Validated, not executed: runs are billed to your Apify account.",
        "height": 360,
        "width": 500,
        "color": 6
      }
    }
  ],
  "connections": {
    "Run by hand": {
      "main": [
        [
          {
            "node": "Start Apify run",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Every day": {
      "main": [
        [
          {
            "node": "Start Apify run",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Start Apify run": {
      "main": [
        [
          {
            "node": "Run finished?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Run finished?": {
      "main": [
        [
          {
            "node": "Run succeeded?",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Check the run again",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check the run again": {
      "main": [
        [
          {
            "node": "Run finished?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Run succeeded?": {
      "main": [
        [
          {
            "node": "Get the results",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Run did not succeed",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "meta": {
    "templateCredsSetupCompleted": false
  },
  "tags": []
}
