echo6-docs/vault/runbooks/add-peertube-channel.md
echo6-autocommit eb7eade7fa auto: docs sync 2026-06-18T18:00:10+00:00
Files changed: .gitignore CLAUDE.md credentials engine/.embcache.json engine/changelog.md engine/config.yaml engine/lib/__pycache__/agent.cpython-312.pyc engine/lib/agent.py engine/lib/lint.py engine/lint-report.md engine/sweep-full.log engine/sweep.sh vault/.obsidian/graph.json vault/.obsidian/workspace.json vault/INDEX.md vault/archive/projects/mmud/last-ember-chronicle.html vault/archive/projects/mmud/last-ember-howto.html vault/archive/projects/mmud/last-ember.html vault/archive/projects/mmud/mmud-phase5-prompt.md vault/archive/projects/mmud/mmud-phase6-prompt.md vault/archive/projects/mmud/mmud-prompts/mmud-prompts/01-update-planned.md vault/archive/projects/mmud/mmud-prompts/mmud-prompts/02-npc-nodes.md vault/archive/projects/mmud/mmud-prompts/mmud-prompts/03-darkcragg.md vault/archive/projects/mmud/mmud-prompts/mmud-prompts/04-dcrg-node.md vault/archive/projects/mmud/mmud-prompts/mmud-prompts/05-phase5.md vault/archive/projects/mmud/mmud-prompts/mmud-prompts/06-phase6.md vault/archive/projects/mmud/mmud-prompts/mmud-prompts/README.md vault/archive/projects/mmud/mmud-prompts/mmud-prompts/mmud-project.md vault/docs/hardware/environment.md vault/docs/hardware/ip-allocation.md vault/docs/matrix/archivist.md vault/docs/matrix/matrix_host.md vault/docs/matrix/mautrix_signal.md vault/docs/matrix/synapse.md vault/docs/matrix/synapse_retention_discovery.md vault/docs/navi/cc-rules.md vault/docs/navi/deployment.md vault/docs/navi/themes.md vault/docs/services/ots-setup.md vault/docs/services/services.md vault/docs/services/usenet.md vault/docs/software/authentik.md vault/docs/software/caddy.md vault/docs/software/dns.md vault/docs/software/geo-tools.md vault/docs/software/recon.md vault/docs/software/searxng.md vault/glossary.md vault/notes/echo6-landing-page-data-export.md vault/notes/ia-download-queue.md vault/plans/vaultwarden-plan.md vault/projects/advbbs-project.md vault/projects/argus.md vault/projects/deploy-livesync.md vault/projects/matrix-synapse-deployment.md vault/projects/meshtastic-headscale-runbook.md vault/projects/mmud-project.md vault/runbooks/add-peertube-channel.md vault/runbooks/authentik-access-groups.md vault/runbooks/authentik-create-invitation.md vault/runbooks/authentik-oidc-application.md vault/runbooks/authentik-upgrade.md vault/runbooks/ct-runbook.md vault/runbooks/edge2-access-reference.md vault/runbooks/expose-service-contabo.md vault/runbooks/expose-service-edge2.md vault/runbooks/expose-service-home.md vault/runbooks/headscale-onboard-node.md vault/runbooks/ia-cli-reference.md vault/runbooks/ia-download-mirror.md vault/runbooks/idahomesh-bridge-setup.md vault/runbooks/idahomesh-vpn-device-setup.md vault/runbooks/lxc-service-migration.md vault/runbooks/mailcow-create-mailbox.md vault/runbooks/meshmonitor-password-reset.md vault/runbooks/meshtastic-sidecar-node.md vault/runbooks/meshtasticd-sim-nodes-runbook.md vault/runbooks/nordvpn-lxc.md vault/runbooks/peertube-remote-runner.md vault/runbooks/pg-backup.md vault/runbooks/pi-nas-omv-runbook.md vault/runbooks/pipeline-patterns.md vault/runbooks/proxmox-create-ubuntu-vm.md vault/runbooks/proxmox-onboard-node.md vault/runbooks/recon-operations.md vault/runbooks/recon-service-integration.md vault/runbooks/syncthing-add-node.md vault/session-resume/SESSION-HANDOFF-meshai-test.md
2026-06-18 18:00:10 +00:00

