Lemmy Scraper (Apify Actor)

Lemmy posts and comments scraper: get posts, comments and communities from any Lemmy instance public API (default lemmy.world), search Lemmy communities and posts. No login. $0.25 per 1,000 results. Runs as an Apify Actor, callable from MCP clients via the Apify MCP server (https://mcp.apify.com/?actors=pennydata/lemmy-scraper-posts-comments-communities).

Hosted MCP Server

npx add-mcp 'https://mcp.apify.com/?actors=pennydata/lemmy-scraper-posts-comments-communities'

Installs into Claude Code, Codex, Cursor and more

Documentation

Lemmy Scraper - Federated Reddit Alternative Posts & Comments (pennydata/lemmy-scraper-posts-comments-communities) Actor

Lemmy posts and comments scraper: get posts, comments and communities from any Lemmy instance public API (default lemmy.world), search Lemmy communities and posts. No login. $0.25 per 1,000 results.

Pricing

$0.25 / 1,000 result (post, comment or community)s

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 section below.

Each client library has reference documentation the quickstart does not restate: JavaScript/TypeScript (npm install apify-client) and Python (pip install apify-client).

README

Lemmy Scraper: Posts, Comments & Communities

Scrape Lemmy without a login: post feeds, search results, comments and community lists as flat JSON rows. It reads the public Lemmy API (/api/v3) of any instance, default lemmy.world. At $0.25 per 1,000 results it is cheaper than other Lemmy scrapers on the Store, with no start fee. Errors and empty results are not charged.

Built with AI assistance (Claude). Not affiliated with or endorsed by Lemmy or any instance.

Modes

ModeRows (recordType)Typical use
postspost: title, link, body, community, author, score, upvotes, downvotes, comment count, publishedMonitor a community or the instance feed
searchpost: same fields, matching queryBrand and keyword monitoring
commentscomment: text, author, score, reply count, tree path, parent postSentiment and discussion datasets
communitiescommunity: name, title, description, subscribers, posts, commentsFind communities to track

Input examples

Run with the default input (25 newest posts on lemmy.world), or:

{ "instance": "lemmy.world", "mode": "posts", "community": "technology", "sort": "TopWeek", "maxItems": 100 }
{ "instance": "lemmy.ml", "mode": "search", "query": "linux", "maxItems": 50 }
{ "mode": "comments", "postUrls": ["https://lemmy.world/post/1"], "maxItems": 200 }
{ "instance": "beehaw.org", "mode": "communities", "maxItems": 100 }

Coming from legend006/lemmy-scraper? Your existing input works unchanged. Accepted: mode community / search / instance, communities (one feed per community), searchQueries (one search per keyword), sort Top with topRange, includeComments and maxCommentsPerPost. Rows use this Actor's own field names; comment rows are charged like any other result.

Pricing

Pay per event: $0.00025 per result row (one post, comment or community). No start fee. maxItems caps your spend.

Good citizenship

Requests go to the instance you name, at most 1 per second per instance, with an identifying User-Agent, and back off on HTTP 429. Only public data the instance already serves without login is returned. Posts and comments contain public usernames; use the data in line with the instance's rules and applicable privacy law.

Output

Each row has recordType, instance, id, link and the fields for its type (see the dataset schema). Error rows (recordType: error) are free.

Actor input Schema

instance (type: string):

Hostname of the Lemmy instance to read, e.g. lemmy.world, lemmy.ml, sh.itjust.works, beehaw.org. A full URL also works.

mode (type: string):

posts = post feed (optionally one community), search = search posts for a query, comments = comments of the posts in postUrls, communities = list communities. community and instance are accepted for legend006/lemmy-scraper inputs: community = posts of each community in communities, instance = the instance-wide feed.

community (type: string):

Community name such as technology or technology@lemmy.world. Empty = the instance's all-posts feed.

query (type: string):

Text to search for. Required in search mode.

sort (type: string):

Sort order for posts, search and communities. Top uses topRange (default TopWeek). Active, MostComments and NewComments are Lemmy sorts for posts and search.

postUrls (type: array):

Lemmy post URLs such as https://lemmy.world/post/1234567. Comments are read from the instance in each URL.

maxItems (type: integer):

Maximum result rows (cost guard: each row is charged). Applies per post URL in comments mode.

communities (type: array):

Accepted so inputs saved for legend006/lemmy-scraper run unchanged. Community names such as asklemmy or asklemmy@lemmy.ml; posts of each are read when mode is community, or when mode is left as posts.

searchQueries (type: array):

Accepted so inputs saved for legend006/lemmy-scraper run unchanged. Keywords for search mode, one search per entry (merged with query).

topRange (type: string):

Accepted so inputs saved for legend006/lemmy-scraper run unchanged. Time window when sort is Top.

includeComments (type: boolean):

Accepted so inputs saved for legend006/lemmy-scraper run unchanged. After each post row, also return its comments (each comment row is charged as a result).

maxCommentsPerPost (type: integer):

Accepted so inputs saved for legend006/lemmy-scraper run unchanged. Cap on comment rows per post when includeComments is on.

Actor input object example

{
  "instance": "lemmy.world",
  "mode": "posts",
  "sort": "New",
  "postUrls": [
    "https://lemmy.world/post/1"
  ],
  "maxItems": 25,
  "topRange": "TopWeek",
  "includeComments": false,
  "maxCommentsPerPost": 50
}

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

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",
    "mode": "posts",
    "sort": "New",
    "postUrls": [
        "https://lemmy.world/post/1"
    ],
    "maxItems": 25
};

// Run the Actor and wait for it to finish
const run = await client.actor("pennydata/lemmy-scraper-posts-comments-communities").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

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",
    "mode": "posts",
    "sort": "New",
    "postUrls": ["https://lemmy.world/post/1"],
    "maxItems": 25,
}

# Run the Actor and wait for it to finish
run = client.actor("pennydata/lemmy-scraper-posts-comments-communities").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

echo '{
  "instance": "lemmy.world",
  "mode": "posts",
  "sort": "New",
  "postUrls": [
    "https://lemmy.world/post/1"
  ],
  "maxItems": 25
}' |
apify call pennydata/lemmy-scraper-posts-comments-communities --silent --output-dataset

MCP server setup

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

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/Ux1dRpVJrhdqosN2U/builds/BJWsmxQpJLzenlz9d/openapi.json