# Lemmy Scraper - Posts, Comments & Communities (`pinkish_gallop/lemmy-scraper`) Actor

Scrape public Lemmy communities on any instance via the official /api/v3: posts with score and comment counts, threaded comments, community stats and post search. Since-date for incremental runs. The Reddit-alternative data source, no login or proxy.

- **URL**: https://apify.com/pinkish_gallop/lemmy-scraper.md
- **Developed by:** [Sai](https://apify.com/pinkish_gallop) (community)
- **Categories:** Social media, Lead generation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event

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

## Lemmy Scraper - Posts, Comments & Communities

Scrape public Lemmy communities on any instance via the official /api/v3: posts with score and comment counts, threaded comments, community stats and post search. Since-date for incremental runs. The Reddit-alternative data source, no login or proxy.

### What does this Actor do?

Lemmy is the leading open-source, federated Reddit alternative, with large communities on lemmy.world, lemmy.ml, programming.dev and hundreds of other servers. This Actor uses Lemmy's official **/api/v3** to export posts, threaded comments and community statistics from any public instance - no login, no API key and no browser.

Key features:

- Plain HTTP against official public endpoints - no browser, no proxy, no login, runs on 128 MB memory.
- Pay only for results: one charge per row saved; your maximum charge per run is always respected.
- `maxItems` hard cap (default 100) and bounded pagination - runs can never loop forever.
- Incremental mode via a since-date so scheduled runs only fetch new data.
- Polite rate limiting, retries with exponential backoff and `Retry-After` support.
- Clean, flat, consistently named JSON fields ready for Excel, Google Sheets, BigQuery or your API.

### Who is it for?

- **Community and brand monitoring** - track mentions in technology, privacy, gaming or self-hosting communities.
- **Market and product research** - mine discussions for pain points and feature requests.
- **NLP datasets** - collect posts and comments with scores for sentiment and ranking models.
- **Moderation and analytics** - measure community growth, activity and engagement over time.
- **Reddit-to-fediverse comparison** - collect the same topics across platforms.

### How it works

For each community the Actor reads `/community` for stats (a free metadata row), then pages through `/post/list` 50 posts at a time (supporting both page numbers and the newer cursor pagination). With comments enabled it calls `/comment/list` per post. All requests are spaced, retried on 429/5xx, deduplicated, and bounded by page limits. With `sort: New` plus `sinceDate`, it stops as soon as older posts appear.

### Input

| Field | Type | Default | Description |
|---|---|---|---|
| `instance` | string | "lemmy.world" | Lemmy server domain, e.g. lemmy.world, lemmy.ml, programming.dev. |
| `communities` | array | - | name, name@instance or community URL. |
| `postUrls` | array | \[] | Individual posts to fetch. |
| `searchQueries` | array | \[] | Full-text post search across the instance's known content. |
| `sort` | string | "New" | New is required for since-date early stop. |
| `maxItems` | integer | 100 | Hard cap on posts saved and charged. |
| `maxPostsPerCommunity` | integer | 0 | 0 = no per-community cap. |
| `includeComments` | boolean | false | Fetch comments for each post (charged as 'comment'). |
| `maxCommentsPerPost` | integer | 20 | Max comments per post |
| `includeCommunityInfo` | boolean | true | Free metadata row per community (subscribers, activity). |
| `sinceDate` | string | - | ISO date/time. |
| `delayMs` | integer | 800 | Delay between requests (ms) |

#### Example input

```json
{
  "instance": "lemmy.world",
  "communities": [
    "technology",
    "selfhosted@lemmy.world"
  ],
  "sort": "New",
  "maxItems": 200,
  "includeComments": true,
  "maxCommentsPerPost": 10,
  "sinceDate": "2026-10-20"
}
```

### Output

Each result is one row in the default dataset. You can download it as JSON, CSV, Excel, XML or HTML, or read it through the Apify API. A real row from a test run on 26 October 2026:

```json
{
  "type": "post",
  "postId": 53586255,
  "title": "ChatGPT Is Building Detailed Psychological Profiles of Its Users:  system is acting as your advisor, your friend, your doctor, your lawyer, and so it has information on everything.",
  "url": "https://lemmy.world/post/53586255",
  "linkUrl": "https://futurism.com/artificial-intelligence/chatgpt-building-profiles-users",
  "body": null,
  "thumbnailUrl": "https://lemmy.world/pictrs/image/f7b8323a-aab7-4757-98a3-4b88b931b1dd.jpeg",
  "nsfw": false,
  "publishedAt": "2026-10-25T18:48:12.361096Z",
  "updatedAt": null,
  "score": 66,
  "upvotes": 67,
  "downvotes": 1,
  "commentCount": 14,
  "community": "technology@lemmy.world",
  "communityTitle": "Technology",
  "author": "eicker@lemmy.world",
  "authorIsBot": false,
  "locked": false,
  "featured": false,
  "instance": "lemmy.world",
  "source": "community:technology"
}
```

### Tips

- Communities from other servers can be addressed as `name@server` through the instance you choose.
- Use `sort: TopWeek` for a weekly best-of digest.
- Comments include `depth` and `parentId` so you can rebuild threads.
- Keep `includeComments` off when you only need headlines - it is much cheaper.

### Pricing

This Actor uses pay-per-event pricing: about **$0.50 per 1,000 posts and $0.25 per 1,000 comments**. There is no monthly rental fee. Platform usage is minimal because the Actor runs on 128 MB with plain HTTP requests. Set **Maximum cost per run** in the run options and the Actor stops cleanly as soon as the limit is reached - you are never charged beyond it.

### Scheduling and integrations

Create an Apify Schedule (for example daily at 08:00) and pass a since-date to get only new items each time. Connect the dataset to Google Sheets, Slack, Zapier, Make, n8n or a webhook to receive results automatically, or call the Actor from Python or JavaScript using the Apify API client.

### Limitations

Content visible depends on what the chosen instance has federated. Some instances block anonymous API access or rate-limit aggressively; pick another instance if you see 4xx errors.

### FAQ

**Do I need an account or API key on the source site?** No. Only public, unauthenticated endpoints are used.

**Do I need proxies?** No. The Actor makes a small number of well-spaced requests to official APIs, so datacenter IPs work fine.

**Why did my run return fewer items than maxItems?** The source simply had no more items matching your filters and date range, or your maximum cost per run was reached.

**Is this legal?** The Actor only reads publicly available data through documented public endpoints. You are responsible for using the data in line with the source's terms and applicable laws such as GDPR, especially for personal data.

**Something broke?** Open an issue on the Actor's Issues tab with your run ID and we will fix it quickly.

# Actor input Schema

## `instance` (type: `string`):

Lemmy server domain, e.g. lemmy.world, lemmy.ml, programming.dev.

## `communities` (type: `array`):

name, name@instance or community URL.

## `postUrls` (type: `array`):

Individual posts to fetch.

## `searchQueries` (type: `array`):

Full-text post search across the instance's known content.

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

New is required for since-date early stop.

## `maxItems` (type: `integer`):

Hard cap on posts saved and charged.

## `maxPostsPerCommunity` (type: `integer`):

0 = no per-community cap.

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

Fetch comments for each post (charged as 'comment').

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

No description

## `includeCommunityInfo` (type: `boolean`):

Free metadata row per community (subscribers, activity).

## `sinceDate` (type: `string`):

ISO date/time.

## `delayMs` (type: `integer`):

No description

## Actor input object example

```json
{
  "instance": "lemmy.world",
  "communities": [
    "technology"
  ],
  "postUrls": [],
  "searchQueries": [],
  "sort": "New",
  "maxItems": 100,
  "maxPostsPerCommunity": 0,
  "includeComments": false,
  "maxCommentsPerPost": 20,
  "includeCommunityInfo": true,
  "delayMs": 800
}
```

# Actor output Schema

## `results` (type: `string`):

No description

## `resultsView` (type: `string`):

No description

# 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 = {
    "communities": [
        "technology"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("pinkish_gallop/lemmy-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 = { "communities": ["technology"] }

# Run the Actor and wait for it to finish
run = client.actor("pinkish_gallop/lemmy-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 '{
  "communities": [
    "technology"
  ]
}' |
apify call pinkish_gallop/lemmy-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,pinkish_gallop/lemmy-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/OUsMuCiebB6zOpcvc/builds/au5ckPFJiuEbGh2tb/openapi.json
