PeerTube plugin that automates, almost, publishing PeerTube videos to Youtube after a configurable delay
  • JavaScript 100%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Troed Sångberg 8bd50c6745 test: align workflow assertion with npm-config-set-registry step
The workflow stopped using setup-node registry-url (incompatible with
Forgejo Actions) but test/workflow.test.js still asserted the old form.
2026-09-06 12:43:48 +02:00
.forgejo/workflows ci: avoid registry-url in setup-node (incompatible with Forgejo Actions) 2026-09-02 10:31:20 +02:00
client fix: revert merge of stale mount-fix branch (re-introduced removed admin client) 2026-09-06 12:43:48 +02:00
scripts Per-user YouTube sync (own channel per user) (#7) 2026-08-08 20:05:43 +02:00
src fix: notify uploader on missing tokens, improve backfill error reporting 2026-09-02 10:07:45 +02:00
test test: align workflow assertion with npm-config-set-registry step 2026-09-06 12:43:48 +02:00
.gitignore chore: remove internal superpowers design docs and ignore docs/superpowers/ 2026-08-08 11:58:21 +02:00
AGENTS.md test: align workflow assertion with npm-config-set-registry step 2026-09-06 12:43:48 +02:00
logo.png docs: fold plugin notes into description, shrink logo, drop release section 2026-08-08 20:31:22 +02:00
main.js fix: revert merge of stale mount-fix branch (re-introduced removed admin client) 2026-09-06 12:43:48 +02:00
package-lock.json chore: bump version to 1.3.1 2026-09-02 10:07:58 +02:00
package.json chore: bump version to 1.3.1 2026-09-02 10:07:58 +02:00
README.md docs: explain the admin trust model for OAuth tokens 2026-08-08 20:35:20 +02:00

Peer You!

Peer You! logo

Automatically upload videos published on your PeerTube instance to your YouTube channel after a configurable delay.

Each PeerTube user connects their own YouTube channel from their account page (Settings → YouTube sync, or /my-account/p/peeryou). A user's published videos sync to their own channel; users who haven't connected are skipped.

The plugin does NOT pursue Google's YouTube Data API compliance audit. Because of that, YouTube locks uploads to Private and ignores scheduled publishing: the plugin waits the full configured delay, uploads the video as Private, and shows an in-app notification with the YouTube video id so you can flip it to Public in YouTube Studio.

Users cannot connect until the instance admin adds their Google accounts as Test users on the Google OAuth app. While the app is in Testing mode, the consent screen only accepts accounts listed under Audience → Test users; a rejected user gets no error message in the plugin. (Alternatively, publish the OAuth app to Production to allow any Google account to grant consent — Google then reviews the app, which is not required for personal use.)

Prerequisites

  • PeerTube >= 8.2.4 on a server you administer.
  • A YouTube channel that you own and want to publish to.

The remaining prerequisites are a Google Cloud project — a free developer workspace, separate from your YouTube account, that lets software use Google APIs. Set it up once:

  1. Create a Google Cloud project. Go to https://console.cloud.google.com, click the project dropdown (top-left) → New Project, and give it a name (e.g. peeryou).

  2. Enable the YouTube Data API v3. Inside that project, go to https://console.cloud.google.com/apis/library/youtube.googleapis.com and click Enable.

  3. Create an OAuth 2.0 Web client — the credential the plugin uses to upload on your behalf:

    • Go to APIs & Services → OAuth consent screen, choose External, and fill in an app name and your email.
    • Because YouTube scopes are sensitive, the app starts in Testing mode. Under Audience → Test users, add the Google account for every PeerTube user who will connect a channel — otherwise the consent step rejects them.
    • Go to APIs & Services → Credentials → Create Credentials → OAuth client ID, choose Web application, and under Authorized redirect URIs add exactly:
    https://<your-instance>/plugins/peeryou/router/callback
    

    Replace <your-instance> with your actual PeerTube domain (e.g. https://videos.example.com). This redirect URI is derived from your instance's public URL, so it must match exactly — a mismatch is the most common cause of connection failures.

    • Copy the Client ID and Client secret it returns; you will paste them into the plugin's Google OAuth client ID / secret settings.

The YouTube account you connect must own the target channel. Google shows an "unverified app" warning during consent — expected and harmless for personal use.

Install

The plugin is published on npm and appears in the PeerTube plugin index, so it installs like any other PeerTube plugin.

In the PeerTube admin panel, go to Plugins → Install plugin, search for peertube-plugin-peeryou, and click Install.

Or, from the PeerTube CLI (see https://docs.joinpeertube.org/use/cli):

peertube-cli auth add -u '<your-instance>' -U '<user>'
peertube-cli plugins install -n peertube-plugin-peeryou

Once installed, the admin sets the global settings (below) and each user connects their own YouTube channel.

Configure

In the PeerTube admin plugin settings:

Setting Meaning
Delay (days) Days between PeerTube publication and the YouTube upload (default 7).
Description suffix Text appended to the YouTube description; {videoUrl} is replaced with the PeerTube link.
Minimum PeerTube privacy Public only or Public + Unlisted.
Check interval (minutes) How often the plugin checks for due uploads (default 5).
Google OAuth client ID / secret From your Google Cloud project.

Per-user YouTube sync

Each user controls their sync from Settings → YouTube sync (/my-account/p/peeryou):

  • Connection: connect their own YouTube channel (OAuth), view the connected channel, or disconnect.
  • Settings: per-user overrides for Delay (days), Description suffix, and Minimum privacy. Leave a field empty to use the instance default.
  • Backfill: list the user's own published eligible videos and sync selected ones immediately.

Usage

  • Every new video published on PeerTube (meeting the privacy setting) is queued for the video owner's YouTube channel.
  • On the upload/update form, untick "Sync to YouTube" to exclude a specific video.
  • When the delay elapses, the plugin uploads the video as Private and notifies the video owner to publish it in YouTube Studio.
  • To sync already-published videos right away, use the Backfill section on the YouTube sync page: tick the videos you want and click Sync selected videos now.

How it works

  1. The plugin listens to PeerTube's action:api.video.uploaded / action:api.video.updated hooks.
  2. Eligible videos (local, published, meeting the privacy threshold, not opted out) are queued with uploadAt = publishedAt + delay.
  3. A periodic timer uploads due videos to YouTube via the Data API v3 (videos.insert as private, then thumbnails.set), carrying over title, description (+ suffix), tags, category, licence, and thumbnail.
  4. On success you are notified with an in-app notification.
  5. Failed uploads are logged and dropped (no retries, best-effort).

Troubleshooting

  • Video never appears on YouTube: check the PeerTube logs for peeryou: entries. Common causes: not connected (no tokens), video was not eligible (privacy/published state), or no local web video file (remote/object storage).
  • Upload fails with youtube 403: the OAuth scope may be missing youtube.upload, or the connected account lacks upload rights on the target channel.
  • Token refresh fails: reconnect via the Connect to YouTube button on the YouTube sync page (Settings → YouTube sync).
  • Consent screen rejects a user: the user's Google account isn't listed under the OAuth app's Audience → Test users (see Prerequisites).

Security and trust

Connecting a YouTube channel gives the plugin a long-lived Google OAuth token, stored on the PeerTube server so the plugin can upload after the configured delay. Because the token lives on the server, users must trust their instance admin not to misuse it — the admin can read the stored token or modify the plugin code. The token only grants access to the connected YouTube channel (the scopes are limited to youtube.upload and youtube.readonly): it can upload, edit, or delete videos on that channel, but nothing outside it — no email, Drive, or other Google services.

The Disconnect button only removes the token from the server; it does not revoke a copy the admin may have already taken. A user who wants to fully revoke access can do so from their Google account (Security → Third-party apps with account access), which invalidates the token at Google regardless of what the server holds.

This trust model is inherent to any server-side "upload on my behalf after a delay" design and is worth being aware of before connecting a channel.

Source

Source code and issues: https://git.sync.wtf/troed/peeryou