6.5 KiB

title type tags aliases related updated
Add PeerTube Channel runbook
media
peertube-remote-runner
recon-operations
recon-service-integration
proxmox-onboard-node
ct-runbook
2026-06-18

Add PeerTube Channel

Overview

Add a Youtube channel to the peertube bulk import pipeline. Creates the PeerTube channel, adds to channel-map.json, and the downloader will begin syncing videos automatically.

Prerequisites

  • SSH access from recon-vm (VM 1130) → CT 110 (PeerTube): working
  • Sudoers: /etc/sudoers.d/recon-mgmt on CT 110 (allows zvx to run yt-dlp, psql, tee as peertube)
  • YouTube cookies at /opt/bulk-import/config/cookies.txt on CT 110 (not stale)

Method 1: Web UI (Preferred)

  1. Open recon Dashboard → Upload tab: http://192.168.1.130:8420/upload
  2. Scroll to PeerTube Channels section
  3. Enter YouTube URL, category, priority
  4. Click Add Channel
  5. Wait for "Added: ChannelName" confirmation

Note: If the channel has members-only content, the API will automatically retry with --ignore-errors on the /videos tab.

Method 2: CLI (For Troubleshooting)

Use when the web UI fails or you need manual control.

Variables

YT_URL="https://www.youtube.com/@ChannelName"
CATEGORY="CategoryName"
PRIORITY="M"  # H, M, or L

Step 1: Resolve Channel Info

# From recon-vm or cortex:
ssh zvx@192.168.1.170 "sudo -u peertube /usr/local/bin/yt-dlp \
  --cookies /opt/bulk-import/config/cookies.txt \
  --print channel --print channel_url --print channel_id \
  --playlist-items 1 --skip-download '$YT_URL'"

If members-only error: Append /videos to URL and add --ignore-errors --playlist-items 1:5:

ssh zvx@192.168.1.170 "sudo -u peertube /usr/local/bin/yt-dlp \
  --cookies /opt/bulk-import/config/cookies.txt \
  --print channel --print channel_url --print channel_id \
  --ignore-errors --playlist-items 1:5 --skip-download '${YT_URL}/videos' 2>/dev/null" | head -3

Record the output:

CHANNEL_NAME="Civilian Rifleman"
CHANNEL_URL="https://www.youtube.com/channel/UC..."
CHANNEL_ID="UC..."

Step 2: Slugify Actor Name

ACTOR_NAME=$(echo "$CHANNEL_NAME" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9]/-/g; s/--*/-/g; s/^-//; s/-$//' | cut -c1-50)
echo "$ACTOR_NAME"

Step 3: Check for Duplicates

ssh zvx@192.168.1.170 "cat /opt/bulk-import/config/channel-map.json" \
  | python3 -c "import sys,json; d=json.load(sys.stdin); \
    matches=[c for c in d if c.get('actor_name')=='$ACTOR_NAME' or c.get('youtube_channel_id')=='$CHANNEL_ID']; \
    print('DUPLICATE:', matches[0]['channel_name']) if matches else print('OK - no conflicts')"

Step 4: Create PeerTube Channel

