# PeerTube Instance Harvester (`datamule/peertube-instance-harvester`) Actor

Point at any PeerTube instance and export its videos, channels and instance metadata from the public /api/v1 REST API. Federated, self-hosted YouTube alternative — one actor over thousands of instances.

- **URL**: https://apify.com/datamule/peertube-instance-harvester.md
- **Developed by:** [Datamule](https://apify.com/datamule) (community)
- **Categories:** Social media, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.35 / 1,000 videos

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js/docs.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python/docs.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## PeerTube Instance Harvester

**Point at any PeerTube instance and export its videos, channels and instance metadata to a
structured dataset — from the public `/api/v1` REST API.**

[PeerTube](https://joinpeertube.org/) is the ActivityPub-federated, self-hosted alternative to
YouTube. Every instance — [framatube.org](https://framatube.org),
[makertube.net](https://makertube.net), [tube.tchncs.de](https://tube.tchncs.de) and thousands
more — exposes the **identical public `/api/v1` REST API** with no auth for public content. This
one actor works against **all of them**: no per-instance scraper, no host enumeration. Give it an
instance URL and it turns that instance's video timeline, search results, channel directory, or
server metadata into clean rows.

### Why this actor

Most "PeerTube" tools on the market clone a single instance or scrape the web UI. This is a
**generic runner over the protocol** — the same field is read by key presence on every instance,
so an instance that omits an optional field yields `null` for that column instead of breaking.
One actor, thousands of federated video sources.

It also captures **federation correctly**: a video listed on `framatube.org` may actually live on
`tube.tchncs.de`. The real origin `host` is captured on every row, alongside the instance you
queried (`_source`).

### Modes

The run mode is chosen from your input:

| Mode | How to trigger | What you get |
|------|----------------|--------------|
| **Videos** (default) | `mode: videos` (or just an instance URL) | One row per video from `/api/v1/videos`. Add a `search` term to use `/api/v1/search/videos`. Sort with `sort` (default newest first). |
| **Channels** | `mode: channels` | One row per channel from `/api/v1/video-channels` (name, host, followers, owner account). |
| **Discovery** | `mode: discovery` or `listOnly: true` | One row describing the instance: name, server version, signup policy, short description, total video count. A cheap way to inspect an instance. |

### Input

| Field | Type | Description |
|-------|------|-------------|
| `instanceUrl` | string (required) | Root of a PeerTube instance, e.g. `https://framatube.org`. The `/api/v1` path is appended for you. |
| `mode` | string | `videos` (default), `channels`, or `discovery`. |
| `search` | string | Videos mode: free-text search across the instance's federated index. |
| `sort` | string | Videos mode: sort order (default `-publishedAt`). Also accepts `-views`, `-likes`, `-trending`, `name`, … |
| `includeNsfw` | boolean | Videos mode: include NSFW videos (default `false`). |
| `listOnly` | boolean | Shortcut for discovery mode. |
| `maxRecords` | integer | Global cap on rows emitted (deterministic sample). |
| `bearer` | string (secret) | Optional token for a private / rate-limited instance. Never required for public content, never logged. |
| `extraHeaders` | object | Optional extra HTTP headers for gated instances. |

#### Example — newest videos from Framatube

```json
{ "instanceUrl": "https://framatube.org", "mode": "videos", "maxRecords": 50 }
````

#### Example — search a large instance

```json
{ "instanceUrl": "https://makertube.net", "search": "blender", "maxRecords": 100 }
```

#### Example — inspect an instance cheaply

```json
{ "instanceUrl": "https://tube.tchncs.de", "listOnly": true }
```

### Output

One flat, fully-nullable row per record. Video rows include: `id`, `uuid`, `shortUUID`, `name`,
`description`, **`url`** (canonical watch URL), `duration`, `views`, `likes`, `dislikes`, `nsfw`,
`isLive`, `publishedAt`, `originallyPublishedAt`, promoted `category` / `licence` / `language` /
`privacy` labels, `channelName` / `channelDisplayName` / `channelUrl`, `accountName` /
`accountUrl`, **`host`** (the real federating instance), `thumbnailPath` / `previewPath` /
`embedPath`, plus a lossless `_raw` object holding the complete original record.

```json
{
  "_type": "video",
  "_source": "https://framatube.org",
  "_mode": "videos",
  "name": "Wie fährst du dein Projekt zuverlässig an die Wand?",
  "url": "https://tube.tchncs.de/videos/watch/007c7bd1-5860-40f4-9850-e8c57a0867c1",
  "duration": 3799,
  "views": 4,
  "likes": 1,
  "category": "Science & Technology",
  "language": "German",
  "channelDisplayName": "Software Architektur im Stream",
  "host": "tube.tchncs.de",
  "publishedAt": "2026-07-06T09:00:32.097Z"
}
```

### Pricing

Pay-per-event: one **Video** event per emitted row (video, channel, or instance record). You only
pay for records you receive.

### Notes

- An empty instance or a no-match search returns 0 records and a clean exit.
- A URL that is not a PeerTube instance (an HTML page, a 404, JSON without the expected shape)
  fails fast with a clear message — nothing is fabricated.
- Find instances via the [PeerTube instances directory](https://instances.joinpeertube.org/).

# Actor input Schema

## `instanceUrl` (type: `string`):

Root URL of ANY PeerTube instance. PeerTube is the ActivityPub-federated, self-hosted YouTube alternative; every instance exposes the identical public /api/v1 REST API with no auth for public content, so one actor works against all of them: https://framatube.org, https://makertube.net, https://tube.tchncs.de, or any of the thousands of self-hosted instances. The /api/v1 path is appended for you (paste either the root or a /api/v1 URL). The run MODE is chosen from the 'mode' / 'listOnly' / 'search' fields below.

## `mode` (type: `string`):

What to harvest. 'videos' (default) lists videos via /api/v1/videos (or /api/v1/search/videos when a search term is set). 'channels' lists the instance's video channels via /api/v1/video-channels. 'discovery' returns ONE row describing the instance (name, version, signup policy, short description, total video count) so you can inspect an instance cheaply before a full run.

## `search` (type: `string`):

VIDEOS MODE. A free-text search term — switches the run to GET /api/v1/search/videos?search=... and returns one row per matching video across the instance's federated index. Leave empty to list the instance's full video timeline (newest first). A term that matches nothing yields 0 records and a clean exit.

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

VIDEOS MODE. Sort order for the video listing. Defaults to -publishedAt (newest first). PeerTube commonly accepts: -publishedAt, publishedAt, -views, views, -likes, -trending, -hot, name, -duration. Left as free text so any instance's accepted value passes through.

## `includeNsfw` (type: `boolean`):

VIDEOS MODE. When false (default) NSFW videos are excluded (nsfw=false). Set true to include them (nsfw=both).

## `listOnly` (type: `boolean`):

Shortcut for discovery mode: when true, ignore 'mode' and emit ONLY the single instance-info row (name, version, signup, total video count). A cheap way to probe an instance before harvesting it.

## `maxRecords` (type: `integer`):

A GLOBAL cap on the number of rows to emit. The rendered default is 25, so a first run emits at most 25 rows. Each emitted video, channel, or discovery row is one billable `video` event under the current pricing contract. Pagination stops as soon as the cap is reached, so the default is a cheap, deterministic sample. Raise the value explicitly to fetch more matching rows.

## `bearer` (type: `string`):

Optional access token for a private / registration-required / rate-limited instance (sent as Authorization: Bearer \*\*\*). Not required for public content. Never logged.

## `extraHeaders` (type: `object`):

Optional extra HTTP headers as a JSON object, e.g. {"x-api-key": "..."} for gated instances. Not required for public content. Header values are never logged.

## Actor input object example

```json
{
  "instanceUrl": "https://framatube.org",
  "mode": "videos",
  "sort": "-publishedAt",
  "includeNsfw": false,
  "listOnly": false,
  "maxRecords": 25
}
```

# 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

```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 = {
    "instanceUrl": "https://framatube.org",
    "maxRecords": 25
};

// Run the Actor and wait for it to finish
const run = await client.actor("datamule/peertube-instance-harvester").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 = {
    "instanceUrl": "https://framatube.org",
    "maxRecords": 25,
}

# Run the Actor and wait for it to finish
run = client.actor("datamule/peertube-instance-harvester").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "instanceUrl": "https://framatube.org",
  "maxRecords": 25
}' |
apify call datamule/peertube-instance-harvester --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=datamule/peertube-instance-harvester",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "PeerTube Instance Harvester",
        "description": "Point at any PeerTube instance and export its videos, channels and instance metadata from the public /api/v1 REST API. Federated, self-hosted YouTube alternative — one actor over thousands of instances.",
        "version": "0.1",
        "x-build-id": "zBPQGdas3eROsVZfK"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/datamule~peertube-instance-harvester/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-datamule-peertube-instance-harvester",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/datamule~peertube-instance-harvester/runs": {
            "post": {
                "operationId": "runs-sync-datamule-peertube-instance-harvester",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/datamule~peertube-instance-harvester/run-sync": {
            "post": {
                "operationId": "run-sync-datamule-peertube-instance-harvester",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "instanceUrl"
                ],
                "properties": {
                    "instanceUrl": {
                        "title": "PeerTube instance URL",
                        "type": "string",
                        "description": "Root URL of ANY PeerTube instance. PeerTube is the ActivityPub-federated, self-hosted YouTube alternative; every instance exposes the identical public /api/v1 REST API with no auth for public content, so one actor works against all of them: https://framatube.org, https://makertube.net, https://tube.tchncs.de, or any of the thousands of self-hosted instances. The /api/v1 path is appended for you (paste either the root or a /api/v1 URL). The run MODE is chosen from the 'mode' / 'listOnly' / 'search' fields below."
                    },
                    "mode": {
                        "title": "Mode",
                        "enum": [
                            "videos",
                            "channels",
                            "discovery"
                        ],
                        "type": "string",
                        "description": "What to harvest. 'videos' (default) lists videos via /api/v1/videos (or /api/v1/search/videos when a search term is set). 'channels' lists the instance's video channels via /api/v1/video-channels. 'discovery' returns ONE row describing the instance (name, version, signup policy, short description, total video count) so you can inspect an instance cheaply before a full run.",
                        "default": "videos"
                    },
                    "search": {
                        "title": "Search query (videos mode)",
                        "type": "string",
                        "description": "VIDEOS MODE. A free-text search term — switches the run to GET /api/v1/search/videos?search=... and returns one row per matching video across the instance's federated index. Leave empty to list the instance's full video timeline (newest first). A term that matches nothing yields 0 records and a clean exit."
                    },
                    "sort": {
                        "title": "Sort (videos mode)",
                        "type": "string",
                        "description": "VIDEOS MODE. Sort order for the video listing. Defaults to -publishedAt (newest first). PeerTube commonly accepts: -publishedAt, publishedAt, -views, views, -likes, -trending, -hot, name, -duration. Left as free text so any instance's accepted value passes through.",
                        "default": "-publishedAt"
                    },
                    "includeNsfw": {
                        "title": "Include NSFW videos (videos mode)",
                        "type": "boolean",
                        "description": "VIDEOS MODE. When false (default) NSFW videos are excluded (nsfw=false). Set true to include them (nsfw=both).",
                        "default": false
                    },
                    "listOnly": {
                        "title": "Discovery only (instance info)",
                        "type": "boolean",
                        "description": "Shortcut for discovery mode: when true, ignore 'mode' and emit ONLY the single instance-info row (name, version, signup, total video count). A cheap way to probe an instance before harvesting it.",
                        "default": false
                    },
                    "maxRecords": {
                        "title": "Max records (global cap)",
                        "minimum": 1,
                        "type": "integer",
                        "description": "A GLOBAL cap on the number of rows to emit. The rendered default is 25, so a first run emits at most 25 rows. Each emitted video, channel, or discovery row is one billable `video` event under the current pricing contract. Pagination stops as soon as the cap is reached, so the default is a cheap, deterministic sample. Raise the value explicitly to fetch more matching rows.",
                        "default": 25
                    },
                    "bearer": {
                        "title": "Bearer token",
                        "type": "string",
                        "description": "Optional access token for a private / registration-required / rate-limited instance (sent as Authorization: Bearer ***). Not required for public content. Never logged."
                    },
                    "extraHeaders": {
                        "title": "Extra request headers",
                        "type": "object",
                        "description": "Optional extra HTTP headers as a JSON object, e.g. {\"x-api-key\": \"...\"} for gated instances. Not required for public content. Header values are never logged."
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
