# Reddit Search & Comments Scraper (B2B Lead Gen) (`kleioks/reddit-b2b-scraper`) Actor

Ultra-fast Reddit posts, keyword search, and comment trees scraper tailored for B2B lead generation, brand monitoring, and AI buying-intent detection.

- **URL**: https://apify.com/kleioks/reddit-b2b-scraper.md
- **Developed by:** [Akkouch Sofiane](https://apify.com/kleioks) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

<div align="center">

## Reddit B2B Buying-Intent & Comment Tree Engine

**High-availability Reddit search, subreddit monitoring, and top-comment extraction built for B2B lead generation and market intelligence.**

[![Apify Actor](https://img.shields.io/badge/Apify-Verified_Architecture-00C853?style=flat-square)](https://apify.com)
[![Runtime](https://img.shields.io/badge/Runtime-Python_3.12_%7C_HTTP/2-2563EB?style=flat-square)](https://www.python.org/)
[![Failover](https://img.shields.io/badge/Failover-Zero_403_Mirror_Engine-0F172A?style=flat-square)](https://docs.apify.com)
[![Output Format](https://img.shields.io/badge/Output-JSON_%7C_CSV_%7C_Parquet-475569?style=flat-square)](https://docs.apify.com)

</div>

***

### Overview

Reddit is one of the highest-converting channels for B2B intent discovery: buyers openly ask for software alternatives, complain about legacy vendor pricing, and request agency recommendations. However, standard scrapers frequently fail on cloud infrastructure due to datacenter IP blocks (`HTTP 403`).

**Reddit B2B Buying-Intent & Comment Tree Engine** uses a **dual-route HTTP/2 architecture** that queries public Reddit JSON feeds and automatically fails over to synchronized real-time archive mirrors whenever a datacenter block occurs. Every thread is parsed through a deterministic B2B intent classifier and enriched with its top comment tree.

#### Core Capabilities

| Capability | Technical Implementation | B2B Application |
| :--- | :--- | :--- |
| **Dual-Route Anti-403 Failover** | Primary Reddit JSON API + automatic real-time mirror fallback | 100% run reliability without mandatory residential proxy costs |
| **Buying-Intent Classification** | Regex & lexical scoring across post titles, bodies, and comments | Instantly isolate `Alternative Request`, `Tool Recommendation`, and `Pricing / Budget Inquiry` threads |
| **Top-Comment Tree Extraction** | Concurrent retrieval of top-level replies per thread (`topComments`) | Capture competitor mentions, user sentiment, and community recommendations |
| **External Link Harvesting** | Extracts non-Reddit URLs shared inside posts (`externalLinks`) | Track which SaaS tools and landing pages are gaining organic traction |

***

### Input Parameters

| Field | Type | Default | Description |
| :--- | :--- | :--- | :--- |
| `keywords` | `string[]` | `["CRM alternative", "lead generation tool"]` | Search queries or product terms to monitor. |
| `subreddits` | `string[]` | `["SaaS", "sales"]` | Target subreddits (without the `r/` prefix). |
| `sort` | `string` | `"new"` | Sort order: `relevance`, `new`, `hot`, `top`, or `comments`. |
| `timeFilter` | `string` | `"month"` | Time window: `all`, `year`, `month`, `week`, `day`, or `hour`. |
| `includeComments` | `boolean` | `true` | Fetch top comments for each post to analyze full discussion context. |
| `maxCommentsPerPost` | `integer` | `10` | Maximum number of comments fetched per post (`1`–`100`). |
| `maxPosts` | `integer` | `50` | Maximum total number of deduplicated posts returned (`1`–`10000`). |

#### Example Input (`INPUT.json`)

```json
{
  "keywords": [
    "HubSpot alternative",
    "outbound automation",
    "best data enrichment"
  ],
  "subreddits": [
    "SaaS",
    "sales",
    "entrepreneur"
  ],
  "sort": "new",
  "timeFilter": "month",
  "includeComments": true,
  "maxCommentsPerPost": 10,
  "maxPosts": 100
}
```

***

### Output Dataset Schema

| Property | Type | Description |
| :--- | :--- | :--- |
| `postTitle` | `string` | Title of the Reddit submission. |
| `subreddit` | `string` | Subreddit community name. |
| `author` | `string` | Username of the post author. |
| `score` | `integer` | Net upvote score. |
| `commentCount` | `integer` | Total comment count on the thread. |
| `url` | `string` | Direct canonical URL to the Reddit thread. |
| `postId` | `string` | Reddit base-36 submission ID. |
| `createdAt` | `string` | ISO 8601 UTC publication timestamp. |
| `selftext` | `string \| null` | Full plain-text body of the submission. |
| `matchedQuery` | `string \| null` | Subreddit and keyword pair that matched this thread. |
| `hasBuyingIntent` | `boolean` | `true` when one or more B2B buying-intent patterns are detected. |
| `buyingIntentSignals` | `string[]` | Matched intent categories (`Alternative Request`, `Tool Recommendation`, `Pricing / Budget Inquiry`, `Pain Point / Frustration`, `Agency / Service Need`). |
| `externalLinks` | `string[]` | External URLs referenced in the post. |
| `topComments` | `object[]` | Array of structured comments (`commentId`, `author`, `body`, `score`, `createdAt`, `permalink`). |

#### Sample Record

```json
{
  "postTitle": "Looking for a lightweight CRM alternative to HubSpot for a 5-person B2B team",
  "author": "saas_builder_99",
  "score": 42,
  "commentCount": 28,
  "url": "https://www.reddit.com/r/SaaS/comments/1abcxyz/looking_for_a_lightweight_crm_alternative/",
  "subreddit": "SaaS",
  "postId": "1abcxyz",
  "createdAt": "2026-10-30T16:20:05+00:00",
  "selftext": "We are currently paying too much for HubSpot and need a simpler B2B pipeline tool...",
  "matchedQuery": "r/SaaS | q=CRM alternative",
  "buyingIntentSignals": [
    "Alternative Request",
    "Pricing / Budget Inquiry"
  ],
  "hasBuyingIntent": true,
  "externalLinks": [],
  "topComments": [
    {
      "commentId": "lk9912a",
      "author": "revops_lead",
      "body": "We switched to Attio and Close last quarter, highly recommend checking both.",
      "score": 15,
      "createdAt": "2026-10-30T17:02:11+00:00",
      "permalink": "https://www.reddit.com/r/SaaS/comments/1abcxyz/comment/lk9912a/"
    }
  ]
}
```

***

### Integration Example (Python SDK)

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_TOKEN")

run = client.actor("kleioks/reddit-b2b-scraper").call(
    run_input={
        "keywords": ["CRM alternative", "looking for agency"],
        "subreddits": ["SaaS", "sales"],
        "sort": "new",
        "includeComments": True,
        "maxPosts": 50,
    }
)

for post in client.dataset(run["defaultDatasetId"]).iterate_items():
    if post["hasBuyingIntent"]:
        print(f"[{post['subreddit']}] {post['postTitle']} -> {post['url']}")
```

***

### No-Code, Clay, n8n & AI Agent (MCP) Integrations

#### 1. n8n & Make.com Real-Time Social Listening Alerts

1. Schedule the **Apify Node** in **n8n** or **Make.com** to run every 2 hours with `sort: "new"` across your target subreddits (`r/SaaS`, `r/sysadmin`, `r/MSP`, `r/marketing`).
2. Add a filter condition on `hasBuyingIntent == true` (`intentSignals` containing `"alternative to"`, `"recommend a"`, or `"switching from"`).
3. Route matching discussions directly to a dedicated `#buying-intent-signals` **Slack** channel or draft an contextual reply via an LLM node.

#### 2. Clay.com Competitor Churn & Pain-Point Enrichment

Use the synchronous dataset endpoint in Clay's **HTTP API** enrichment to pull recent threads mentioning a competitor's brand name and feed the raw user complaints (`selfText` + `topCommentsText`) into GPT-4o to synthesize hyper-relevant outbound angles:

```
https://api.apify.com/v2/acts/kleioks~reddit-b2b-scraper/run-sync-get-dataset-items?token=YOUR_APIFY_TOKEN
```

#### 3. Model Context Protocol (MCP) for Claude, Cursor & AI Agents

Connect this Actor directly to **Claude Desktop**, **Cursor**, or autonomous research agents using the official Apify MCP server:

```json
{
  "mcpServers": {
    "apify-reddit-b2b": {
      "command": "npx",
      "args": [
        "-y",
        "@apify/actors-mcp-server",
        "--actors",
        "kleioks/reddit-b2b-scraper"
      ],
      "env": {
        "APIFY_TOKEN": "YOUR_APIFY_API_TOKEN"
      }
    }
  }
}
```

***

### Frequently Asked Questions (FAQ)

#### How does this Reddit scraper avoid HTTP 403 and 429 datacenter IP blocks?

Reddit aggressively rate-limits unauthenticated datacenter requests. This Actor implements a **dual-route hybrid architecture**: it queries Reddit's `.json` endpoints with automatic failover to the high-availability **Arctic Shift JSON API (`arctic-shift.photon-reddit.com`)**, ensuring 100% run reliability without requiring expensive residential proxy pools.

#### How can I use Reddit to find B2B SaaS leads and high-intent buyers?

Every extracted post and comment thread is automatically scanned against 16 high-intent B2B purchase patterns (`"looking for"`, `"recommend a"`, `"alternative to"`, `"migrating from"`, `"best tool for"`). By filtering on `hasBuyingIntent: true`, your GTM team engages prospects at the exact moment they are evaluating software vendors.

#### Does this Actor extract both Reddit posts and top comments?

Yes. When `includeComments` is enabled, the Actor concurrently fetches the top discussion comments (`topCommentsText`) and extracts any external company URLs (`extractedDomains`) and public contact emails (`extractedEmails`) shared inside the thread.

***

### Complete B2B Intelligence Suite by Kleioks

Combine this Actor with our specialized B2B data engines on the Apify Store to build end-to-end GTM, RevOps, and market research pipelines:

| Actor | Primary B2B Use Case | Store Link |
| :--- | :--- | :--- |
| **Reddit B2B Buying Intent Scraper** | Monitor competitor churn, software recommendations & high-intent buyer threads on Reddit | [Open on Apify Store](https://apify.com/kleioks/reddit-b2b-scraper) |
| **Google Maps B2B Lead Machine** | High-speed local business lead extractor (phone, website, rating & missing-website signals) | [Open on Apify Store](https://apify.com/kleioks/google-maps-b2b-lead-machine) |
| **Multi-ATS Career Jobs API** | Track real-time hiring intent & tech-stack signals across Greenhouse, Lever, Ashby & Workable | [Open on Apify Store](https://apify.com/kleioks/multi-ats-jobs-scraper) |
| **B2B Social Leads & Intent Extractor** | Discover SaaS founders, developers & decision-makers across Bluesky, GitHub & Hacker News | [Open on Apify Store](https://apify.com/kleioks/b2b-social-leads-scraper) |
| **Influencer & Creator Discovery API** | Extract TikTok, Instagram & YouTube creator profiles, engagement rates & verified PR emails | [Open on Apify Store](https://apify.com/kleioks/influencer-creator-discovery) |
| **Real Estate Market Intelligence API** | Normalized property listings, automated price/m² valuation, DPE ratings & agency contacts | [Open on Apify Store](https://apify.com/kleioks/real-estate-market-scraper) |

# Actor input Schema

## `keywords` (type: `array`):

Keywords or phrases to search across Reddit or within the specified subreddits (e.g. 'CRM alternative', 'best scraping tool', 'looking for agency').

## `subreddits` (type: `array`):

List of subreddits to monitor or search inside (without 'r/', e.g. 'SaaS', 'entrepreneur', 'sales'). If keywords are empty, fetches the feed directly from these subreddits.

## `sort` (type: `string`):

How to sort search results or subreddit feeds.

## `timeFilter` (type: `string`):

Time period filter for search and top sorting.

## `includeComments` (type: `boolean`):

Fetch the top comments for each extracted post to capture user recommendations, pain points, and competitor mentions.

## `maxCommentsPerPost` (type: `integer`):

Maximum number of top comments to extract for each post when comment extraction is enabled.

## `maxPosts` (type: `integer`):

Maximum total number of Reddit posts to extract across the entire run.

## Actor input object example

```json
{
  "keywords": [
    "CRM alternative",
    "lead generation tool"
  ],
  "subreddits": [
    "SaaS",
    "sales"
  ],
  "sort": "new",
  "timeFilter": "month",
  "includeComments": true,
  "maxCommentsPerPost": 10,
  "maxPosts": 50
}
```

# Actor output Schema

## `dataset` (type: `string`):

Normalized Reddit posts, comment trees, and B2B buying-intent metadata.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "keywords": [
        "CRM alternative",
        "lead generation tool"
    ],
    "subreddits": [
        "SaaS",
        "sales"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("kleioks/reddit-b2b-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "keywords": [
        "CRM alternative",
        "lead generation tool",
    ],
    "subreddits": [
        "SaaS",
        "sales",
    ],
}

# Run the Actor and wait for it to finish
run = client.actor("kleioks/reddit-b2b-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "keywords": [
    "CRM alternative",
    "lead generation tool"
  ],
  "subreddits": [
    "SaaS",
    "sales"
  ]
}' |
apify call kleioks/reddit-b2b-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,kleioks/reddit-b2b-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/COL4TCzwylNpO8qwI/builds/yx1F87PYPMjCb2bLV/openapi.json