ssh zvx@192.168.1.170 bash << 'REMOTE'
CLIENT=$(curl -s http://localhost:9000/api/v1/oauth-clients/local -H "Host: stream.echo6.co")
CID=$(echo "$CLIENT" | python3 -c "import sys,json; print(json.load(sys.stdin)['client_id'])")
CSEC=$(echo "$CLIENT" | python3 -c "import sys,json; print(json.load(sys.stdin)['client_secret'])")

TOKEN=$(curl -s http://localhost:9000/api/v1/users/token -H "Host: stream.echo6.co" \
  --data "client_id=$CID&client_secret=$CSEC&grant_type=password&username=root&password=7redditGold" \
  | python3 -c "import sys,json; print(json.load(sys.stdin)['access_token'])")

curl -s -X POST http://localhost:9000/api/v1/video-channels \
  -H "Host: stream.echo6.co" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d "{\"name\":\"ACTOR_NAME\",\"displayName\":\"(YT)CHANNEL_NAME\"}"
REMOTE

Replace ACTOR_NAME and CHANNEL_NAME in the -d payload. Record the returned videoChannel.id.

Step 5: Update channel-map.json

IMPORTANT: Write to temp file first, then tee into place. Never pipe directly into tee on the same file being read — it causes a race condition that empties the file.

ssh zvx@192.168.1.170 bash << 'REMOTE'
python3 -c "
import json
with open('/opt/bulk-import/config/channel-map.json') as f:
    channels = json.load(f)
channels.append({
    'category': 'CATEGORY',
    'channel_name': '(YT)CHANNEL_NAME',
    'actor_name': 'ACTOR_NAME',
    'youtube_url': 'CHANNEL_URL',
    'youtube_channel_id': 'CHANNEL_ID',
    'peertube_channel_id': PT_CHANNEL_ID,
    'video_count': 0,
    'priority': 'PRIORITY',
    'est_videos': 0,
    'est_gb': 0
})
print(json.dumps(channels, indent=2))
" > /tmp/channel-map-new.json \
  && sudo -u peertube tee /opt/bulk-import/config/channel-map.json < /tmp/channel-map-new.json > /dev/null \
  && rm -f /tmp/channel-map-new.json \
  && echo "OK"
REMOTE

Replace all placeholder values (CATEGORY, CHANNEL_NAME, ACTOR_NAME, CHANNEL_URL, CHANNEL_ID, PT_CHANNEL_ID, PRIORITY).

Step 6: Verify

# Check channel count
curl -s http://192.168.1.130:8420/api/peertube/channels/stats | python3 -m json.tool

# Verify new channel in list
curl -s http://192.168.1.130:8420/api/peertube/channels \
  | python3 -c "import sys,json; d=json.load(sys.stdin); print(d[-1]['actor_name'], d[-1]['category'])"

Recovery: Empty channel-map.json

If tee race condition empties the file:

  1. Check Contabo backup: ssh root@100.64.0.1 ls -la /opt/backups/recon/
  2. Or rebuild from PeerTube DB:
    ssh zvx@192.168.1.170 "sudo -u peertube psql peertube_prod -t -A -c \
      \"SELECT name, \\\"displayName\\\" FROM \\\"videoChannel\\\" WHERE name != 'root_channel' AND name != 'default' ORDER BY id;\""
    

API Endpoints (RECON Dashboard)

Endpoint Method Purpose
/api/peertube/channels GET List all channels with video counts
/api/peertube/channels/stats GET Total channels, videos, downloader status
/api/peertube/channels/add POST Add channel (JSON: youtube_url, category, priority)
/api/peertube/channels/<actor_name> DELETE Remove channel from JSON and PeerTube

Common Issues

Issue Cause Fix
yt-dlp "Join this channel" error Members-only first video API auto-retries with /videos tab. CLI: add --ignore-errors --playlist-items 1:5 and use /videos URL
channel-map.json empty (0 bytes) tee race condition Always write to temp file first, then tee. Restore from backup or Contabo
sudo: password required Sudoers not set up Create /etc/sudoers.d/recon-mgmt via pct exec 110 from root@192.168.1.243
PeerTube "actor name already exists" Channel exists in PeerTube but not in JSON Add entry to JSON manually with correct peertube_channel_id

Last updated: 2026-02-18 — Initial creation