# Lemmy Scraper (`goat255/lemmy-scraper`) Actor

Scrape Lemmy communities, posts, comments, and search results from any instance without a login. Pull a community's posts, a single post with its comment thread, or keyword search results. Walks pagination up to your chosen limit.

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

## Pricing

from $0.40 / 1,000 posts

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use 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

## Lemmy Scraper

Scrape public Lemmy posts, comments, communities, and search results from any Lemmy instance. No login, no password, no API key required. Point it at a community, a post link, or a keyword and get clean structured data back, with pagination walked automatically up to the limit you set.

### What it does

- **Community posts** by name (`technology@lemmy.world` or a community link). Optionally emit a header row with the community's title, description, subscriber count, and active-user counts. Walks pages until your limit.
- **Post threads** from a post URL. Returns the post plus its flattened comment thread, each comment carrying a `depth` field so you can reconstruct the tree.
- **Keyword search** across public posts on the chosen instance, deduplicated across pages.
- **Works across the fediverse.** Point it at any Lemmy server and reference federated communities like `world@lemmy.world` from a different host.
- **Structured, ordered output.** Every row is a flat object with identity, vote metrics, content, media, and timestamps in a stable column order.

### Use cases

- **Brand and topic monitoring.** Track what communities are saying about a product, technology, or keyword across multiple instances.
- **Market and audience research.** Pull a niche community's top posts and engagement metrics to understand what resonates.
- **Trend discovery.** Search posts by keyword sorted by Top or Hot to surface high-engagement discussions.
- **Content and sentiment datasets.** Export posts and full comment threads as a clean dataset for analysis or model training.
- **Community analytics.** Snapshot subscriber and active-user counts over time to measure community growth.

### Input

| Field | Type | Description |
|---|---|---|
| `instance` | string | The Lemmy server to query. Bare host or full URL. Bare community names and search queries run against this instance. Default `lemmy.world`. |
| `communities` | array | Communities to pull recent posts from. Bare name, fully qualified `name@instance`, or a full community link. |
| `postUrls` | array | Specific post links to fetch. Turn on `includeComments` to also pull each post's comment thread. |
| `searchQueries` | array | Keyword searches to run over posts on the chosen instance. |
| `maxPostsPerSource` | integer | Cap on posts returned per community or search query. Pagination is walked until this is reached or the source runs out. Default 100. |
| `sort` | string | Sort order for listings, comments, and search (Active, Hot, New, Top day/week/month/year/all, and more). Default `Active`. |
| `includeCommunityHeader` | boolean | Emit one header row per community (title, description, subscriber and activity counts) before its posts. Default true. |
| `includeComments` | boolean | For each post URL, also return its comment thread flattened with a `depth` field. Default false. |
| `maxCommentsPerPost` | integer | Cap on comments returned per post URL. Default 50. |
| `concurrency` | integer | How many sources to process in parallel. Default 5. |
| `proxyConfig` | object | Optional proxy. The public read endpoints do not require one, but you may route through a proxy if you wish. |

#### Example input

```json
{
  "instance": "lemmy.world",
  "communities": ["technology@lemmy.world"],
  "searchQueries": ["open source"],
  "maxPostsPerSource": 200,
  "sort": "TopWeek",
  "includeCommunityHeader": true
}
````

### Output

Each post is one row:

```json
{
  "type": "post",
  "id": 123456,
  "url": "https://lemmy.world/post/123456",
  "community": "technology@lemmy.world",
  "authorName": "example_user",
  "authorHandle": "example_user@lemmy.world",
  "score": 467,
  "upvotes": 530,
  "downvotes": 63,
  "commentCount": 87,
  "title": "An example post title",
  "body": "An example post body in plain text.",
  "linkUrl": "https://example.com/article",
  "embedTitle": "Example article headline",
  "embedDescription": "A short summary of the linked article.",
  "thumbnailUrl": "https://lemmy.world/pictrs/image/example.jpeg",
  "nsfw": false,
  "locked": false,
  "createdAt": "2026-06-01T12:00:00.000Z",
  "updatedAt": null,
  "scrapedAt": "2026-06-18T09:00:00.000Z"
}
```

**Key fields:** `type` tells you whether the row is a `post`, `comment`, or `community` header. `score`, `upvotes`, `downvotes`, and `commentCount` are the engagement metrics at scrape time. `body` is the plain-text post body (null for link-only posts). `linkUrl` is the external link a post points to, with `embedTitle` / `embedDescription` / `thumbnailUrl` describing it. A community header row carries `subscribers`, `posts`, `comments`, and active-user counts. A comment row carries `postId`, `content`, `depth`, and the same vote metrics.

### FAQ

**Do I need a Lemmy account or API key?**
No. The scraper reads only public data and requires no login, password, or key.

**Is it free?**
You pay only for the Apify platform usage and the per-result charge shown on the actor's pricing tab. There is no separate subscription.

**How many results can I get?**
Set `maxPostsPerSource` to whatever you need. The actor pages through the listing automatically and keeps fetching until it reaches your limit or the source is exhausted. Comment threads are capped by `maxCommentsPerPost`.

**Why are some fields null?**
Link-only posts have no `body`, and most posts are never edited so `updatedAt` is usually null. These reflect what the source actually publishes for each item, not a scraping gap.

**Can I scrape any Lemmy instance?**
Yes. Set `instance` to any Lemmy server (for example `lemmy.ml` or `sh.itjust.works`), or use a fully qualified `name@instance` to reach a federated community from a different host.

**How fast is it?**
Multiple sources run in parallel (controlled by `concurrency`). A single community of a few hundred posts typically finishes in well under a minute.

**Can I get full comment threads?**
Yes. Add post links to `postUrls` and turn on `includeComments`. Each comment row includes a `depth` field so you can rebuild the reply tree.

# Actor input Schema

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

The Lemmy server to query. Bare host or full URL. Bare community names and search queries run against this instance. Example: lemmy.world.

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

Communities to pull recent posts from. A bare name, a fully qualified name like technology@lemmy.world, or a full community link. Example: technology@lemmy.world.

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

Specific post links to fetch. Turn on Include comments to also pull each post's comment thread. Example: https://lemmy.world/post/123456.

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

Keyword searches to run over posts on the chosen instance. Example: open source, self hosting.

## `maxPostsPerSource` (type: `integer`):

Cap on posts returned per community or search query. Pagination is walked across multiple pages until this is reached or the source is exhausted.

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

Sort order for community listings, comments, and search results.

## `includeCommunityHeader` (type: `boolean`):

When on, each community also emits one header record (title, description, subscriber and activity counts) before its posts.

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

When on, each post URL also returns its comment thread, flattened with a depth field.

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

Cap on comments returned per post URL when Include comments is on.

## `concurrency` (type: `integer`):

How many sources to process in parallel.

## `proxyConfig` (type: `object`):

Optional proxy. The public read endpoints do not require a proxy, but you may route through one if you wish.

## Actor input object example

```json
{
  "instance": "lemmy.world",
  "communities": [
    "technology@lemmy.world"
  ],
  "postUrls": [],
  "searchQueries": [],
  "maxPostsPerSource": 100,
  "sort": "Active",
  "includeCommunityHeader": true,
  "includeComments": false,
  "maxCommentsPerPost": 50,
  "concurrency": 5,
  "proxyConfig": {
    "useApifyProxy": false
  }
}
```

# 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 = {
    "instance": "lemmy.world",
    "communities": [
        "technology@lemmy.world"
    ],
    "postUrls": [],
    "searchQueries": []
};

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

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

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

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

```

