# 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 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

## 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.

### Privacy

To improve our actors we collect anonymized usage telemetry (run stats and input patterns). No personal account data is collected.

# 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
  }
}
```

# Actor output Schema

## `posts` (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 = {
    "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

Download the OpenAPI definition: https://api.apify.com/v2/actors/M8Q6Pv35gKyV91vmm/builds/11EChToiQfzBqJ9pR/openapi.json
