# Lemmy Scraper - Posts, Comments, Votes from Any Instance (`scrapewise/lemmy-scraper`) Actor

Scrape Lemmy posts and comments from any instance without login: by community, keyword search, post link or front page, with any sort (Hot, New, Top...). Get title, body, link, upvotes, downvotes, score, comment count, author, community and dates. Error rows are free.

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

## Pricing

from $0.34 / 1,000 post delivereds

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/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 and comments from any Lemmy instance, with votes, authors and communities

Lemmy Scraper collects **posts and comments from Lemmy**, the open, federated alternative to Reddit, without an
account, a login or an API key. Point it at any instance (lemmy.world by default, or lemmy.ml, sh.itjust.works,
programming.dev and hundreds more), then pick communities, search terms, post links or simply the front page, in any
sort Lemmy offers: Hot, Active, New, Top of the day, week, month or all time, Most comments and more. Each post comes
back as one clean row with title, body, link, upvotes, downvotes, score, comment count, author, community and dates.
Turn on comments to get each post's discussion as separate rows, with depth and parent comment.

It is used to build text datasets for AI training and RAG, to monitor what open-source, privacy and tech communities
say about a product or a topic, to research trends across the fediverse, and to archive communities over time.

### At a glance

| What | Price |
|---|---|
| Post delivered | **US$ 0.40 per 1,000 posts** on the Free plan (US$ 0.0004 each) |
| Comment delivered (only with comments on) | US$ 0.40 per 1,000 comments |
| Paid Apify plans | Bronze US$ 0.38, Silver US$ 0.36, Gold and above US$ 0.34 per 1,000 |
| Run start | US$ 0.005 per run |

- 5 communities with 30 posts each = 150 posts = **US$ 0.07** on the Free plan, run start included.
- The same 150 posts with 20 comments each = 3,150 items = **US$ 1.27**.
- Error rows and duplicates are never charged. `maxItems` is a hard cap, and a spending limit set on the run stops it
  cleanly with everything delivered so far.

### Quick start

Hot posts of one community:

```json
{
  "communities": ["technology"],
  "maxPostsPerSource": 30
}
```

Top posts of the week from communities on two instances, with the 20 best comments of each post:

```json
{
  "communities": ["linux@lemmy.ml", "https://lemmy.world/c/selfhosted"],
  "sort": "TopWeek",
  "includeComments": true,
  "maxCommentsPerPost": 20
}
```

Search posts on another instance:

```json
{
  "instance": "programming.dev",
  "searchQueries": ["rust async", "python packaging"],
  "sort": "TopMonth",
  "maxPostsPerSource": 50
}
```

Leave communities, searches and links empty to get the instance front page in the chosen sort.

### Input

| Field | What it does |
|---|---|
| `communities` | Community names on the chosen instance (`technology`), federated names (`linux@lemmy.ml`) or community links. |
| `searchQueries` | Keywords to search in posts. With exactly one community, the search runs inside it. |
| `startUrls` | Post (`/post/123`), comment (`/comment/456`) or community (`/c/name`) links from any instance. |
| `instance` | The Lemmy server to read from (default `lemmy.world`). |
| `sort` | Hot (default), Active, New, Old, Scaled, Controversial, MostComments, NewComments, TopHour to TopAll. |
| `listingType` | For front page and search: `All` (federated, default) or `Local` (this instance only). |
| `maxPostsPerSource` | Posts per community, search term or front page (default 30; 0 = as many as the instance returns). |
| `maxItems` | Cap for the whole run, posts and comments together (0 = no cap). |
| `skipNsfw` | Leave out posts marked NSFW (default off). |
| `includeComments` | Add each post's comments as rows (default off). |
| `maxCommentsPerPost` | Comments per post when comments are on (default 20; 0 = all). |
| `commentSort` | Top (default), Hot, New, Old or Controversial. |
| `proxyConfiguration` | Apify Proxy by default. |

`community`, `query`, `keyword`, `searchQuery`, `urls`, `sortBy`, `maxResults` and `limit` are accepted too, so
inputs written for other Lemmy tools keep working.

