# Lemmy Scraper: Posts, Comments, Communities & Search (`memo23/lemmy-scraper`) Actor

Lemmy scraper with no login: search posts by keyword, pull any community on any server (name, name@server or link), the front-page feed, and comments with scores, votes, authors and dates. Sort by hot, new or top for a day to all time. $0.30 per 1,000 posts or comments, plus $0.002 per source.

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

## Pricing

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

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, Comments, Communities & Search

Scrape **Lemmy**, the federated Reddit alternative, for **$0.30 per 1,000 posts or comments**. Search posts by keyword, pull any community on any server, take a server's front page, and read the comments under a community's posts. Every row has the score, upvotes, downvotes, comment count, author, community, home server and dates. No login, no account, no API key.

![How the Lemmy Scraper works](https://api.apify.com/v2/key-value-stores/tsoeHlvc5fr45KCbd/records/how-it-works-lemmy.png)

```json
{
  "communities": ["technology", "linux@lemmy.ml"],
  "searchKeywords": ["fediverse"],
  "includeComments": true
}
```

| Input | Rows |
|---|---|
| Community (`technology`, `linux@lemmy.ml` or `https://lemmy.ml/c/linux`) | Up to 200 posts |
| Search keyword | Up to 200 posts matching it |
| Front-page feed | Up to 100 posts from all communities |
| Comments (per community) | Up to 200 comments on the community's posts |

### Why Use This Scraper?

- **Any server, any community.** Lemmy is spread over hundreds of servers. Write a community as `name@server` or paste its link and it is read on its home server, where its full history lives.
- **Votes, not just text.** Score, upvotes, downvotes and comment counts on every post; score, votes, depth and parent on every comment.
- **Sorted the way Lemmy sorts.** Hot, active, new, most comments, new comments, or top of the last hour, day, week, month, year or all time.
- **Billed once per post.** A post found by both a search and its community is delivered and charged once.
- **Clean rows.** Numbers are numbers, dates are ISO 8601, every row has a `type`.

### Use Cases

- **Brand and topic monitoring:** follow what the fediverse says about a product, project or company.
- **Open-source community research:** read Linux, privacy and self-hosting communities, where Lemmy is strongest.
- **AI and NLP datasets:** posts and threaded comments with vote counts as quality signals.
- **Reddit alternative tracking:** compare which communities and servers grow, and what reaches the top.
- **Link analysis:** which outside sites (`externalUrl`) get shared and upvoted.

### How It Works

1. Communities, keywords and the feed are read four at a time. Each request takes about 40 seconds; 200 comments take up to 3 minutes.
2. Plain community names, searches and the feed run on the server you choose (`lemmy.world` by default, the largest). A community written with its server is read there; if that server does not answer, the copy on your chosen server is used.
3. Comments run after posts, so posts always get the room first under a row or spending limit.
4. Every row is charged as it is delivered, and the run stops cleanly at your spending limit.

### Input Configuration

| Field | Type | Description |
|---|---|---|
| `communities` | array | `technology`, `linux@lemmy.ml`, `!linux@lemmy.ml` or `https://lemmy.ml/c/linux`. |
| `searchKeywords` | array | Keywords to search in post titles and text. |
| `scrapeFeed` | boolean | Also take the server's front page (up to 100 posts). |
| `includeComments` | boolean | Also read comments for each community. |
| `maxCommentsPerCommunity` | integer | 50-200. Default 100. |
| `maxCommentsPerPost` | integer | Cap per post. Default 20. |
| `instance` | string | Server for search, feed and plain names. Default `lemmy.world`. |
| `sort` | string | `hot`, `active`, `new`, `top`, `most_comments`, `new_comments`. Empty = Lemmy's default. |
| `topRange` | string | Window for `top`: `hour` … `day`, `week`, `month`, `year`, `all`. Default `week`. |
| `maxPostsPerSource` | integer | 25-200 per community or keyword (feed: 100). Default 100. |
| `maxItems` | integer | Cap on all rows. Default 1,000; free-plan runs return up to 100. |

#### Example input

The week's top posts from two communities, with their comments:

```json
{
  "communities": ["technology", "https://lemmy.ml/c/linux"],
  "sort": "top",
  "topRange": "week",
  "includeComments": true,
  "maxCommentsPerCommunity": 200
}
```

Newest posts mentioning a keyword on lemmy.ml:

```json
{
  "searchKeywords": ["privacy"],
  "instance": "lemmy.ml",
  "sort": "new",
  "maxPostsPerSource": 200
}
```

### Output Samples

A post (from the lemmy.world front page, 2026-10-26):

```json
{
  "type": "post",
  "postId": 47508220,
  "title": "It used to be a library",
  "body": null,
  "url": "https://lemdro.id/post/47508220",
  "externalUrl": "https://lemmy.ml/pictrs/image/e9429e72-41b5-4884-90d7-23ef7e104005.png",
  "thumbnailUrl": "https://lemmy.world/pictrs/image/4625bc3b-47cb-4ddc-b12a-4c687dfe7e03.png",
  "community": "memes",
  "communityUrl": "https://sopuli.xyz/c/memes",
  "communityInstance": "sopuli.xyz",
  "author": "cm0002",
  "authorUrl": "https://lemdro.id/u/cm0002",
  "authorInstance": "lemdro.id",
  "score": 1485,
  "upvotes": 1498,
  "downvotes": 13,
  "commentCount": 111,
  "isNsfw": false,
  "isLocked": false,
  "isFeatured": false,
  "postedAt": "2026-10-22T10:10:42.074Z",
  "updatedAt": null,
  "queriedInstance": "lemmy.world",
  "source": "feed",
  "sourceInput": "lemmy.world",
  "scrapedAt": "2026-10-26T14:42:20.835Z"
}
```

A comment (from linux@lemmy.ml):

```json
{
  "type": "comment",
  "commentId": 28425410,
  "text": "2027 year of the Linux car",
  "author": "standarduser",
  "authorUrl": "https://lemmy.dbzer0.com/u/standarduser",
  "authorInstance": "lemmy.dbzer0.com",
  "score": 214,
  "upvotes": 214,
  "downvotes": 0,
  "depth": 1,
  "parentCommentId": null,
  "isDeleted": false,
  "postUrl": "https://lemmy.world/post/53335678",
  "postTitle": "Where there's a will...",
  "community": "linux",
  "postedAt": "2026-10-19T16:57:11.791Z",
  "sourceInput": "linux@lemmy.ml"
}
```

### Key Output Fields

| Field | Meaning |
|---|---|
| `type` | `post` or `comment` |
| `url` | The post on the server it was made on |
| `externalUrl` | The link a post shares (article, image) |
| `score`, `upvotes`, `downvotes` | Net score and the votes behind it |
| `communityInstance`, `authorInstance` | The home servers of the community and the author |
| `source`, `sourceInput` | Where a post came from: `community`, `search` or `feed`, and the input that found it |
| `depth`, `parentCommentId` | Where a comment sits in its thread (1 = top level) |

### FAQ

**How many posts can I get from one community or keyword?**
Up to 200 per community or keyword, 100 from the feed. The data source gives no further pages. For more, combine sorts (for example `new` and `top` of `month`) in separate runs, or search more specific keywords.

**Does search cover all of Lemmy?**
It searches everything the chosen server knows about. On lemmy.world that is most active communities, but not a full search of every server.

**Can I get the comments of one specific post?**
No. Comments are read per community: the community's posts in your sort order, with up to `maxCommentsPerPost` from each.

**Why is `postId` missing on some posts?**
Posts made on PieFed servers carry no Lemmy id; the number is read from the link where it has one. `url` is always set.

**A small community returned only a few posts.**
It returns what it has: for example a community with 5 posts gives 5 rows, and `top` of `week` gives only that week's posts.

**What happens with a misspelled community?**
It is reported in the log and skipped, and nothing is charged for it.

**Do I need an account?**
No.

### Pricing

| Event | When | Price |
|---|---|---|
| Actor start | Once per run (per GB of memory, 256 MB default) | $0.005 |
| Post | Each post delivered | $0.0003 |
| Comment | Each comment delivered | $0.0003 |
| Source | Once per keyword, community, front page or comment batch that returns rows (empty ones are free) | $0.002 |

Example: 10 communities with 200 posts and 200 comments each = 4,000 rows × $0.0003 + 20 sources × $0.002 + $0.005 = $1.245.

### Support

Found a bug or need a field? Open an issue on the actor's Issues tab and include the run link.

### ⚠️ Disclaimer

This actor reads public Lemmy content. It is not affiliated with or endorsed by Lemmy or any Lemmy server. You are responsible for using the data in line with each server's rules and the laws that apply to you, including data-protection law where rows name people. Posts and comments belong to their authors.

### SEO Keywords

Lemmy scraper, Lemmy API, Lemmy posts scraper, Lemmy comments scraper, Lemmy community scraper, lemmy.world scraper, fediverse scraper, Reddit alternative scraper, federated social media data, Lemmy search, Lemmy data export, threadiverse

# Actor input Schema

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

Lemmy communities as a name (technology, read on the server below), name@server (linux@lemmy.ml, read on its home server) or a link (https://lemmy.ml/c/linux). Each returns up to 200 posts.

## `searchKeywords` (type: `array`):

Search post titles and text. Each keyword returns up to 200 posts from everything the server below knows about, which on a large server covers most of Lemmy.

## `scrapeFeed` (type: `boolean`):

Also take the server's front page (all communities), up to 100 posts.

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

Also read comments on each community's posts. Comments come from the community's posts in the chosen sort order, not from single post links.

## `maxCommentsPerCommunity` (type: `integer`):

Comments taken from one community in all (50-200).

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

Cap per post, so one busy thread does not fill the whole community quota.

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

The Lemmy server that runs the search and the feed, and reads plain community names. lemmy.world is the largest. Examples: lemmy.ml, sh.itjust.works, programming.dev.

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

Leave empty for Lemmy's own default: hot for search and communities, active for the feed, most comments for comments.

## `topRange` (type: `string`):

Only used when sorting by Top. It ranks posts by score within this window; it does not filter comments by date.

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

Up to 200 per community or keyword, 100 for the feed. Lemmy gives no further pages past that.

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

Cap on posts and comments together. Free-plan runs return up to 100.

## Actor input object example

```json
{
  "communities": [
    "technology",
    "linux@lemmy.ml"
  ],
  "scrapeFeed": false,
  "includeComments": false,
  "maxCommentsPerCommunity": 100,
  "maxCommentsPerPost": 20,
  "instance": "lemmy.world",
  "topRange": "week",
  "maxPostsPerSource": 100,
  "maxItems": 1000
}
```

# Actor output Schema

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

Rows told apart by `type`: `post` and `comment`.

# 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",
        "linux@lemmy.ml"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("memo23/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",
        "linux@lemmy.ml",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("memo23/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",
    "linux@lemmy.ml"
  ]
}' |
apify call memo23/lemmy-scraper --silent --output-dataset

```

## MCP server setup

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