Bridge PeerTube videos to AMB (Nostr) events. Crawls a PeerTube instance via its ActivityPub outbox, maps video metadata to Nostr event tags (kind 30142), and publishes them to a Nostr relay.
pip install -e .For development:
pip install -e ".[dev]"Generate a Nostr keypair:
peertube-to-amb generate-keyThis prints a new private/public key pair in both hex and bech32 (nsec/npub) formats:
Private key (hex): <private_key_hex>
Private key (nsec): nsec1...
Public key (hex): <public_key_hex>
Public key (npub): npub1...
To use this key, set the environment variable:
export NOSTR_PRIVATE_KEY="nsec1..."
Then bridge videos from a PeerTube instance:
export NOSTR_PRIVATE_KEY="<your_private_key>"
peertube-to-amb bridge https://peertube.example.com --account my-accountGenerate a new Nostr keypair (private + public key).
peertube-to-amb generate-keyNo arguments required. Outputs keys in both hex and bech32 (nsec/npub) formats.
Fetch PeerTube videos and publish them as AMB (Nostr) events.
peertube-to-amb bridge <peertube_url> [options]
| Argument | Description |
|---|---|
peertube_url |
Base URL of the PeerTube instance |
| Option | Default | Description |
|---|---|---|
--account <name> |
— | PeerTube account to fetch videos from |
--channel <name> |
— | PeerTube channel to fetch videos from |
--limit <n> |
all | Maximum number of videos to fetch |
--relay-url <url> |
ws://localhost:3334 |
Nostr relay WebSocket URL |
--request-delay <secs> |
0.5 |
Delay in seconds between HTTP requests |
--max-concurrency <n> |
1 |
Maximum number of concurrent requests |
--state-file <path> |
— | Path to a JSON file for tracking already-processed videos (skips duplicates across runs) |
--dry-run |
off | Process and log videos without publishing to the relay |
| Option | Default | Description |
|---|---|---|
--verbose |
off | Enable debug-level logging output |
| Variable | Required | Description |
|---|---|---|
NOSTR_PRIVATE_KEY |
Yes (unless --dry-run) |
Nostr private key — accepts both hex and bech32 (nsec1...) formats |
Dry run — fetch 10 videos from an account and print the mapped events:
peertube-to-amb bridge https://peertube.example.com --account my-account --limit 10 --dry-run --verbosePublish all videos from a channel to a relay:
export NOSTR_PRIVATE_KEY="nsec1..."
peertube-to-amb bridge https://peertube.example.com --channel <channel-name> --relay-url ws://relay.example.com:3334Resume from a previous run using a state file:
peertube-to-amb bridge https://peertube.example.com --account <account-name> --state-file state.jsonThe state file tracks which videos have already been processed, so subsequent runs skip them.
docker compose up -d
docker compose exec app peertube-to-amb generate-key
export NOSTR_PRIVATE_KEY="nsec1..."
docker compose exec app peertube-to-amb bridge https://peertube.example.com --account <account-name> --relay-url ws://relay.example.com:3334docker build -t peertube-to-amb .
docker run --rm peertube-to-amb generate-key
docker run --rm -e NOSTR_PRIVATE_KEY="nsec1..." peertube-to-amb bridge https://peertube.example.com --account <account-name> --relay-url ws://relay.example.com:3334Run tests:
pytestThis project is being funded by the BMBSFJ.
Förderkennzeichen: 01PZ25003
