# 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, 92.9% 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.

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

Download the OpenAPI definition: https://api.apify.com/v2/actors/tQC8NZXVUau7b20yK/builds/4jbueg28tdhW9w2oc/openapi.json
