# Lemmy scraper - posts, comments, communities and users (`mangudai/lemmy-scraper`) Actor

Scrape public Lemmy data from any instance without a login or API key. Turn a keyword, community, user, or feed into structured rows of posts, comments, communities and user profiles. Export to CSV, JSON or Excel for community monitoring, research and lead discovery.

- **URL**: https://apify.com/mangudai/lemmy-scraper.md
- **Developed by:** [Mangudäi](https://apify.com/mangudai) (community)
- **Categories:** Social media, Open source, News
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.01 / 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/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.

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

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

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python/docs.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/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 - posts, comments, communities and users

Scrape public data from any Lemmy instance without a login, an API key, or a captcha. Lemmy is the largest federated Reddit alternative, and this scraper turns a keyword, a community, a user, or an instance feed into clean, structured rows you can export to CSV, JSON, or Excel.

Use it for community monitoring, brand and topic mention tracking, content aggregation, fediverse research, and lead discovery across the open social web.

### What it does

Point it at an instance such as lemmy.world, lemmy.ml, or sh.itjust.works and it reads the documented `/api/v3` endpoints. It handles pagination, retries, rate limiting, and federated content from across the fediverse.

Four ways to run it, picked automatically from your input:

- Communities: give one or more communities as `name@instance` (for example `technology@lemmy.world`) and get their posts, or switch the result type to comments. Each run also returns the community record with subscriber and activity counts.
- Users: give one or more accounts as `name@instance` and get each profile plus that user's recent posts and comments.
- Search: give a keyword and get matching posts, comments, communities, or users from across the instance.
- Feed: leave the filters empty and get the instance's public post feed.

Priority when several inputs are set: users, then communities, then search, then the feed.

### Input

| Field | Description |
| --- | --- |
| `instance` | Lemmy instance host, e.g. `lemmy.world`. Default `lemmy.world`. |
| `communities` | List of communities as `name@instance`. |
| `usernames` | List of users as `name@instance`. Takes priority over communities and search. |
| `searchQuery` | Keyword(s) to search across the instance. |
| `resultType` | Posts, Comments, Communities, or Users. Filters search; switches posts/comments in community mode. |
| `sort` | Active, Hot, New, Old, Top day/week/month/year/all, Most comments, New comments. |
| `listingType` | All (federated) or Local. |
| `includeUserContent` | User mode: also return each user's recent posts and comments. |
| `maxItems` | Cap on returned rows. |
| `requestDelaySeconds` | Pause between requests. Default 0.5. |
| `proxyConfiguration` | Optional. The API is public, so a proxy is rarely needed. |

### Output

One flat row per item with a `type` of post, comment, community, or user. Posts and comments carry the author and community, engagement counts, timestamps, and permalinks. Community rows carry subscriber and active-user counts. User rows carry the bio, avatar, account age, post and comment counts, and any Matrix contact listed on the profile.

Example post row:

```json
{
  "type": "post",
  "instance": "lemmy.world",
  "postId": "49722402",
  "title": "Some Mullvad VPN customers tunnel for exit",
  "linkUrl": "https://www.theregister.com/...",
  "permalink": "https://lemmy.world/post/49722402",
  "score": 214,
  "comments": 37,
  "communityName": "privacy",
  "communityInstance": "lemmy.world",
  "creatorUsername": "someuser",
  "creatorInstance": "lemmy.world",
  "published": "2026-07-21T09:14:00Z"
}
````

### Notes

Only public data is read, through Lemmy's own API. There is no login and no scraping of private or moderator-only content. Be reasonable with request rates and respect each instance's rules.

# Actor input Schema

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

The Lemmy instance to read from, e.g. lemmy.world, lemmy.ml or sh.itjust.works.

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

Communities to pull posts (or comments) from, as name@instance, e.g. technology@lemmy.world. Runs when no usernames are set.

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

User accounts to look up as name@instance, e.g. lwreport@lemmy.world. Returns each profile plus their recent posts and comments. Takes priority over communities and search.

## `searchQuery` (type: `string`):

Keyword(s) to search across the instance. Runs when no communities or usernames are set.

## `resultType` (type: `string`):

What to return. In search mode this filters the results; in community mode it switches between posts and comments.

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

Order of the results.

## `listingType` (type: `string`):

All shows federated content from across the fediverse; Local shows only content native to the instance.

## `includeUserContent` (type: `boolean`):

User mode only. When on, each profile is followed by that user's recent posts and comments.

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

Maximum number of rows to return.

## `requestDelaySeconds` (type: `number`):

Polite pause between API requests to avoid rate limiting.

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

Optional. The Lemmy API is public and usually needs no proxy. Enable only if an instance rate-limits your IP.

## Actor input object example

```json
{
  "instance": "lemmy.world",
  "communities": [
    "technology@lemmy.world"
  ],
  "usernames": [],
  "resultType": "Posts",
  "sort": "Active",
  "listingType": "All",
  "includeUserContent": true,
  "maxItems": 100,
  "requestDelaySeconds": 0.5,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `results` (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"
    ],
    "usernames": [],
    "searchQuery": "",
    "proxyConfiguration": {
        "useApifyProxy": false
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("mangudai/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"],
    "usernames": [],
    "searchQuery": "",
    "proxyConfiguration": { "useApifyProxy": False },
}

# Run the Actor and wait for it to finish
run = client.actor("mangudai/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"
  ],
  "usernames": [],
  "searchQuery": "",
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}' |
apify call mangudai/lemmy-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Lemmy scraper - posts, comments, communities and users",
        "description": "Scrape public Lemmy data from any instance without a login or API key. Turn a keyword, community, user, or feed into structured rows of posts, comments, communities and user profiles. Export to CSV, JSON or Excel for community monitoring, research and lead discovery.",
        "version": "0.0",
        "x-build-id": "4jbueg28tdhW9w2oc"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/mangudai~lemmy-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-mangudai-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/mangudai~lemmy-scraper/runs": {
            "post": {
                "operationId": "runs-sync-mangudai-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/mangudai~lemmy-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-mangudai-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 instance to read from, e.g. lemmy.world, lemmy.ml or sh.itjust.works.",
                        "default": "lemmy.world"
                    },
                    "communities": {
                        "title": "Communities",
                        "type": "array",
                        "description": "Communities to pull posts (or comments) from, as name@instance, e.g. technology@lemmy.world. Runs when no usernames are set.",
                        "default": [
                            "technology@lemmy.world"
                        ],
                        "items": {
                            "type": "string"
                        }
                    },
                    "usernames": {
                        "title": "Usernames",
                        "type": "array",
                        "description": "User accounts to look up as name@instance, e.g. lwreport@lemmy.world. Returns each profile plus their recent posts and comments. Takes priority over communities and search.",
                        "default": [],
                        "items": {
                            "type": "string"
                        }
                    },
                    "searchQuery": {
                        "title": "Search query",
                        "type": "string",
                        "description": "Keyword(s) to search across the instance. Runs when no communities or usernames are set."
                    },
                    "resultType": {
                        "title": "Result type",
                        "enum": [
                            "Posts",
                            "Comments",
                            "Communities",
                            "Users"
                        ],
                        "type": "string",
                        "description": "What to return. In search mode this filters the results; in community mode it switches between posts and comments.",
                        "default": "Posts"
                    },
                    "sort": {
                        "title": "Sort",
                        "enum": [
                            "Active",
                            "Hot",
                            "New",
                            "Old",
                            "TopDay",
                            "TopWeek",
                            "TopMonth",
                            "TopYear",
                            "TopAll",
                            "MostComments",
                            "NewComments"
                        ],
                        "type": "string",
                        "description": "Order of the results.",
                        "default": "Active"
                    },
                    "listingType": {
                        "title": "Listing type",
                        "enum": [
                            "All",
                            "Local"
                        ],
                        "type": "string",
                        "description": "All shows federated content from across the fediverse; Local shows only content native to the instance.",
                        "default": "All"
                    },
                    "includeUserContent": {
                        "title": "Include user posts and comments",
                        "type": "boolean",
                        "description": "User mode only. When on, each profile is followed by that user's recent posts and comments.",
                        "default": true
                    },
                    "maxItems": {
                        "title": "Max items",
                        "minimum": 1,
                        "maximum": 10000,
                        "type": "integer",
                        "description": "Maximum number of rows to return.",
                        "default": 100
                    },
                    "requestDelaySeconds": {
                        "title": "Delay between requests (seconds)",
                        "minimum": 0,
                        "maximum": 10,
                        "type": "number",
                        "description": "Polite pause between API requests to avoid rate limiting.",
                        "default": 0.5
                    },
                    "proxyConfiguration": {
                        "title": "Proxy configuration",
                        "type": "object",
                        "description": "Optional. The Lemmy API is public and usually needs no proxy. Enable only if an instance rate-limits your IP.",
                        "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
