from __future__ import annotations from pydantic import BaseModel, Field class FormatInfo(BaseModel): id: str name: str | None = None protocol: str | None = None ext: str | None = None container: str | None = None width: int | None = None height: int | None = None fps: float | None = None vcodec: str | None = None acodec: str | None = None bitrate: float | None = None filesize: int | None = None audio_channels: int | None = None language: str | None = None video_only: bool = False audio_only: bool = False # Kronic backend consumes these immediately with ffmpeg. # Signed URLs are short-lived; do not expose this API publicly. direct_url: str http_headers: dict[str, str] = Field(default_factory=dict) class VideoInfo(BaseModel): id: str title: str duration: float | None = None channel: str | None = None channel_id: str | None = None thumbnail: str | None = None formats: list[FormatInfo] = Field(default_factory=list) class SearchItem(BaseModel): id: str title: str duration: float | None = None channel: str | None = None channel_id: str | None = None thumbnail: str | None = None webpage_url: str | None = None class SearchResponse(BaseModel): items: list[SearchItem] = Field(default_factory=list)