### Output

Every row has `type` (`post`, `comment` or `error`).

**Post row** (`type: post`):

| Field | What it is |
|---|---|
| `id`, `postUrl` | Post id and link on the instance you read from |
| `originalUrl` | Link on the instance where the post was written (federation) |
| `title`, `body` | Post title and text (Markdown) |
| `link`, `linkTitle`, `linkDescription`, `thumbnailUrl` | Shared link and its preview |
| `upvotes`, `downvotes`, `score`, `comments` | Vote counts and number of comments |
| `publishedAt`, `updatedAt`, `newestCommentAt` | Dates in UTC |
| `nsfw`, `locked`, `featured`, `isLocal` | Post flags; `isLocal` is true when the post was written on this instance |
| `author`, `authorDisplayName`, `authorHandle`, `authorUrl`, `authorIsBot` | Author's public username, display name, `name@instance` handle, profile link and bot flag |
| `community`, `communityTitle`, `communityHandle`, `communityUrl` | Community name, title, `name@instance` handle and link |
| `instance`, `position`, `sourceUrl`, `scrapedAt` | Where it was read, order in the source, what you sent and when |

**Comment row** (`type: comment`): `id`, `commentUrl`, `originalUrl`, `text`, `upvotes`, `downvotes`, `score`,
`replies`, `depth` (1 = direct reply to the post), `parentId` (the comment it answers), `publishedAt`, `updatedAt`,
`distinguished`, `postId`, `postTitle`, `postUrl`, plus the same author and community fields.

One real post row:

```json
{
  "type": "post",
  "id": 53214894,
  "postUrl": "https://lemmy.world/post/53214894",
  "title": "Linus Torvalds shares his thoughts on Anti-AI coding rules",
  "link": "https://media.piefed.social/posts/TS/lY/TSlYv9DvdaiTI2U.png",
  "upvotes": 135,
  "downvotes": 14,
  "score": 121,
  "comments": 83,
  "publishedAt": "2026-10-16T17:36:33.541124Z",
  "author": "Ek-Hou-Van-Braai",
  "authorHandle": "Ek-Hou-Van-Braai@piefed.social",
  "community": "linux",
  "communityHandle": "linux@lemmy.ml",
  "instance": "lemmy.world"
}
```

And one of its comments:

```json
{
  "type": "comment",
  "id": 26368467,
  "text": "I don't think he thinks about you at all",
  "upvotes": 32,
  "downvotes": 3,
  "score": 29,
  "replies": 1,
  "depth": 2,
  "parentId": 26367731,
  "postId": 53214894,
  "community": "linux"
}
```

### How it works

Every Lemmy server publishes the same open API. The Actor reads it and turns the answers into flat rows,
so runs are fast: 30 posts usually take one or two
seconds. Communities hosted on other servers are read through the instance you choose, exactly as its web page shows
them; links keep their own instance.

### Errors you may see

Every error is a row with `errorCode` and is never charged:

| errorCode | Meaning |
|---|---|
| `INVALID_URL` | Not a Lemmy community, post or comment link |
| `INVALID_INPUT` | A field has a wrong value (for example an unknown sort) |
| `NOT_FOUND` | The community, post or comment does not exist on that instance |
| `NO_RESULTS` | The community or search returned no posts for this sort |
| `NOT_LEMMY` | The server answered, but it is not a Lemmy instance |
| `BLOCKED` | The instance kept refusing requests (rate limit); run it again in a few minutes |
| `UNREACHABLE` | The instance did not answer |
| `NOT_REACHED` | The run timeout or the cost guard arrived before this source |

### Integrations, scheduling and AI agents

