# Mastodon Scraper - Hashtags, Accounts & Posts (No Login) (`zhucl1006/mastodon-hashtag-account-scraper`) Actor

Scrape public Mastodon posts by hashtag, account or trending on any instance (mastodon.social, fosstodon, etc.) via the official public API - no login or token. Text, author, followers, boosts, favourites, links, media as JSON. Brand and topic monitoring for the fediverse. $1 per 1,000 posts.

- **URL**: https://apify.com/zhucl1006/mastodon-hashtag-account-scraper.md
- **Developed by:** [leo zhu](https://apify.com/zhucl1006) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 mastodon 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

## Mastodon Scraper - Hashtags, Accounts & Trending Posts (No Login)

Scrape **public Mastodon posts** by **hashtag**, **account** or **trending** on any Mastodon instance (mastodon.social, fosstodon.org, mstdn.social, infosec.exchange ...) and export clean JSON / CSV / Excel. Uses the **official public Mastodon REST API** - no account, no access token, no browser, no proxies. 80 posts in about 2 seconds.

### Who uses it

- **Brand & community managers**: monitor your product hashtag or competitors' accounts across the fediverse every day.
- **Social listening & PR agencies**: add Mastodon to your Twitter/X, Bluesky and Reddit monitoring - many developer, open-source, science and journalism communities moved here.
- **Researchers**: collect posts on a topic with engagement metrics (replies, boosts, favourites) and language.
- **Content & LLM pipelines**: feed trending posts or a hashtag stream into n8n, Make, Zapier or an LLM summary.
- **Developer relations**: track #opensource, #python, #rust and your project's tag, and find the most-followed authors.

### Input

| Field | Description |
|---|---|
| `hashtags` | Hashtags without `#`. Each is read from every instance in `instances`. |
| `accounts` | `user@instance` (e.g. `Gargron@mastodon.social`). |
| `trending` | Also fetch each instance's trending posts. |
| `instances` | Servers to read from (default `mastodon.social`). Large servers federate posts from the whole network. |
| `maxPostsPerSource` | 1-5000 (default 40). |
| `onlyNewerThanDays` | Date filter, e.g. `1` for a daily scheduled monitor. |
| `keywords`, `language` | Optional text / language filters (filtered posts are not charged). |
| `localOnly`, `includeReplies`, `includeBoosts` | Fine-tuning. |

Example - daily brand monitor:

```json
{ "hashtags": ["n8n", "selfhosted"], "accounts": ["n8n_io@mastodon.social"], "instances": ["mastodon.social", "fosstodon.org"], "onlyNewerThanDays": 1, "maxPostsPerSource": 500 }
```

### Output (one row per post)

```json
{
  "sourceType": "hashtag",
  "source": "python",
  "instance": "mastodon.social",
  "id": "117487750868640455",
  "url": "https://mastodon.social/@lobsters/117487750868640455",
  "createdAt": "2026-10-23T02:00:07.935Z",
  "text": "UUIDv7 doesn't have the properties you think it does ... #distributed #python",
  "language": "en",
  "author": "lobsters@mastodon.social",
  "authorName": "Lobsters",
  "authorFollowers": 4029,
  "replies": 0, "boosts": 0, "favourites": 1,
  "hashtags": ["distributed", "python"],
  "mentions": ["robalex@indieweb.social"],
  "linkUrl": "https://lobste.rs/s/kcyzco",
  "linkTitle": "UUIDv7 doesn't have the properties you think it does",
  "media": [],
  "isReply": false, "isBoost": false
}
```

HTML is converted to plain text. Posts are deduplicated within a run. A `RUN_SUMMARY` record is saved in the key-value store.

### Pricing (pay per event)

- **$0.001 per post saved** (`mastodon-post`) - $1 per 1,000 posts.
- Tiny start fee per run (`apify-actor-start`).
- Failed sources, duplicates and filtered posts are not charged. Set "Maximum cost per run" to cap spend.

### Notes & limits

- Only **public** posts that the instance serves without login. Free-text search of posts requires a logged-in account on Mastodon, so this Actor uses hashtags, accounts and trends (plus the keyword filter).
- Respect each instance's rules and the authors' privacy; do not use the data for spam. Not affiliated with Mastodon gGmbH.

### FAQ

**Do I need a Mastodon account or token?** No.
**Which instance should I use?** `mastodon.social` sees most of the network; add niche servers (fosstodon.org for open source, infosec.exchange for security) for more local posts.

# Actor input Schema

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

Hashtags without # (e.g. opensource). Each is fetched from every instance below.

## `accounts` (type: `array`):

Accounts as user@instance (e.g. Gargron@mastodon.social). Posts are read from the account's home instance.

## `trending` (type: `boolean`):

Also fetch the trending posts of each instance.

## `instances` (type: `array`):

Mastodon servers to read hashtags / trends from. Big servers see posts from across the fediverse.

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

Max posts per source.

## `onlyNewerThanDays` (type: `integer`):

0 = no limit. Use 1 for a daily scheduled monitor.

## `keywords` (type: `array`):

Optional: keep only posts whose text contains any of these words (case-insensitive). Filtered posts are not charged.

## `language` (type: `string`):

Optional ISO code (en, de, ja...) to keep only posts in that language.

## `localOnly` (type: `boolean`):

Only posts written on that instance.

## `includeReplies` (type: `boolean`):

Include replies.

## `includeBoosts` (type: `boolean`):

Include boosts (accounts).

## Actor input object example

```json
{
  "hashtags": [
    "opensource",
    "ai"
  ],
  "trending": false,
  "instances": [
    "mastodon.social"
  ],
  "maxPostsPerSource": 40,
  "onlyNewerThanDays": 0,
  "localOnly": false,
  "includeReplies": true,
  "includeBoosts": false
}
```

# Actor output Schema

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

No description

## `runSummary` (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 = {
    "hashtags": [
        "opensource",
        "ai"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("zhucl1006/mastodon-hashtag-account-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 = { "hashtags": [
        "opensource",
        "ai",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("zhucl1006/mastodon-hashtag-account-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 '{
  "hashtags": [
    "opensource",
    "ai"
  ]
}' |
apify call zhucl1006/mastodon-hashtag-account-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,zhucl1006/mastodon-hashtag-account-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/QO1ARm8epJGGqliwL/builds/VhX6J4E1XoxhQSdeo/openapi.json
