# Mastodon Scraper - Posts, Hashtags & Profiles (`liver0914/mastodon-scraper-lite`) Actor

Scrape Mastodon posts by hashtag or account from any instance - no login needed. Post text, engagement stats, author info and verified profile links. JSON, CSV, Excel export.

- **URL**: https://apify.com/liver0914/mastodon-scraper-lite.md
- **Developed by:** [Long Li](https://apify.com/liver0914) (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 $2.00 / 1,000 post scrapeds

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

## Mastodon Scraper - Posts, Hashtags & Profiles

Scrape **Mastodon** posts by hashtag or account handle from **any instance** — no login required. Get post text, engagement stats, author info (followers, verified links) and full profile data in clean JSON, CSV or Excel.

### What you get

**Posts** (from hashtag timelines or account feeds):

| Field | Description |
|---|---|
| `text`, `url`, `createdAt` | Post content (HTML stripped to plain text) |
| `favourites`, `boosts`, `replies`, `quotes` | Engagement metrics |
| `authorHandle`, `authorName`, `authorFollowers` | Author info embedded in every post |
| `hashtags`, `mentions`, `mediaCount`, `mediaTypes` | Structure |
| `isReblog`, `reblogOfUrl`, `language`, `visibility` | Classification |

**Profiles** (per scraped handle): `handle`, `displayName`, `bio`, `followers`, `following`, `posts`, `createdAt`, and `verifiedFields` — the account's verified profile links (websites, GitHub, ...) with verification timestamps. Great for lead generation and community research.

### Input

- **Hashtags** — e.g. `mastodon`, `ai` (latest public posts per tag)
- **Account handles** — e.g. `Gargron` (local) or `user@instance.tld` (remote)
- **Instance** — any Mastodon server (`mastodon.social`, `mas.to`, your own). All instances expose the same public API
- Limits per source, optional access token for higher rate limits

### Why this one

- **No login, no API keys** — public endpoints only; the optional token just raises rate limits
- **Any instance** — not hard-coded to one server
- **Clean output** — HTML stripped, flat fields, named dataset views (Posts / Profiles), ready for CSV/Excel export
- **Cross-source dedupe** — combine hashtags and handles in one run
- Part of a fediverse toolset: pair it with the [Bluesky Scraper Lite](https://apify.com/liver0914/bluesky-scraper-lite) for decentralized social monitoring

### How to scrape any Mastodon instance without a login

Every Mastodon server exposes the same public REST API — hashtag timelines, account posts and profiles need no authentication (about 300 requests per 5 minutes per IP). Two quirks are handled for you: some instances prepend an anti-scraping JavaScript block to JSON responses (stripped automatically), and remote accounts that 404 on lookup are re-resolved on their home instance. Just set the *Instance* field and go.

### FAQ

**Do I need an access token?**
No. Public hashtag timelines and account posts work without login. Provide one only if you hit rate limits (about 300 requests / 5 minutes without a token).

**Which instances are supported?**
Any server running standard Mastodon API v1 — mastodon.social, mas.to, fosstodon.org, and thousands more. Just set the *Instance* field.

**How far back does scraping go?**
Hashtag timelines return the most recent posts and paginate backwards (40 per page) up to your max-posts limit. Account feeds work the same way.

**Can I scrape a user from a different instance than the one I query?**
Yes — pass the full handle like `user@instance.tld`; it resolves across the fediverse via the public lookup API.

**Is there an API?**
Yes — every run is callable via `POST /v2/acts/liver0914~mastodon-scraper-lite/runs`, with webhooks and sync variants. See the Apify API tab.

### Pricing

Free to try. When pay-per-event pricing is enabled, you pay only per scraped post or profile.

***

Built by [Long Li](https://apify.com/liver0914). Also try the [Bluesky Scraper Lite](https://apify.com/liver0914/bluesky-scraper-lite), [Rumble Scraper Lite](https://apify.com/liver0914/rumble-scraper-lite), [Contact Info Scraper Lite](https://apify.com/liver0914/contact-info-scraper-lite), [Cloudflare Bypasser Lite](https://apify.com/liver0914/cloudflare-bypasser-lite) and [GitHub Email Scraper Lite](https://apify.com/liver0914/github-email-scraper-lite).

# Actor input Schema

## `hashtags` (type: `array`):

Hashtags to scrape (without the #), e.g. "mastodon" or "ai". Returns the latest public posts for each tag.

## `handles` (type: `array`):

Account handles to scrape posts from, e.g. "Gargron" (local) or "user@instance.tld" (remote).

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

Mastodon instance to query (all of them expose the same public API).

## `maxPostsPerHashtag` (type: `integer`):

Stop after this many posts per hashtag (40 per page).

## `maxPostsPerHandle` (type: `integer`):

Stop after this many posts per account (40 per page).

## `includeProfiles` (type: `boolean`):

Also push a full profile item (bio, follower counts, verified links) for every scraped handle.

## `accessToken` (type: `string`):

Optional Mastodon access token for higher rate limits. Public endpoints work without it.

## `maxConcurrency` (type: `integer`):

Number of parallel API requests.

## `proxyConfig` (type: `object`):

Optional. Mastodon's public API is scraper-friendly; proxies are usually not needed.

## Actor input object example

```json
{
  "hashtags": [
    "mastodon"
  ],
  "handles": [],
  "instance": "mastodon.social",
  "maxPostsPerHashtag": 40,
  "maxPostsPerHandle": 40,
  "includeProfiles": true,
  "maxConcurrency": 4,
  "proxyConfig": {}
}
```

# Actor output Schema

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

All scraped posts and profiles in the default dataset.

# 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 = {
    "hashtags": [
        "mastodon"
    ],
    "handles": [],
    "instance": "mastodon.social",
    "proxyConfig": {}
};

// Run the Actor and wait for it to finish
const run = await client.actor("liver0914/mastodon-scraper-lite").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 = {
    "hashtags": ["mastodon"],
    "handles": [],
    "instance": "mastodon.social",
    "proxyConfig": {},
}

# Run the Actor and wait for it to finish
run = client.actor("liver0914/mastodon-scraper-lite").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 '{
  "hashtags": [
    "mastodon"
  ],
  "handles": [],
  "instance": "mastodon.social",
  "proxyConfig": {}
}' |
apify call liver0914/mastodon-scraper-lite --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,liver0914/mastodon-scraper-lite"
        }
    }
}
```

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/szQD2WSmMxJYCTPyr/builds/tWUNEjtP7UriCHh2A/openapi.json
