# Reddit Profile Scraper (`codingfrontend/reddit-profile-scraper`) Actor

Scrape Reddit user profiles by username or profile URL — including karma, bio, avatar, account age, and optional recent posts and comments.

- **URL**: https://apify.com/codingfrontend/reddit-profile-scraper.md
- **Developed by:** [Coding Frontned](https://apify.com/codingfrontend) (community)
- **Categories:** Social media, Lead generation, Automation
- **Stats:** 10 total users, 3 monthly users, 75.2% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $4.99 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

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

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Reddit Profile Scraper

Scrape public Reddit user profiles by username or public profile URL. The Actor records karma, account metadata, trophies, optional recent activity, and provenance in the default dataset.

### Features

- Structured profile records suitable for analysis and export.
- Optional recent public submissions and comments with a bounded per-profile limit.
- Ordinary Chrome and Crawlee execution with one concurrent profile request and browser fingerprinting disabled.
- Fail-closed handling for blocked, unavailable, or incomplete public responses.

### Input

| Field | Type | Default | Required | Description |
|-------|------|---------|----------|-------------|
| `usernames` | array of strings | none | yes | Reddit usernames without `u/`, or public profile URLs. |
| `includeRecentPosts` | boolean | `false` | no | Include recent public submissions. |
| `includeRecentComments` | boolean | `false` | no | Include recent public comments. |
| `maxRecentItems` | integer | `25` | no | Maximum recent posts or comments per profile, bounded to 1-100. |
| `headless` | boolean | `true` | no | Run the browser without a visible window. |
| `proxyConfiguration` | object | standard Apify proxy | no | Optional permitted Apify proxy configuration; set `useApifyProxy` to `false` for direct access. |

The Actor accepts 1-100 profiles, validates Reddit profile URLs, and deduplicates usernames case-insensitively before starting Chrome. It uses public Reddit responses without relying on a protected login session. If Reddit returns a CAPTCHA, login wall, rate limit, WAF response, or other access denial, the request is recorded in `OUTPUT` only and is not counted or charged as a successful dataset profile.

### Output

Each successful dataset item contains the following top-level groups:

- Profile identity: `profileId`, `username`, `profileUrl`, `sourceProfileUrl`, and `requestedUsername`.
- Account data: karma fields, `createdAt`, `accountAgeDays`, account flags, `subscribers`, `bio`, `avatar`, and `bannerImg`.
- Activity: `trophies`, and optionally `recentPosts` and `recentComments`.
- Run metadata: request flags, `maxRecentItems`, `extractionMethod`, proxy/fingerprint flags, `rawProfile`, and `scrapedAt`.

#### Sample output

```json
{
  "recordType": "profile",
  "username": "example_user",
  "profileUrl": "https://www.reddit.com/user/example_user/",
  "commentKarma": 1234,
  "linkKarma": 5678,
  "totalKarma": 6912,
  "createdAt": "2020-01-02T03:04:05.000Z",
  "accountAgeDays": 1460,
  "isGold": false,
  "isMod": false,
  "isEmployee": false,
  "hasVerifiedEmail": true,
  "isSuspended": false,
  "acceptFollowers": true,
  "subscribers": 250,
  "bio": "Example public profile description.",
  "trophies": [],
  "sourceProfileUrl": "https://www.reddit.com/user/example_user/",
  "requestedUsername": "example_user",
  "includeRecentPosts": false,
  "includeRecentComments": false,
  "maxRecentItems": 25,
  "extractionMethod": "old-reddit-profile-html",
  "proxyConfigured": true,
  "fingerprintApplied": true,
  "scrapedAt": "2024-02-03T04:05:06.000Z"
}
```

### Run summary and storage

Each successful dataset row has recordType profile. The Actor stores one JSON run summary in the default key-value store under the key OUTPUT with normalized usernames, activity settings, proxy/browser state, saved profiles, failed and blocked requests, and availability. A fail-closed run uses recordType runDiagnostic and includes its message.

### Local validation

Install dependencies, run the unit suite, and validate a populated local dataset:

```text
npm test
npm run validate:dataset
```

The dataset validator reads `APIFY_LOCAL_STORAGE_DIR` when it is set, otherwise it reads the local `storage/datasets/default` directory. It requires at least one complete profile, rejects duplicates, and verifies canonical URLs, timestamps, types, bounded activity, and karma consistency. Diagnostics remain in the `OUTPUT` key so pay-per-result runs do not charge for failed profiles.

### Notes

- Use a permitted public network path and respect Reddit's terms and rate limits.
- No login, private endpoint, session replay, randomized user-agent, fingerprint modification, CAPTCHA bypass, or access-denial bypass is performed.
- A run with no usable profile records fails instead of reporting a false success.

# Actor input Schema

## `usernames` (type: `array`):

List of Reddit usernames to scrape (without u/). Can also provide full profile URLs.

## `includeRecentPosts` (type: `boolean`):

Fetch the user's recent submitted posts (up to maxRecentItems)

## `includeRecentComments` (type: `boolean`):

Fetch the user's recent comments (up to maxRecentItems)

## `maxRecentItems` (type: `integer`):

Maximum number of recent posts or comments to fetch per user

## `headless` (type: `boolean`):

Run browser in headless mode (recommended for production)

## `proxyConfiguration` (type: `object`):

Proxy settings. Apify Residential proxy recommended to avoid Reddit rate limits.

## Actor input object example

```json
{
  "usernames": [
    "spez"
  ],
  "includeRecentPosts": false,
  "includeRecentComments": false,
  "maxRecentItems": 25,
  "headless": true,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

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

URL of the default dataset items endpoint.

## `runSummary` (type: `string`):

Profile inputs, activity settings, saved records, failures, and public-data availability.

# 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 = {
    "usernames": [
        "spez"
    ],
    "includeRecentPosts": false,
    "includeRecentComments": false,
    "headless": true
};

// Run the Actor and wait for it to finish
const run = await client.actor("codingfrontend/reddit-profile-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 = {
    "usernames": ["spez"],
    "includeRecentPosts": False,
    "includeRecentComments": False,
    "headless": True,
}

# Run the Actor and wait for it to finish
run = client.actor("codingfrontend/reddit-profile-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 '{
  "usernames": [
    "spez"
  ],
  "includeRecentPosts": false,
  "includeRecentComments": false,
  "headless": true
}' |
apify call codingfrontend/reddit-profile-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,codingfrontend/reddit-profile-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/QHDutl6NTVI2pUIgm/builds/Oa8IsKVhkN2Hl2Zrb/openapi.json
