Any agentic tool with shell access can publish a video for a bashy user to that user’s own YouTube channel. The account is always the user’s (account=ADDR, e.g. alice@example.com); never reuse another person’s credentials or channel.
- Set up the Google example command once (see the Gmail runbook):
bashy src fetch bashy, runexamples/google/register.sh, thenbashy google auth-status account=alice@example.com. If it is not ready, run the BYOP onboarding it prints (auth-guide,auth-import). - Plan first:
bashy google youtube-upload VIDEO title='…' privacy=unlisted --dry-run account=ADDR. It prints the metadata and the two one-time owner steps underneeds. - One-time owner steps (only the user can do these; hand them over, do not work around them):
- grant the upload permission in its own credential slot:
bashy google auth-login account=alice@example.com slot=youtube scopes=https://www.googleapis.com/auth/youtube.upload. Google will not grant YouTube together with Drive, so it is never added to the main grant. Pick the same Google account as the target channel. The consent page may show “Manage your YouTube videos” as an unticked checkbox (granular consent): tick it, otherwise auth-login stops withSCOPE_NOT_GRANTEDand says so; - enable YouTube Data API v3 in the OAuth client’s Cloud project (
gcloud services enable youtube.googleapis.com --project PROJECT, or the Cloud Console). If either is missing, the upload fails withYOUTUBE_REFUSEDandreasoninsufficient_scopeorapi_disabled, plus the exact fix.
- grant the upload permission in its own credential slot:
- Check the YouTube slot before uploading:
bashy google auth-status account=alice@example.com slot=youtube. This runs a refresh probe and reports granted scopes without printing a token. If it reportsreauth_required, rerun the slot login command above. OAuth clients left in Testing mode issue refresh tokens that expire after 7 days; publish the OAuth app to stop that expiry. - Choose the channel deliberately: Brand Accounts appear separately in the Google account chooser. Review Brand Accounts and YouTube’s View all channels before consenting.
- Upload:
bashy google youtube-upload VIDEO title='…' description='…' privacy=unlisted tags=a,b account=alice@example.com. It returnsurl(https://youtu.be/ID),embed(https://www.youtube-nocookie.com/embed/ID), andchannelId; confirm thatchannelIdis the intended channel. Default to unlisted unless the user asks for public. - Link it from the app: prefer a lazy embed plus a plain link, so the page loads nothing until someone presses play:
<iframe src="EMBED_URL" title="TITLE" loading="lazy" allow="encrypted-media; picture-in-picture; fullscreen" allowfullscreen></iframe>
<a href="WATCH_URL">Watch on YouTube</a>
For a shaped app, change the page by wish (bashy shape wish APP "add the tutorial video WATCH_URL") or commit it to the app’s source; a shaped app serves its committed revision, not loose files.
Never print or paste OAuth tokens, and never put the video URL of one user into another user’s public repo or example; examples stay generic, user content stays in the user’s own repos and apps.