- **Schedule** a run every hour or day in [Apify schedules](https://docs.apify.com/platform/schedules) with sort
  `New` to collect every new post of your communities.
- **Export** as JSON, CSV, Excel or XML, or read the dataset from the [Apify API](https://docs.apify.com/api/v2).
- **Connect** it to Make, n8n, Zapier, Slack or Google Sheets through
  [Apify integrations](https://docs.apify.com/platform/integrations), for example to post brand mentions to a channel.
- **AI agents:** call it as a tool through the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp)
  in Claude, ChatGPT, Cursor or any MCP client, for example "get this week's top posts of linux@lemmy.ml with their
  comments and summarize the main complaints".

### FAQ

**Do I need a Lemmy account?** No. The Lemmy API is public for reading; no login, cookie or key is used.

**Which instance should I use?** The default, lemmy.world, is the largest and sees most federated communities. Use
another instance when the community you want lives there or is not federated with lemmy.world.

**How do I get communities from other servers?** Write them as `name@server` (for example `linux@lemmy.ml`) or paste
their link. Counts can differ slightly between instances, because each server counts the votes it received.

**Can I get every comment of a post?** Yes: turn on `includeComments` and set `maxCommentsPerPost` to 0.

**Is it legal?** The Actor reads public data only and returns public usernames, never emails or phone numbers. You
are responsible for how you use the data under the laws that apply to you.

**Something broke or a field is missing?** Open an issue on the Actor page; issues are answered within a day.

### Limitations

- Lemmy search matches words loosely; very generic terms bring unrelated posts.
- Some instances limit how deep you can page into old posts or rate-limit busy periods.
- Deleted and removed posts and comments are skipped.
- User profiles and private messages are not collected.

### Changelog

- **16 Oct 2026:** first version: communities, search, post, comment and community links, front page, all Lemmy
  sorts, comments with depth and parent, any instance.

# Actor input Schema

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

Lemmy communities, one per line: a name on the chosen instance (technology), a federated name (linux@lemmy.ml) or a community link (https://lemmy.world/c/technology). Leave everything empty to scrape the instance front page.

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

Optional. Keywords to search in posts across the instance, for example open source or self hosting. With exactly one community above, the search runs inside that community.

## `startUrls` (type: `array`):

Optional. Links from any Lemmy instance: posts (https://lemmy.world/post/123), comments (https://lemmy.world/comment/456) or communities (https://lemmy.ml/c/linux). Each link is read from its own instance.

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

The Lemmy server to read from, for example lemmy.world, lemmy.ml, sh.itjust.works or programming.dev. Federated communities from other servers are visible through it.

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

Same sort options as the Lemmy web page. For search, Hot, New, Old and the Top options apply.

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

For the front page and for search: All includes posts federated from other instances; Local keeps only posts from communities hosted on this instance.

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

How many posts to collect from each community, search term or the front page. 0 = as many as the instance returns.

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

Hard cap for the whole run, posts and comments together. 0 = no cap.

## `skipNsfw` (type: `boolean`):

On: posts marked NSFW (or from NSFW communities) are left out and never charged.

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

On: each post with comments also gets its comments as separate rows (text, votes, author, depth and parent comment).

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

How many comments to collect per post when comments are on. 0 = all of them.

## `commentSort` (type: `string`):

Order of the comments of each post.

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

Apify Proxy by default. Lemmy's API is public, so you rarely need to change this.

## Actor input object example

```json
{
  "communities": [
    "technology"
  ],
  "instance": "lemmy.world",
  "sort": "Hot",
  "listingType": "All",
  "maxPostsPerSource": 30,
  "maxItems": 0,
  "skipNsfw": false,
  "includeComments": false,
  "maxCommentsPerPost": 20,
  "commentSort": "Top",
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

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

No description

## `resultsCsv` (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"
    ],
    "instance": "lemmy.world",
    "maxPostsPerSource": 30,
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("scrapewise/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"],
    "instance": "lemmy.world",
    "maxPostsPerSource": 30,
    "proxyConfiguration": { "useApifyProxy": True },
}

# Run the Actor and wait for it to finish
run = client.actor("scrapewise/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"
  ],
  "instance": "lemmy.world",
  "maxPostsPerSource": 30,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}' |
apify call scrapewise/lemmy-scraper --silent --output-dataset

```

## MCP server setup

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