Skip to main content

Overview

The YouTube class provides automated video generation and upload functionality for YouTube Shorts. It handles the complete workflow from topic generation to video upload.

Constructor

YouTube(
    account_uuid: str,
    account_nickname: str,
    fp_profile_path: str,
    niche: str,
    language: str
)
account_uuid
str
required
The unique identifier for the YouTube account
account_nickname
str
required
The nickname for the YouTube account
fp_profile_path
str
required
Path to the Firefox profile that is logged into the specified YouTube account
niche
str
required
The niche of the provided YouTube channel
language
str
required
The language of the automation

Properties

niche

@property
def niche() -> str
Getter method for the niche. Returns: str - The niche

language

@property
def language() -> str
Getter method for the language to use. Returns: str - The language

Methods

generate_response

def generate_response(prompt: str, model_name: str = None) -> str
Generates an LLM response based on a prompt and the user-provided model.
prompt
str
required
The prompt to use in the text generation
model_name
str
Optional model name to use for generation
Returns: str - The generated AI response

generate_topic

def generate_topic() -> str
Generates a topic based on the YouTube channel niche. Returns: str - The generated topic Example:
youtube = YouTube(
    account_uuid="uuid-123",
    account_nickname="My Channel",
    fp_profile_path="/path/to/profile",
    niche="Technology Reviews",
    language="English"
)
topic = youtube.generate_topic()
print(f"Generated topic: {topic}")

generate_script

def generate_script() -> str
Generate a script for a video, depending on the subject of the video. Returns: str - The script of the video

generate_metadata

def generate_metadata() -> dict
Generates video metadata for the to-be-uploaded YouTube Short (title, description). Returns: dict - Dictionary containing:
  • title (str): Video title (under 100 characters)
  • description (str): Video description
Example:
metadata = youtube.generate_metadata()
print(f"Title: {metadata['title']}")
print(f"Description: {metadata['description']}")

generate_prompts

def generate_prompts() -> List[str]
Generates AI image prompts based on the provided video script. Returns: List[str] - Generated list of image prompts

generate_image

def generate_image(prompt: str) -> str
Generates an AI image based on the given prompt using Nano Banana 2.
prompt
str
required
Reference for image generation
Returns: str - The path to the generated image

generate_script_to_speech

def generate_script_to_speech(tts_instance: TTS) -> str
Converts the generated script into speech using KittenTTS and returns the path to the WAV file.
tts_instance
TTS
required
Instance of TTS class
Returns: str - Path to generated audio (WAV format)

generate_subtitles

def generate_subtitles(audio_path: str) -> str
Generates subtitles for the audio using the configured STT provider.
audio_path
str
required
The path to the audio file
Returns: str - The path to the generated SRT file

combine

def combine() -> str
Combines everything into the final video. Returns: str - The path to the generated MP4 file

generate_video

def generate_video(tts_instance: TTS) -> str
Generates a YouTube Short based on the provided niche and language. This method orchestrates the entire video generation workflow.
tts_instance
TTS
required
Instance of TTS class
Returns: str - The path to the generated MP4 file Example:
from classes.Tts import TTS

youtube = YouTube(
    account_uuid="uuid-123",
    account_nickname="My Channel",
    fp_profile_path="/path/to/profile",
    niche="Technology Reviews",
    language="English"
)

tts = TTS()
video_path = youtube.generate_video(tts)
print(f"Video generated at: {video_path}")

get_channel_id

def get_channel_id() -> str
Gets the channel ID of the YouTube account. Returns: str - The channel ID

upload_video

def upload_video() -> bool
Uploads the video to YouTube. Returns: bool - Whether the upload was successful or not

get_videos

def get_videos() -> List[dict]
Gets the uploaded videos from the YouTube channel. Returns: List[dict] - List of uploaded videos, each containing:
  • title (str): Video title
  • description (str): Video description
  • url (str): Video URL
  • date (str): Upload date

add_video

def add_video(video: dict) -> None
Adds a video to the cache.
video
dict
required
The video to add
Returns: None

Build docs developers (and LLMs) love