Claude Skill

peertube

Browse PeerTube federated video from the terminal — instance stats, latest

LLM Mart · 0 points · 14 views 0 listing impressions 0 install-command copies
Download magnus919-agent-skills-peertube-addad86.zip · 43 KB

Install

skills CLI npx skills add https://github.com/magnus919/agent-skills/tree/main/peertube
Claude Code claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install magnus919-agent-skills@llmmart
Git git clone https://github.com/magnus919/agent-skills.git

The skills CLI installs just this skill, for any of its supported agents. Claude Code installs the whole magnus919/agent-skills collection as a plugin from our marketplace. Git is the plain clone.

README

PeerTube — Federated Video from the Terminal

Browse any PeerTube instance from the command line: latest videos, video detail, comment threads, channels and accounts, instance stats, and OAuth2 login for your own account — plus fediverse-wide search through SepiaSearch.

Why Install This Skill

When your agent loads this skill, it can navigate the federated video universe without a browser. That means:

  • Browse any instance — latest videos with real offset pagination (the API has no page parameter, and most naive wrappers get this wrong)
  • Search the right scope — instance-local search or the whole fediverse via SepiaSearch, with the searchTarget semantics documented instead of guessed
  • Inspect videos deeply — full metadata, comment threads (the hyphenated /comment-threads route), channels, and accounts by handle (name@host)
  • Check instance health — name, description, and user/video/view counters composed from /config/about + /server/stats anonymously
  • Authenticate safely — OAuth2 password grant with per-instance, owner-only token persistence, automatic refresh, and proper server-side revocation on logout
  • Avoid the traps — masked client_secret responses, token lifetimes that vary per instance, 2FA x-peertube-otp, rate-limit headers, RFC7807 error bodies

Every command is read-only except login/logout, and --dry-run previews any request without touching the network.

What You Get

Path Purpose
SKILL.md Complete command reference with setup, gotchas, and recipes
scripts/peertube CLI for PeerTube API operations (--json, --dry-run, --verbose)
scripts/test_peertube.py Offline test suite (all HTTP mocked, zero egress)
references/auth-and-tokens.md The full OAuth2 flow, secret masking, token hygiene
references/search-and-discovery.md Instance-local vs SepiaSearch search scopes
references/endpoint-catalog.md Endpoint-by-endpoint parameters and response shapes
references/gotchas-field-guide.md Failure signatures and version drift
references/worked-recipes.md Multi-step CLI/jq and curl workflows
evals/evals.json Behavioral eval cases including negative triggers

Quick Start

export PEERTUBE_SERVER="https://<INSTANCE_HOST>"   # any PeerTube instance
scripts/peertube server                            # instance stats, anonymous
scripts/peertube videos --limit 5 --json
scripts/peertube search --query "linux"            # searches THIS instance

Fediverse-wide search through SepiaSearch (same API shape, wider index):

PEERTUBE_SERVER="https://sepiasearch.org" scripts/peertube search --query "linux"

Optional login for your own account commands:

scripts/peertube login --username "<USERNAME>" --prompt
scripts/peertube me --json | jq '.role.label'
scripts/peertube logout                            # revokes server-side + deletes token file

Triggers

Load this when asking about PeerTube, federated video, decentralized video platforms, SepiaSearch, browsing a specific PeerTube instance's videos or channels, or PeerTube API authentication.

Requirements