## CLI example

```bash
echo '{
  "instance": "lemmy.world",
  "communities": [
    "technology@lemmy.world"
  ],
  "postUrls": [],
  "searchQueries": []
}' |
apify call goat255/lemmy-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=goat255/lemmy-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Lemmy Scraper",
        "description": "Scrape Lemmy communities, posts, comments, and search results from any instance without a login. Pull a community's posts, a single post with its comment thread, or keyword search results. Walks pagination up to your chosen limit.",
        "version": "0.1",
        "x-build-id": "0gbCLJOW1P9clDVij"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/goat255~lemmy-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-goat255-lemmy-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/goat255~lemmy-scraper/runs": {
            "post": {
                "operationId": "runs-sync-goat255-lemmy-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/goat255~lemmy-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-goat255-lemmy-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "properties": {
                    "instance": {
                        "title": "Instance",
                        "type": "string",
                        "description": "The Lemmy server to query. Bare host or full URL. Bare community names and search queries run against this instance. Example: lemmy.world.",
                        "default": "lemmy.world"
                    },
                    "communities": {
                        "title": "Communities (community mode)",
                        "type": "array",
                        "description": "Communities to pull recent posts from. A bare name, a fully qualified name like technology@lemmy.world, or a full community link. Example: technology@lemmy.world.",
                        "default": [
                            "technology@lemmy.world"
                        ],
                        "items": {
                            "type": "string"
                        }
                    },
                    "postUrls": {
                        "title": "Post URLs (thread mode)",
                        "type": "array",
                        "description": "Specific post links to fetch. Turn on Include comments to also pull each post's comment thread. Example: https://lemmy.world/post/123456.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "searchQueries": {
                        "title": "Search queries (search mode)",
                        "type": "array",
                        "description": "Keyword searches to run over posts on the chosen instance. Example: open source, self hosting.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "maxPostsPerSource": {
                        "title": "Max posts per source",
                        "minimum": 1,
                        "maximum": 50000,
                        "type": "integer",
                        "description": "Cap on posts returned per community or search query. Pagination is walked across multiple pages until this is reached or the source is exhausted.",
                        "default": 100
                    },
                    "sort": {
                        "title": "Sort order",
                        "enum": [
                            "Active",
                            "Hot",
                            "New",
                            "Old",
                            "MostComments",
                            "NewComments",
                            "TopDay",
                            "TopWeek",
                            "TopMonth",
                            "TopYear",
                            "TopAll",
                            "Controversial",
                            "Scaled"
                        ],
                        "type": "string",
                        "description": "Sort order for community listings, comments, and search results.",
                        "default": "Active"
                    },
                    "includeCommunityHeader": {
                        "title": "Include a community header row",
                        "type": "boolean",
                        "description": "When on, each community also emits one header record (title, description, subscriber and activity counts) before its posts.",
                        "default": true
                    },
                    "includeComments": {
                        "title": "Include comments for post URLs",
                        "type": "boolean",
                        "description": "When on, each post URL also returns its comment thread, flattened with a depth field.",
                        "default": false
                    },
                    "maxCommentsPerPost": {
                        "title": "Max comments per post",
                        "minimum": 1,
                        "maximum": 1000,
                        "type": "integer",
                        "description": "Cap on comments returned per post URL when Include comments is on.",
                        "default": 50
                    },
                    "concurrency": {
                        "title": "Concurrency",
                        "minimum": 1,
                        "maximum": 20,
                        "type": "integer",
                        "description": "How many sources to process in parallel.",
                        "default": 5
                    },
                    "proxyConfig": {
                        "title": "Proxy configuration",
                        "type": "object",
                        "description": "Optional proxy. The public read endpoints do not require a proxy, but you may route through one if you wish.",
                        "default": {
                            "useApifyProxy": false
                        }
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
