Repository navigation
feat: livestreams command for managing YouTube live broadcasts - #12
Merged
Merged
Conversation
New 'ytstudio livestreams' typer app with list, show, schedule, start, stop, update subcommands driving the YouTube liveBroadcasts API. Inspired by the ParkerClelland fork but rewritten against the current codebase. Improvements over the fork's implementation: - 'show --ingest' fetches the bound liveStream and prints the RTMP URLs; the stream key is redacted unless '--show-key' is passed explicitly. - 'start --to testing|live' covers the monitor-stream transition that streamers use to verify a feed before going live. - 'update' computes a partial change set, only touching the contentDetails part when any contentDetails field is actually changed. - ASCII '-' for empty values (project style) and no redundant BroadcastStatus.to_api_value mapping. - Demo-mode support via _DemoLiveBroadcasts and _DemoLiveStreams plus broadcasts.json / live_streams.json fixtures so 'YTSTUDIO_DEMO=1' can drive the new commands offline. Tests cover list/filter/empty, show with ingest redaction and reveal, start to testing vs live, stop, schedule dry-run vs execute body, partial update body, and friendly error mapping for liveStreamingNotEnabled. 160 tests pass, ruff clean.
- Preserve contentDetails.monitorStream (enableMonitorStream + broadcastStreamDelayMs) on update; YouTube rejects contentDetails updates that omit it. - Drop --made-for-kids from update; liveBroadcasts.update only accepts privacyStatus under status. Schedule keeps the flag (the resource is set on insert). - Parse and surface rtmpsBackupIngestionAddress in show --ingest. - Add OutputFormat enum so --output rejects anything other than table/json. - Expand _LIVESTREAM_ERRORS map with livePermissionBlocked, insufficientLivePermissions, errorExecutingTransition, userRequestsExceedRateLimit, concurrentBroadcastsExceedLimit, sharedIngestionBroadcastsExceedLimit. - Demo broadcasts.json fixtures carry monitorStream so demo mode mirrors the real resource shape. Tests cover monitorStream preservation through partial update, --output json redaction vs reveal, RTMPS backup display, and rejection of invalid --output values.
3 tasks done
jdwit
added a commit
that referenced
this pull request
May 26, 2026
Highlights since v0.1.1: - Multi-channel profile support: 'ytstudio profile add/use/list/remove' with per-profile credential storage and automatic migration from single-channel installs (#10). - New 'ytstudio livestreams' command: list/show/schedule/start/stop/update YouTube live broadcasts, with stream-key handling and demo-mode support (#12). - New 'yts' short CLI alias (#11).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add a new
ytstudio livestreamstyper app withlist,show,schedule,start,stop, andupdatesubcommands driving the YouTubeliveBroadcastsAPI. Inspired by ParkerClelland/ytstudio-cli but rewritten against the current codebase and reviewed against the YouTube Live API docs.What you get
livestreams listwith--status all|upcoming|active|completedand table/json output.livestreams show <id>with optional--ingest(RTMP/RTMPS URLs from the boundliveStream) and--show-key(reveals the stream key; redacted by default).livestreams schedulewith--title,--scheduled-start, optional--scheduled-end,--privacy,--description,--made-for-kids/--not-made-for-kidsand--execute(dry-run is default).livestreams start <id>with--to testing|livefor the monitor-stream-first workflow.livestreams stop <id>fortransition to complete.livestreams update <id>partial update; only sends the parts that actually changed, but always carriescontentDetails.monitorStreamwhencontentDetailsis touched (YouTube rejects updates that omit it).Improvements vs. the fork
show --ingestfetches the boundliveStreamand printsingestionAddress/rtmpsIngestionAddressplus their backups;streamNameis masked unless--show-keyis passed explicitly.monitorStream.enableMonitorStreamandbroadcastStreamDelayMson everycontentDetailswrite, fixing the fork's silent bug.updatealigned with API surface. Drops the--made-for-kidsflag here becauseliveBroadcasts.updateonly acceptsprivacyStatusunderstatus; the COPPA flag is set at schedule time.livePermissionBlocked,insufficientLivePermissions,errorExecutingTransition, rate-limit and concurrency errors map to actionable messages instead of rawHttpError.--outputis an enum (table/json); anything else is rejected.-for empty cells._DemoLiveBroadcasts+_DemoLiveStreamsandbroadcasts.json/live_streams.jsonfixtures soYTSTUDIO_DEMO=1drives the new commands offline.Out of scope (deliberate follow-ups)
liveStreamfromschedule(today you bind in Studio or with an encoder). Would add ~50 quota units and another OAuth-scoped write; worth a separate PR.videos.update.Review
Reviewed first by myself, then handed to Codex via the rescue subagent. Codex returned 1 high (the
monitorStreambug), 2 medium (status update surface, demo update validation), 3 low (missing error reasons, missing RTMPS backup, untyped--output). All five were applied in commitb1a6e54; the demo update validation was intentionally left as echo since demo mode is an offline aid, not a contract test.Test plan
pytest -q-> 164 passed (was 134 on main)ruff check .andruff format --check .-> cleanYTSTUDIO_DEMO=1 ytstudio livestreams list --status allshows seeded demo broadcastsYTSTUDIO_DEMO=1 ytstudio livestreams show demo-broadcast-upcoming-1 --ingestshows redacted stream keyYTSTUDIO_DEMO=1 ytstudio livestreams update demo-broadcast-upcoming-1 --no-dvrdry-run shows old/new diff