Python 3.8+ with requests. One thing this skill always needs from you: an instance host — export PEERTUBE_SERVER (e.g. https://<INSTANCE_HOST>) or pass --server https://... per command, since PeerTube is federated and every command targets one instance. Reads are anonymous; me/my-videos need a token from scripts/peertube login. Tokens persist to ~/.config/peertube/token.json (override the directory with PEERTUBE_CONFIG_DIR). Find public instances at joinpeertube.org.

Skill manifest

peertube — PeerTube federated video from the terminal

Browse any PeerTube instance — a federated deployment, not a single API — from the terminal: instance stats, latest videos, full video detail, comment threads, channels, accounts, and instance-local search. Authenticate with OAuth2 only for your own account commands. Every command is read-only except login/logout.

Setup

  1. Choose the instance to talk to. Every command is per-instance; the API shape is identical everywhere, but accounts, tokens, rules, and catalogs are not:
export PEERTUBE_SERVER="https://<INSTANCE_HOST>"   # e.g. https://tilvids.com

To search the whole fediverse instead of one instance, point the same variable at the public search index: PEERTUBE_SERVER=https://sepiasearch.org (same API shape — see references/search-and-discovery.md).

  1. Nothing else is required to browse: videos, search, channels, comments, and instance info are anonymous reads.

  2. (Optional) Log in only for your own account commands (me, my-videos):

scripts/peertube login --username <NAME> --prompt

How authentication works

PeerTube uses plain OAuth2 with per-instance client credentials: the CLI anonymously fetches the client pair from GET /api/v1/oauth-clients/local (singular local), then exchanges your username/password for a bearer token at POST /api/v1/users/token (grant_type=password, form-encoded). The token rides Authorization: Bearer <token>, lives for the instance's configured lifetime (read expires_in from the response — do not assume a fixed number), and is refreshed automatically when it expires. The token file is written owner-only to ~/.config/peertube/token.json keyed by server URL. Do not commit tokens — they are account credentials; revoke with scripts/peertube logout (POST /users/revoke-token) when done. Current production instances mask client_secret in the API response; the CLI detects this and explains the workaround. Details and wire-level error signatures: references/auth-and-tokens.md.

Essential Commands

server — instance stats and identity (anonymous)

scripts/peertube server              # name, description, user/video/view counters
scripts/peertube server --json

Composes GET /config/about + GET /server/stats (canonical paths — there is no /instance/stats).

videos — browse the instance's uploads (anonymous)

scripts/peertube videos                       # latest 15, offset pagination
scripts/peertube videos --limit 50 --offset 50
scripts/peertube videos --sort -views --json  # popular first

Pagination is start/count offsets (max count 100) — the API has no page parameter.

search — find videos on THIS instance (anonymous)

scripts/peertube search --query "linux"            # instance-local (searchTarget=local)
scripts/peertube search -q "docker" --limit 20 --json
PEERTUBE_SERVER="https://sepiasearch.org" scripts/peertube search -q "linux"   # fediverse-wide

The bundled CLI performs instance-local search only (searchTarget=local). For fediverse-wide search, point PEERTUBE_SERVER at SepiaSearch — same commands, wider index. Search results carry channel.host/url, the origin instance of federated hits.

video — full detail for one video (anonymous)

scripts/peertube video --id <UUID>          # numeric id, UUID, or shortUUID all work
scripts/peertube video --id <UUID> --json | jq '{name, description, views, url}'

comments — top-level comment threads (anonymous)

scripts/peertube comments --id <UUID>                 # GET /videos/{id}/comment-threads
scripts/peertube comments --id <UUID> --limit 30 --json

channels / channel / account — creators (anonymous)

scripts/peertube channels --limit 20 --json           # instance channel list
scripts/peertube channel --handle framasoft@framatube.org   # name or name@host
scripts/peertube account --name chocobozzz@framatube.org

channel shows metadata plus the channel's uploads (offset-paginated).

me / my-videos — your account (requires login)

scripts/peertube me --json | jq '.role.label'
scripts/peertube my-videos --limit 50 --json

login / logout — OAuth2 session management

scripts/peertube login --username <NAME> --prompt        # hidden prompt
echo "<PASSWORD>" | scripts/peertube login --username <NAME> --password-stdin
scripts/peertube login --username <NAME> --otp <CODE>    # 2FA-enabled accounts
scripts/peertube logout                                   # revoke server-side + delete file

Global flags

scripts/peertube --json videos                     # flag before or after the subcommand
scripts/peertube videos --json
scripts/peertube --dry-run search --query test     # request plan, zero network
scripts/peertube --verbose videos --limit 2        # trace requests on stderr
scripts/peertube --server https://tilvids.com server   # per-invocation instance override

--dry-run emits {"dry_run": true, "method", "path", "params"} (login adds form_fields names only, never values) — use it to verify a jq chain before running it live. --help and --dry-run never require credentials.

Pipeline recipes

Search, then inspect the top hit

scripts/peertube search --query "linux" --limit 5 --json | jq -r '.videos[0].uuid'
scripts/peertube video --id "$(scripts/peertube search -q linux --limit 1 --json | jq -r '.videos[0].uuid')" --json

Page through a channel's uploads

scripts/peertube channel --handle framasoft@framatube.org --limit 100 --offset 0 --json | jq -r '.videos[].name'
# loop: advance --offset by the returned count until you reach .total (no page param exists)

Instance report card

scripts/peertube server --json | jq '{name: .instance.name, videos: .stats.totalLocalVideos, users: .stats.totalUsers, views: .stats.totalLocalVideoViews}'

Log in, check quota, log out

scripts/peertube login --username <NAME> --prompt
scripts/peertube me --json | jq '{username, role: .role.label, quota_bytes: .videoQuota}'
scripts/peertube logout

JSON and jq

--json output keys are stable snake_case wrappers around raw API objects: videos (the API's {total, data} list objects), channels, threads (+ total_not_deleted), instance + stats, channel, dry_run/method/path/params for plans. Video objects keep PeerTube's own field names — uuid, shortUUID, name, duration (seconds), views, publishedAt, account{name,displayName,host}, channel{name,displayName,host} — so jq selectors transfer directly to raw curl against /api/v1. Example: jq -r '.videos[] | [.name, .views, .channel.displayName] | @tsv'.

Known Gotchas

  • Instances are independent (federated, not one API) — accounts, tokens, rules, enabled features, and catalogs differ per instance. A token from instance A 401s on instance B; the CLI keys the token file by server URL. Content federated onto an instance still belongs to its origin (channel.host, video url).
  • Search scope is two different things — searchTarget=local searches the instance's own catalog; search-index (or SepiaSearch's base URL) searches the fediverse via an external index. Omitting searchTarget gives the instance's own scope on current servers, not the fediverse. The bundled CLI is instance-local unless you point it at sepiasearch.org.
  • page does not exist — collections paginate with start/count (max 100). Clients sending page= silently re-read the first page forever.
  • The comments route is /comment-threads (hyphenated) — /comments and /commentthreads are not routes (they 400 on current servers).
  • Instance metadata paths are mixed — stats at /server/stats (operation titled "instance stats"), about at /config/about, config at /config. No /instance/* metadata paths exist.
  • Production masks client_secret — oauth-clients/local answers "********************************" on current production instances; a token request with the masked value 400s. The CLI detects it and explains the front-end-asset workaround. response_type=code appears in old quick-start curls but is not part of the current token schema — the CLI omits it.
  • Token lifetimes are instance-configurable — read expires_in per response; the CLI persists the absolute expires_at and refreshes automatically. Store tokens owner-only, never commit them, revoke on logout (deleting the file alone leaves the session live).
  • 2FA needs an OTP header — x-peertube-otp on the token request; the CLI maps a bare 401 to "pass --otp".
  • Rate limits — default 50 calls/10 s per IP (token endpoint tighter); on 429 read Retry-After and back off. Errors use RFC7807 application/problem+json bodies, and unknown routes answer 400 (not 404) — read the body.
  • duration is seconds; ids are triple (id, uuid, shortUUID — all accepted by detail endpoints); role is an object {id, label}; videoQuota is bytes.
  • Anonymous vs authed — browsing/search/comments/instance-info need no token; /users/me* and mutations always do.

When to use

Use this skill for read-only interaction with PeerTube instances: browsing and filtering videos, instance-local or fediverse-wide search (via SepiaSearch), video detail and comments, channel/account exploration, instance stats, and managing your own account session with OAuth2 (login, profile, my videos, logout).

When not to use

Do not use this skill for YouTube, Vimeo, or other platform uploads or any video editing/transcoding (route to those platforms' own tooling and ffmpeg); for installing, hosting, or administering a PeerTube server (instance administration is out of scope — the bundled CLI is read-only plus login/logout); or for generic ActivityPub/Mastodon federation questions (use a Mastodon or ActivityPub skill).

Reference Files

File Use it for
references/auth-and-tokens.md OAuth2 flow (oauth-clients/local, password grant), secret masking, refresh/revocation, token-file hygiene, wire error signatures
references/search-and-discovery.md searchTarget local vs search-index, SepiaSearch semantics, search parameters and sorts
references/endpoint-catalog.md Every read endpoint's parameters, response shapes, pagination, rate limits
references/gotchas-field-guide.md Symptom → cause → fix table for every failure signature and version drift
references/worked-recipes.md Multi-step CLI/jq workflows, raw curl auth chain, jq processing patterns

Available Scripts and Prerequisites

  • scripts/peertube — the bundled Python CLI (--json, --dry-run, --verbose, --server override). Imports only the standard library and requests.
  • scripts/test_peertube.py — offline test suite (pytest + unittest compatible); all HTTP is mocked, zero network egress.
  • Requires Python 3.8+ and requests. Any reachable PeerTube instance (or SepiaSearch) works; no credentials exist or are required by default. No service is started by this skill.
Files (agent-skills)
  • evals
    • evals.json 5.9 KB
      Loading…
  • references
    • auth-and-tokens.md 9.3 KB
      Loading…
    • endpoint-catalog.md 8.6 KB
      Loading…
    • gotchas-field-guide.md 7.4 KB
      Loading…
    • search-and-discovery.md 7.5 KB
      Loading…
    • worked-recipes.md 7.5 KB
      Loading…
  • scripts
    • peertube 36.7 KB · in bundle
    • test_peertube.py 40.5 KB
      Loading…
  • README.md 3.7 KB
    # PeerTube — Federated Video from the Terminal
    
    Browse any PeerTube instance from the command line: latest videos, video detail, comment
    threads, channels and accounts, instance stats, and OAuth2 login for your own account —
    plus fediverse-wide search through SepiaSearch.
    
    ## Why Install This Skill
    
    When your agent loads this skill, it can **navigate the federated video universe** without
    a browser. That means:
    
    - **Browse any instance** — latest videos with real offset pagination (the API has no
      `page` parameter, and most naive wrappers get this wrong)
    - **Search the right scope** — instance-local search or the whole fediverse via
      SepiaSearch, with the `searchTarget` semantics documented instead of guessed
    - **Inspect videos deeply** — full metadata, comment threads (the hyphenated
      `/comment-threads` route), channels, and accounts by handle (`name@host`)
    - **Check instance health** — name, description, and user/video/view counters composed
      from `/config/about` + `/server/stats` anonymously
    - **Authenticate safely** — OAuth2 password grant with per-instance, owner-only token
      persistence, automatic refresh, and proper server-side revocation on logout
    - **Avoid the traps** — masked `client_secret` responses, token lifetimes that vary per
      instance, 2FA `x-peertube-otp`, rate-limit headers, RFC7807 error bodies
    
    Every command is read-only except `login`/`logout`, and `--dry-run` previews any request
    without touching the network.
    
    ## What You Get
    
    | Path | Purpose |
    |------|---------|
    | `SKILL.md` | Complete command reference with setup, gotchas, and recipes |
    | `scripts/peertube` | CLI for PeerTube API operations (`--json`, `--dry-run`, `--verbose`) |
    | `scripts/test_peertube.py` | Offline test suite (all HTTP mocked, zero egress) |
    | `references/auth-and-tokens.md` | The full OAuth2 flow, secret masking, token hygiene |
    | `references/search-and-discovery.md` | Instance-local vs SepiaSearch search scopes |
    | `references/endpoint-catalog.md` | Endpoint-by-endpoint parameters and response shapes |
    | `references/gotchas-field-guide.md` | Failure signatures and version drift |
    | `references/worked-recipes.md` | Multi-step CLI/jq and curl workflows |
    | `evals/evals.json` | Behavioral eval cases including negative triggers |
    
    ## Quick Start
    
    ```bash
    export PEERTUBE_SERVER="https://<INSTANCE_HOST>"   # any PeerTube instance
    scripts/peertube server                            # instance stats, anonymous
    scripts/peertube videos --limit 5 --json
    scripts/peertube search --query "linux"            # searches THIS instance
    ```
    
    Fediverse-wide search through SepiaSearch (same API shape, wider index):
    
    ```bash
    PEERTUBE_SERVER="https://sepiasearch.org" scripts/peertube search --query "linux"
    ```
    
    Optional login for your own account commands:
    
    ```bash
    scripts/peertube login --username "<USERNAME>" --prompt
    scripts/peertube me --json | jq '.role.label'
    scripts/peertube logout                            # revokes server-side + deletes token file
    ```
    
    ## Triggers
    
    Load this when asking about PeerTube, federated video, decentralized video platforms,
    SepiaSearch, browsing a specific PeerTube instance's videos or channels, or PeerTube API
    authentication.
    
    ## Requirements
    
    Python 3.8+ with `requests`. One thing this skill always needs from you: **an instance
    host** — export `PEERTUBE_SERVER` (e.g. `https://<INSTANCE_HOST>`) or pass
    `--server https://...` per command, since PeerTube is federated and every command targets
    one instance. Reads are anonymous; `me`/`my-videos` need a token from `scripts/peertube
    login`. Tokens persist to `~/.config/peertube/token.json` (override the directory with
    `PEERTUBE_CONFIG_DIR`). Find public instances at [joinpeertube.org](https://joinpeertube.org).
    
  • SKILL.md 12.3 KB
    ---
    name: peertube
    description: Browse PeerTube federated video from the terminal — instance stats, latest
      videos, video detail, comment threads, channels, accounts, instance-local search, and
      OAuth2 login with per-instance token persistence. Set PEERTUBE_SERVER to any instance;
      point it at sepiasearch.org for fediverse-wide search. Use when the user mentions
      PeerTube, federated video, SepiaSearch, or browsing a specific PeerTube instance.
      Do not use this skill for YouTube/Vimeo uploads, video editing, or installing and
      administering a PeerTube server.
    license: MIT
    compatibility: Requires Python 3.8+ and `requests`. Reads are anonymous; authenticated
      commands (`me`, `my-videos`) need a token from `scripts/peertube login`. Tokens persist
      per-instance to ~/.config/peertube/token.json (owner-only).
    metadata:
      tags: peertube, federated-video, activitypub, video-platform, sepiasearch, api-client
      sources: https://docs.joinpeertube.org/api-rest-reference.html, https://sepiasearch.org/
    ---
    
    # peertube — PeerTube federated video from the terminal
    
    Browse any PeerTube instance — a federated deployment, not a single API — from the
    terminal: instance stats, latest videos, full video detail, comment threads, channels,
    accounts, and instance-local search. Authenticate with OAuth2 only for your own account
    commands. Every command is read-only except `login`/`logout`.
    
    ## Setup
    
    1. Choose the instance to talk to. Every command is per-instance; the API shape is
       identical everywhere, but accounts, tokens, rules, and catalogs are not:
    
    ```bash
    export PEERTUBE_SERVER="https://<INSTANCE_HOST>"   # e.g. https://tilvids.com
    ```
    
       To search the whole fediverse instead of one instance, point the same variable at the
       public search index: `PEERTUBE_SERVER=https://sepiasearch.org` (same API shape — see
       [references/search-and-discovery.md](references/search-and-discovery.md)).
    
    2. Nothing else is required to browse: videos, search, channels, comments, and instance
       info are anonymous reads.
    
    3. (Optional) Log in only for your own account commands (`me`, `my-videos`):
    
    ```bash
    scripts/peertube login --username <NAME> --prompt
    ```
    
    ### How authentication works
    
    PeerTube uses plain OAuth2 with per-instance client credentials: the CLI anonymously
    fetches the client pair from `GET /api/v1/oauth-clients/local` (singular `local`), then
    exchanges your username/password for a bearer token at `POST /api/v1/users/token`
    (`grant_type=password`, form-encoded). The token rides `Authorization: Bearer <token>`,
    lives for the instance's configured lifetime (read `expires_in` from the response — do not
    assume a fixed number), and is refreshed automatically when it expires. The token file is
    written owner-only to `~/.config/peertube/token.json` keyed by server URL.
    **Do not commit tokens** — they are account credentials; revoke with `scripts/peertube
    logout` (`POST /users/revoke-token`) when done. Current production instances mask
    `client_secret` in the API response; the CLI detects this and explains the workaround.
    Details and wire-level error signatures:
    [references/auth-and-tokens.md](references/auth-and-tokens.md).
    
    ## Essential Commands
    
    ### server — instance stats and identity (anonymous)
    
    ```bash
    scripts/peertube server              # name, description, user/video/view counters
    scripts/peertube server --json
    ```
    
    Composes `GET /config/about` + `GET /server/stats` (canonical paths — there is no
    `/instance/stats`).
    
    ### videos — browse the instance's uploads (anonymous)
    
    ```bash
    scripts/peertube videos                       # latest 15, offset pagination
    scripts/peertube videos --limit 50 --offset 50
    scripts/peertube videos --sort -views --json  # popular first
    ```
    
    Pagination is `start`/`count` offsets (max count 100) — the API has **no `page`
    parameter**.
    
    ### search — find videos on THIS instance (anonymous)
    
    ```bash
    scripts/peertube search --query "linux"            # instance-local (searchTarget=local)
    scripts/peertube search -q "docker" --limit 20 --json
    PEERTUBE_SERVER="https://sepiasearch.org" scripts/peertube search -q "linux"   # fediverse-wide
    ```
    
    The bundled CLI performs **instance-local** search only (`searchTarget=local`). For
    fediverse-wide search, point `PEERTUBE_SERVER` at SepiaSearch — same commands, wider
    index. Search results carry `channel.host`/`url`, the origin instance of federated hits.
    
    ### video — full detail for one video (anonymous)
    
    ```bash
    scripts/peertube video --id <UUID>          # numeric id, UUID, or shortUUID all work
    scripts/peertube video --id <UUID> --json | jq '{name, description, views, url}'
    ```
    
    ### comments — top-level comment threads (anonymous)
    
    ```bash
    scripts/peertube comments --id <UUID>                 # GET /videos/{id}/comment-threads
    scripts/peertube comments --id <UUID> --limit 30 --json
    ```
    
    ### channels / channel / account — creators (anonymous)
    
    ```bash
    scripts/peertube channels --limit 20 --json           # instance channel list
    scripts/peertube channel --handle framasoft@framatube.org   # name or name@host
    scripts/peertube account --name chocobozzz@framatube.org
    ```
    
    `channel` shows metadata plus the channel's uploads (offset-paginated).
    
    ### me / my-videos — your account (requires login)
    
    ```bash
    scripts/peertube me --json | jq '.role.label'
    scripts/peertube my-videos --limit 50 --json
    ```
    
    ### login / logout — OAuth2 session management
    
    ```bash
    scripts/peertube login --username <NAME> --prompt        # hidden prompt
    echo "<PASSWORD>" | scripts/peertube login --username <NAME> --password-stdin
    scripts/peertube login --username <NAME> --otp <CODE>    # 2FA-enabled accounts
    scripts/peertube logout                                   # revoke server-side + delete file
    ```
    
    ## Global flags
    
    ```bash
    scripts/peertube --json videos                     # flag before or after the subcommand
    scripts/peertube videos --json
    scripts/peertube --dry-run search --query test     # request plan, zero network
    scripts/peertube --verbose videos --limit 2        # trace requests on stderr
    scripts/peertube --server https://tilvids.com server   # per-invocation instance override
    ```
    
    `--dry-run` emits `{"dry_run": true, "method", "path", "params"}` (login adds
    `form_fields` names only, never values) — use it to verify a jq chain before running it
    live. `--help` and `--dry-run` never require credentials.
    
    ## Pipeline recipes
    
    ### Search, then inspect the top hit
    
    ```bash
    scripts/peertube search --query "linux" --limit 5 --json | jq -r '.videos[0].uuid'
    scripts/peertube video --id "$(scripts/peertube search -q linux --limit 1 --json | jq -r '.videos[0].uuid')" --json
    ```
    
    ### Page through a channel's uploads
    
    ```bash
    scripts/peertube channel --handle framasoft@framatube.org --limit 100 --offset 0 --json | jq -r '.videos[].name'
    # loop: advance --offset by the returned count until you reach .total (no page param exists)
    ```
    
    ### Instance report card
    
    ```bash
    scripts/peertube server --json | jq '{name: .instance.name, videos: .stats.totalLocalVideos, users: .stats.totalUsers, views: .stats.totalLocalVideoViews}'
    ```
    
    ### Log in, check quota, log out
    
    ```bash
    scripts/peertube login --username <NAME> --prompt
    scripts/peertube me --json | jq '{username, role: .role.label, quota_bytes: .videoQuota}'
    scripts/peertube logout
    ```
    
    ## JSON and jq
    
    `--json` output keys are stable snake_case wrappers around raw API objects: `videos`
    (the API's `{total, data}` list objects), `channels`, `threads` (+ `total_not_deleted`),
    `instance` + `stats`, `channel`, `dry_run`/`method`/`path`/`params` for plans. Video
    objects keep PeerTube's own field names — `uuid`, `shortUUID`, `name`, `duration`
    (seconds), `views`, `publishedAt`, `account{name,displayName,host}`,
    `channel{name,displayName,host}` — so jq selectors transfer directly to raw `curl`
    against `/api/v1`. Example: `jq -r '.videos[] | [.name, .views, .channel.displayName] | @tsv'`.
    
    ## Known Gotchas
    
    - **Instances are independent (federated, not one API)** — accounts, tokens, rules,
      enabled features, and catalogs differ per instance. A token from instance A 401s on
      instance B; the CLI keys the token file by server URL. Content federated *onto* an
      instance still belongs to its origin (`channel.host`, video `url`).
    - **Search scope is two different things** — `searchTarget=local` searches the
      instance's own catalog; `search-index` (or SepiaSearch's base URL) searches the
      fediverse via an external index. Omitting `searchTarget` gives the instance's own
      scope on current servers, not the fediverse. The bundled CLI is instance-local unless
      you point it at sepiasearch.org.
    - **`page` does not exist** — collections paginate with `start`/`count` (max 100).
      Clients sending `page=` silently re-read the first page forever.
    - **The comments route is `/comment-threads`** (hyphenated) — `/comments` and
      `/commentthreads` are not routes (they 400 on current servers).
    - **Instance metadata paths are mixed** — stats at `/server/stats` (operation titled
      "instance stats"), about at `/config/about`, config at `/config`. No
      `/instance/*` metadata paths exist.
    - **Production masks `client_secret`** — `oauth-clients/local` answers
      `"********************************"` on current production instances; a token request
      with the masked value 400s. The CLI detects it and explains the front-end-asset
      workaround. `response_type=code` appears in old quick-start curls but is not part of
      the current token schema — the CLI omits it.
    - **Token lifetimes are instance-configurable** — read `expires_in` per response; the
      CLI persists the absolute `expires_at` and refreshes automatically. Store tokens
      owner-only, never commit them, revoke on logout (deleting the file alone leaves the
      session live).
    - **2FA needs an OTP header** — `x-peertube-otp` on the token request; the CLI maps a
      bare 401 to "pass --otp".
    - **Rate limits** — default 50 calls/10 s per IP (token endpoint tighter); on 429 read
      `Retry-After` and back off. Errors use RFC7807 `application/problem+json` bodies, and
      unknown routes answer 400 (not 404) — read the body.
    - **`duration` is seconds**; ids are triple (`id`, `uuid`, `shortUUID` — all accepted by
      detail endpoints); `role` is an object `{id, label}`; `videoQuota` is bytes.
    - **Anonymous vs authed** — browsing/search/comments/instance-info need no token;
      `/users/me*` and mutations always do.
    
    ## When to use
    
    Use this skill for read-only interaction with PeerTube instances: browsing and filtering
    videos, instance-local or fediverse-wide search (via SepiaSearch), video detail and
    comments, channel/account exploration, instance stats, and managing your own account
    session with OAuth2 (login, profile, my videos, logout).
    
    ## When not to use
    
    Do not use this skill for YouTube, Vimeo, or other platform uploads or any video
    editing/transcoding (route to those platforms' own tooling and ffmpeg); for installing,
    hosting, or administering a PeerTube server (instance administration is out of scope —
    the bundled CLI is read-only plus login/logout); or for generic ActivityPub/Mastodon
    federation questions (use a Mastodon or ActivityPub skill).
    
    ## Reference Files
    
    | File | Use it for |
    | ---- | ---------- |
    | [references/auth-and-tokens.md](references/auth-and-tokens.md) | OAuth2 flow (oauth-clients/local, password grant), secret masking, refresh/revocation, token-file hygiene, wire error signatures |
    | [references/search-and-discovery.md](references/search-and-discovery.md) | searchTarget local vs search-index, SepiaSearch semantics, search parameters and sorts |
    | [references/endpoint-catalog.md](references/endpoint-catalog.md) | Every read endpoint's parameters, response shapes, pagination, rate limits |
    | [references/gotchas-field-guide.md](references/gotchas-field-guide.md) | Symptom → cause → fix table for every failure signature and version drift |
    | [references/worked-recipes.md](references/worked-recipes.md) | Multi-step CLI/jq workflows, raw curl auth chain, jq processing patterns |
    
    ## Available Scripts and Prerequisites
    
    - `scripts/peertube` — the bundled Python CLI (`--json`, `--dry-run`, `--verbose`,
      `--server` override). Imports only the standard library and `requests`.
    - `scripts/test_peertube.py` — offline test suite (pytest + unittest compatible); all
      HTTP is mocked, zero network egress.
    - Requires Python 3.8+ and `requests`. Any reachable PeerTube instance (or SepiaSearch)
      works; no credentials exist or are required by default. No service is started by this
      skill.
    

Comments (0)

Sign in to join the conversation.

No comments yet.

Reviews (0)

No reviews yet.