Skip to content

Upload a post's videos to YouTube when publishing, once each - #7

Merged
calvin-archastro merged 1 commit into
mainfrom
youtube-upload
Oct 22, 2026
Merged

calvin-archastro merged 1 commit into
mainfrom
youtube-upload

Conversation

@calvin-archastro

Copy link
Copy Markdown
Contributor

Substack's API can't take video, so a post's local videos had nowhere to go. This adds YouTube as a second account and uploads them there.

What's new

  1. YouTube account (:youtube, File → Connect YouTube…, ⌘/ menu): a dialog like the Substack one. Enter a Google OAuth Client ID and secret, then sign in through the browser. The sign-in is kept in the keychain. Once signed in, the dialog shows your channel and a Privacy choice (Unlisted by default).
  2. Publish dialog → Videos: when a post has local videos, choose Upload to YouTube or Link to the file. Stet remembers the choice. Each uploaded video becomes a YouTube embed in the Substack draft (stet-substack/src/convert.rs).
  3. No duplicates: uploads are keyed by a hash of the file's contents in youtube-uploads.json. Publishing again reuses the video while YouTube still has it, and uploads it again if it was deleted. Only one upload runs at a time, and a failed upload isn't recorded.
  4. New crate stet-youtube (OAuth, resumable upload, upload record, keychain), behind the default youtube feature.

Caveats (Google's limits)

  • Videos uploaded through an unaudited Google Cloud project come out private, and private videos won't play embedded. Fix by setting them to Unlisted in YouTube Studio, or getting the API audited.
  • While the OAuth consent screen is in Testing mode, the sign-in expires after 7 days.
  • Not tested against real YouTube: that needs a Google client and sign-in.

Checks

cargo fmt --check, cargo clippy --all-targets --all-features -D warnings, cargo doc and cargo test --workspace pass locally on macOS.

🤖 Generated with Claude Code

Adds YouTube as a second account (:youtube, File → Connect YouTube…), with
an OAuth sign-in kept in the keychain like the Substack cookie. The Substack
publish dialog gains a Videos choice: upload local videos to YouTube and
embed them, or link to the file. Each upload is keyed by the file's content
hash in youtube-uploads.json, and reused while YouTube still has it, so
publishing again never makes a duplicate.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@calvin-archastro
calvin-archastro merged commit 3845380 into main Oct 22, 2026
9 checks passed
@calvin-archastro
calvin-archastro deleted the youtube-upload branch October 22, 2026 18:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant