yb.content¶
Target-agnostic publication content: prepare it once, publish anywhere.
A PublicationContent bundles everything a publication needs that is
not specific to a destination — title, description, keywords, chapters,
languages, and the media/transcript/thumbnail assets. Platform adapters
(yb.youtube, yb.podcast) consume it and map it to their own schema.
The heavy lifting (transcription, chapter detection, thumbnail rendering) is
delegated to the mixing package; the copywriting (title/description/
keywords) is LLM-backed via aix and pluggable.
Functions
|
Render chapters as |
|
Generate platform-neutral title/description/keywords from a transcript. |
|
Build a |
Classes
|
Platform-neutral copy: a title, a description, and keywords. |
|
Everything needed to publish a piece of media, destination-agnostic. |
- class yb.content.ContentMetadata(title, description, keywords=<factory>)[source]¶
Bases:
objectPlatform-neutral copy: a title, a description, and keywords.
- class yb.content.PublicationContent(media, title='', description='', keywords=<factory>, chapters=<factory>, language=None, audio_language=None, srt_path=None, thumbnail=None, duration=None)[source]¶
Bases:
objectEverything needed to publish a piece of media, destination-agnostic.
- media¶
Path to the audio/video file.
- title¶
Headline/title.
- description¶
Long-form description / show notes body.
- keywords¶
Topical keywords/tags.
- chapters¶
Ordered chapter markers (
mixing.chapters.Chapter).
- language¶
BCP-47 code of the metadata text (e.g.
"en").
- audio_language¶
BCP-47 code of the spoken audio (e.g.
"fr").
- srt_path¶
Path to the SRT subtitle/caption file, if any.
- thumbnail¶
Path to a thumbnail/cover image, if any.
- duration¶
Media duration in seconds, if known.
- yb.content.format_chapter_lines(chapters)[source]¶
Render chapters as
M:SS Titlelines (the shared text convention).Uses
H:MM:SSwhen any chapter is at or beyond one hour. This is the text format both YouTube descriptions and podcast show notes accept.- Return type:
- yb.content.generate_metadata(transcript, *, language='English', brand=None, extra_context=None, model=None)[source]¶
Generate platform-neutral title/description/keywords from a transcript.
LLM-backed via
aix. Pass a readyContentMetadatatoprepare_content()instead if you want to skip generation.- Raises:
ImportError –
aixis not importable.- Return type:
- yb.content.prepare_content(media, *, language='English', language_code=None, audio_language_code=None, brand=None, extra_context=None, transcript=None, with_chapters=True, with_thumbnail=False, thumbnail_text=None, metadata=None, model=None, transcribe_kwargs=None, chapters_kwargs=None)[source]¶
Build a
PublicationContentformedia(destination-agnostic).Ensures a persisted SRT next to the media (transcribing once via
mixingif needed), writes LLM metadata, detects chapters (default on, auto-skipped for clips too short to host them), and optionally renders a thumbnail. Any precomputed pieces (transcript,metadata) are reused instead of recomputed.- Parameters:
language (
str) – Human-readable language to write metadata in.audio_language_code (
str|None) – BCP-47 codes for the metadata text and the spoken audio.brand (
str|None) – Product/brand name to keep verbatim in the copy.extra_context (
str|None) – Extra guidance for the copywriter (audience, CTA…).transcript (
str|None) – SRT text to use as-is (skips transcription).with_chapters (
bool) – Detect chapters (defaultTrue).with_thumbnail (
bool) – Render a thumbnail image (defaultFalse).thumbnail_text (
str|None) – Overlay text for the thumbnail (defaults to the title).metadata (
ContentMetadata|None) – PrecomputedContentMetadatato reuse.chapters_kwargs (
dict|None) – Forwarded to the mixing calls.
- Return type:
- Returns:
A populated
PublicationContent.