# Lemmy Scraper - Posts and Comments from Any Lemmy Instance (`turboextract/lemmy-posts-comments`) Actor

Posts and comments from Lemmy, the open Reddit alternative: by keyword, community or instance, with title, link, text, score, upvotes, comment count, author, community and date. Uses the public Lemmy API, works on lemmy.world and any other instance. No login.

- **URL**: https://apify.com/turboextract/lemmy-posts-comments.md
- **Developed by:** [Moses Ndambuki](https://apify.com/turboextract) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$3.00 / 1,000 post or comment delivereds

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 and Comments from Any Lemmy Instance

**Export posts and comments from Lemmy, the open Reddit alternative, by keyword, community or instance.** Each row has the title, link, text, score, upvotes, comment count, author, community and date. Uses the public Lemmy API, so it works on lemmy.world, programming.dev and any other instance with no login.

In one test, a search for "linux" on lemmy.world returned 60 posts from communities across the fediverse in a few seconds.

***

### Who this is for

- **Brands and founders** tracking mentions in open-source and privacy communities
- **Developer relations teams** finding discussions about their tools
- **Researchers** studying communities that moved from Reddit
- **Marketers** finding questions to answer and topics people care about
- **AI and data teams** collecting public discussion text

***

### What you get

```json
{
  "type": "post",
  "id": 54646626,
  "title": "what good development IDE for making websites??",
  "postUrl": "https://lemmy.world/post/54646626",
  "text": "it needs to meet those criteria: ...",
  "publishedAt": "2026-11-20T17:34:42.528647Z",
  "author": "username",
  "community": "programming",
  "communityUrl": "https://programming.dev/c/programming",
  "score": 7,
  "upvotes": 8,
  "downvotes": 1,
  "comments": 7
}
```

Comment rows have `text`, `replies`, `postId`, `postTitle` and `postUrl`.

***

### How it works

```mermaid
flowchart LR
    A[Search queries] --> C[Public Lemmy API]
    B[Communities] --> C
    C --> D[Posts or comments]
    D --> E[Filter: score, date]
    E --> F[Rows with author and community]
```

***

### Quick start

1. Click **Try for free**.
2. Add **Search queries**, **Communities**, or both.
3. Pick **Posts** or **Comments** and a **Sort**.
4. Optional: change the **Instance**, or set **Minimum score** or **Posted within (days)**.
5. Click **Start**, then export to CSV, JSON or Google Sheets.

#### API

```bash
curl -X POST "https://api.apify.com/v2/acts/Turboextract~lemmy-posts-comments/run-sync-get-dataset-items?token=YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"searchQueries": ["your product"], "contentType": "comments", "postedWithinDays": 7}'
```

#### Python

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_TOKEN")
run = client.actor("Turboextract/lemmy-posts-comments").call(run_input={
    "communities": ["technology", "selfhosted"],
    "sort": "Top",
    "maxResultsPerQuery": 50,
})
for p in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(p["score"], p["community"], p["title"])
```

***

### Input

| Field | Default | What it does |
|---|---|---|
| `searchQueries` | – | Keywords |
| `communities` | – | Names or URLs, like `technology@lemmy.world` |
| `contentType` | posts | Posts or comments |
| `sort` | New | Newest, top, hot, active or most comments |
| `instance` | lemmy.world | Any Lemmy server |
| `minScore` | 0 | Skip low-scoring items |
| `postedWithinDays` | 0 (all) | Only recent items |
| `maxResultsPerQuery` | 100 | Per query or community |
| `maxResults` | 500 | Total cap per run |

***

### Pricing

**$0.003 per post or comment delivered.** 1,000 items cost $3.

| Option | 1,000 items |
|---|---|
| **Lemmy Scraper** | **$3**, posts and comments, any instance |
| Other Lemmy actors on Apify | $0.30 to $10 |
| Social listening tools | $50+ a month |

***

### Use cases

- **Mention alerts**: your product name in comments, every day
- **Community research**: top posts in technology, privacy or self-hosting
- **Content ideas**: questions people ask in your niche
- **Sentiment tracking**: scores and comment counts for a topic over time
- **Reddit alternative data**: the same kind of discussion, from an open API

***

### Tips

- lemmy.world sees posts from most other instances, so it is a good default.
- Use a community name with `@server` for communities hosted elsewhere.
- Dedupe on `id` across scheduled runs.
- Lemmy search matches whole words, so try a few spellings.

***

### Pairs well with

- [Hacker News Scraper](https://apify.com/Turboextract/hacker-news-search): developer discussion on HN
- [Mastodon Scraper](https://apify.com/Turboextract/mastodon-posts-hashtags): fediverse posts by hashtag
- [Bluesky Scraper](https://apify.com/Turboextract/bluesky-posts-profiles): posts and profiles from Bluesky

***

### FAQ

**Do I need a Lemmy account?** No. The actor uses the public API.

**Which instances work?** Any Lemmy server. Set it in **Instance**.

**Does it get NSFW posts?** Only if the instance shows them publicly. Each row has an `nsfw` flag.

**How fast is it?** About 50 items a second, with polite pauses between pages.

**Is it legal?** It reads public posts through Lemmy's open API.

***

### Support

- Docs and examples: https://github.com/andersonjames38phd-cpu/lemmy-posts-comments
- Community Discord: https://discord.gg/8SrXSCpvgj

Built and maintained by [Turboextract](https://apify.com/Turboextract) on the Apify platform.

# Actor input Schema

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

Keywords to search. Empty lists the newest items from the communities or the whole instance.

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

Community names or URLs, like technology or technology@lemmy.world.

## `contentType` (type: `string`):

Posts or comments.

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

Order of results.

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

Lemmy server to read from.

## `minScore` (type: `integer`):

Skip items below this score.

## `postedWithinDays` (type: `integer`):

Only items from the last N days. 0 means no limit.

## `maxResultsPerQuery` (type: `integer`):

Per search query or community.

## `maxResults` (type: `integer`):

Stop after this many posts or comments in total. You only pay for what is delivered.

## Actor input object example

```json
{
  "searchQueries": [
    "linux"
  ],
  "contentType": "posts",
  "sort": "New",
  "instance": "lemmy.world",
  "minScore": 0,
  "postedWithinDays": 0,
  "maxResultsPerQuery": 100,
  "maxResults": 500
}
```

# Actor output Schema

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

One row per post or comment with score, author, community and date.

# 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 = {
    "searchQueries": [
        "linux"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("turboextract/lemmy-posts-comments").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 = { "searchQueries": ["linux"] }

# Run the Actor and wait for it to finish
run = client.actor("turboextract/lemmy-posts-comments").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 '{
  "searchQueries": [
    "linux"
  ]
}' |
apify call turboextract/lemmy-posts-comments --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,turboextract/lemmy-posts-comments"
        }
    }
}
```

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/dGf32CX39Eg0gqusx/builds/S99IORGnci1cmXbxh/openapi.json
