Basemodels¶
- class asyncyt.basemodels.DownloadConfig(*, output_path: str = './downloads', quality: ~asyncyt.enums.Quality = Quality.BEST, audio_format: ~asyncyt.enums.AudioFormat | None = None, video_format: ~asyncyt.enums.VideoFormat | None = None, extract_audio: bool = False, embed_subs: bool = False, write_subs: bool = False, subtitle_lang: str = 'en', write_thumbnail: bool = False, embed_thumbnail: bool = False, embed_metadata: bool = True, write_info_json: bool = False, custom_filename: str | None = None, cookies_file: str | None = None, proxy: str | None = None, rate_limit: str | None = None, retries: ~typing.Annotated[int, ~annotated_types.Ge(ge=0), ~annotated_types.Le(le=10)] = 3, fragment_retries: ~typing.Annotated[int, ~annotated_types.Ge(ge=0), ~annotated_types.Le(le=10)] = 3, custom_options: ~typing.Dict[str, ~typing.Any] = <factory>, ffmpeg_config: ~asyncyt.basemodels.FFmpegConfig = <factory>)[source]¶
Bases:
BaseModel
Configuration for downloads.
See attributes for all configuration options.
- class Config[source]¶
Bases:
object
- json_schema_extra = {'example': {'audio_format': 'mp3', 'embed_thumbnail': True, 'extract_audio': True, 'output_path': './downloads', 'quality': '720p', 'retries': 3, 'subtitle_lang': 'en', 'write_thumbnail': True}}¶
- use_enum_values = True¶
- audio_format: AudioFormat | None¶
- cookies_file: str | None¶
- custom_filename: str | None¶
- custom_options: Dict[str, Any]¶
- embed_metadata: bool¶
- embed_subs: bool¶
- embed_thumbnail: bool¶
- extract_audio: bool¶
- ffmpeg_config: FFmpegConfig¶
- fragment_retries: int¶
- model_config: ClassVar[ConfigDict] = {'json_schema_extra': {'example': {'audio_format': 'mp3', 'embed_thumbnail': True, 'extract_audio': True, 'output_path': './downloads', 'quality': '720p', 'retries': 3, 'subtitle_lang': 'en', 'write_thumbnail': True}}, 'use_enum_values': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- output_path: str¶
- proxy: str | None¶
- rate_limit: str | None¶
- retries: int¶
- subtitle_lang: str¶
- video_format: VideoFormat | None¶
- write_info_json: bool¶
- write_subs: bool¶
- write_thumbnail: bool¶
- class asyncyt.basemodels.DownloadFileProgress(*, status: ProgressStatus = ProgressStatus.DOWNLOADING, downloaded_bytes: int = 0, total_bytes: int = 0, percentage: Annotated[float, Ge(ge=0.0), Le(le=100.0)] = 0.0)[source]¶
Bases:
BaseModel
Progress information for file downloads.
- Parameters:
status (ProgressStatus) – Progress status.
downloaded_bytes (int) – Bytes downloaded.
total_bytes (int) – Total bytes to download.
percentage (float) – Download percentage.
- class Config[source]¶
Bases:
object
- json_encoders = {<class 'float'>: <function DownloadFileProgress.Config.<lambda>>}¶
- downloaded_bytes: int¶
- property is_complete: bool¶
- model_config: ClassVar[ConfigDict] = {'json_encoders': {<class 'float'>: <function DownloadFileProgress.Config.<lambda>>}}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- percentage: float¶
- status: ProgressStatus¶
- total_bytes: int¶
- class asyncyt.basemodels.DownloadProgress(*, id: str, url: str, title: str = '', status: ~asyncyt.enums.ProgressStatus = ProgressStatus.DOWNLOADING, downloaded_bytes: int = 0, total_bytes: int = 0, speed: str = '', eta: int = 0, percentage: ~typing.Annotated[float, ~annotated_types.Ge(ge=0.0), ~annotated_types.Le(le=100.0)] = 0.0, ffmpeg_progress: ~asyncyt.basemodels.FFmpegProgress = <factory>)[source]¶
Bases:
BaseModel
Progress information for downloads.
- Parameters:
id (str) – Download ID.
url (str) – Download URL.
title (str) – Download title.
status (ProgressStatus) – Progress status.
downloaded_bytes (int) – Bytes downloaded.
total_bytes (int) – Total bytes to download.
speed (str) – Download speed.
eta (int) – Estimated time remaining.
percentage (float) – Download percentage.
ffmpeg_progress (FFmpegProgress) – FFmpeg progress info.
- class Config[source]¶
Bases:
object
- json_encoders = {<class 'float'>: <function DownloadProgress.Config.<lambda>>}¶
- downloaded_bytes: int¶
- eta: int¶
- ffmpeg_progress: FFmpegProgress¶
- id: str¶
- property is_complete: bool¶
- model_config: ClassVar[ConfigDict] = {'json_encoders': {<class 'float'>: <function DownloadProgress.Config.<lambda>>}}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- percentage: float¶
- speed: str¶
- status: ProgressStatus¶
- title: str¶
- total_bytes: int¶
- url: str¶
- class asyncyt.basemodels.DownloadRequest(*, url: str, config: DownloadConfig | None = None)[source]¶
Bases:
BaseModel
Request model for download endpoints.
- Parameters:
url (str) – Video URL to download.
config (Optional[DownloadConfig]) – Download configuration.
- class Config[source]¶
Bases:
object
- json_schema_extra = {'example': {'config': {'audio_format': 'mp3', 'extract_audio': True, 'output_path': './downloads', 'quality': '720p'}, 'url': 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'}}¶
- config: DownloadConfig | None¶
- model_config: ClassVar[ConfigDict] = {'json_schema_extra': {'example': {'config': {'audio_format': 'mp3', 'extract_audio': True, 'output_path': './downloads', 'quality': '720p'}, 'url': 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'}}}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- url: str¶
- class asyncyt.basemodels.DownloadResponse(*, success: bool, message: str, id: str, filename: str | None = None, video_info: VideoInfo | None = None, error: str | None = None)[source]¶
Bases:
BaseModel
Response model for download operations.
- Parameters:
success (bool) – Whether the download was successful.
message (str) – Status message.
id (str) – Download ID.
filename (Optional[str]) – Downloaded filename.
video_info (Optional[VideoInfo]) – Video information.
error (Optional[str]) – Error message if any.
- class Config[source]¶
Bases:
object
- json_schema_extra = {'example': {'filename': './downloads/Rick Astley - Never Gonna Give You Up.mp4', 'message': 'Download completed successfully', 'success': True, 'video_info': {'duration': 212, 'title': 'Rick Astley - Never Gonna Give You Up', 'uploader': 'RickAstleyVEVO'}}}¶
- error: str | None¶
- filename: str | None¶
- id: str¶
- message: str¶
- model_config: ClassVar[ConfigDict] = {'json_schema_extra': {'example': {'filename': './downloads/Rick Astley - Never Gonna Give You Up.mp4', 'message': 'Download completed successfully', 'success': True, 'video_info': {'duration': 212, 'title': 'Rick Astley - Never Gonna Give You Up', 'uploader': 'RickAstleyVEVO'}}}}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- success: bool¶
- class asyncyt.basemodels.FFmpegConfig(*, ffmpeg_path: str = 'ffmpeg', inputs: ~typing.List[~asyncyt.basemodels.InputFile] = <factory>, output_path: str = './output', output_filename: str | None = None, video_codec: ~asyncyt.enums.VideoCodec = VideoCodec.COPY, video_format: ~asyncyt.enums.VideoFormat | None = None, video_bitrate: str | None = None, crf: ~typing.Annotated[int | None, ~annotated_types.Ge(ge=0), ~annotated_types.Le(le=51)] = None, preset: ~asyncyt.enums.Preset = Preset.MEDIUM, audio_codec: ~asyncyt.enums.AudioCodec = AudioCodec.COPY, audio_bitrate: str | None = None, audio_sample_rate: int | None = None, audio_channels: ~typing.Annotated[int | None, ~annotated_types.Ge(ge=1), ~annotated_types.Le(le=8)] = None, width: ~typing.Annotated[int | None, ~annotated_types.Ge(ge=1)] = None, height: ~typing.Annotated[int | None, ~annotated_types.Ge(ge=1)] = None, scale_filter: str | None = None, fps: ~typing.Annotated[float | None, ~annotated_types.Gt(gt=0)] = None, extract_audio: bool = False, remove_video: bool = False, remove_audio: bool = False, start_time: str | None = None, duration: str | None = None, end_time: str | None = None, video_filters: ~typing.List[str] = <factory>, audio_filters: ~typing.List[str] = <factory>, hardware_accel: str | None = None, two_pass: bool = False, overwrite: bool = False, threads: ~typing.Annotated[int | None, ~annotated_types.Ge(ge=1)] = None, delete_source: bool = True, preserve_metadata: bool = True, copy_subs: bool = False, copy_attachments: bool = False, custom_metadata: ~typing.Dict[str, str] = <factory>, log_level: str = 'info', verbose: bool = False, no_codec_compatibility_error: bool = True, custom_input_options: ~typing.List[str] = <factory>, custom_output_options: ~typing.List[str] = <factory>)[source]¶
Bases:
BaseModel
Configuration for FFmpeg operations.
See attributes for all configuration options.
- class Config[source]¶
Bases:
object
- json_schema_extra = {'example': {'audio_bitrate': '128k', 'audio_codec': 'aac', 'crf': 23, 'height': 1080, 'inputs': [{'path': 'video.mp4', 'type': 'video'}, {'path': 'audio.mp3', 'type': 'audio'}, {'path': 'subtitles.srt', 'type': 'subtitle'}, {'path': 'thumbnail.jpg', 'type': 'thumbnail'}], 'output_path': './output', 'overwrite': True, 'preserve_metadata': True, 'preset': 'medium', 'video_codec': 'libx264', 'video_format': 'mp4', 'width': 1920}}¶
- use_enum_values = True¶
- add_input(path: str, input_type: InputType, options: List[str] | None = None, stream_index: int | None = None)[source]¶
Add an input file to the configuration.
- Parameters:
path (str) – Path to input file.
input_type (InputType) – Type of input file.
options (Optional[List[str]]) – Input-specific options.
stream_index (Optional[int]) – Specific stream index to use.
- add_media_input(path: str, options: List[str] | None = None)[source]¶
Convenience method to add Video/Audio input.
- Parameters:
path (str) – Path to media file.
options (Optional[List[str]]) – Input-specific options.
- add_subtitle_input(path: str, options: List[str] | None = None)[source]¶
Convenience method to add subtitle input.
- Parameters:
path (str) – Path to subtitle file.
options (Optional[List[str]]) – Input-specific options.
- add_thumbnail_input(path: str, options: List[str] | None = None)[source]¶
Convenience method to add thumbnail input.
- Parameters:
path (str) – Path to thumbnail file.
options (Optional[List[str]]) – Input-specific options.
- audio_bitrate: str | None¶
- audio_channels: int | None¶
- audio_codec: AudioCodec¶
- audio_filters: List[str]¶
- audio_sample_rate: int | None¶
- build_command() List[str] [source]¶
Build the FFmpeg command based on configuration with dynamic format/codec handling.
- Returns:
List of FFmpeg command arguments.
- Return type:
List[str]
- build_two_pass_commands() tuple[List[str], List[str]] [source]¶
Build two separate commands for two-pass encoding.
- Returns:
Tuple of (first_pass_command, second_pass_command).
- Return type:
tuple[List[str], List[str]]
- Raises:
ValueError – If two-pass encoding is not enabled.
- copy_attachments: bool¶
- copy_subs: bool¶
- crf: int | None¶
- custom_input_options: List[str]¶
- custom_metadata: Dict[str, str]¶
- custom_output_options: List[str]¶
- delete_source: bool¶
- duration: str | None¶
- end_time: str | None¶
- extract_audio: bool¶
- ffmpeg_path: str¶
- fps: float | None¶
- get_audio_codec(format: AudioFormat | None = None) AudioCodec [source]¶
Get the audio codec for a given format.
- Parameters:
format (Optional[AudioFormat]) – Audio format.
- Returns:
AudioCodec enum value.
- Return type:
- get_audio_format(original_ext: str | None = None)[source]¶
Get the audio format extension for the current codec.
- Parameters:
original_ext (Optional[str]) – Original file extension.
- Returns:
Audio format extension.
- Return type:
str
- get_command_string() str [source]¶
Get the command as a formatted string.
- Returns:
FFmpeg command as a string.
- Return type:
str
- get_output_filename(original_ext: str | None = None) str [source]¶
Generate output filename with proper extension.
- Parameters:
original_ext (Optional[str]) – Original file extension.
- Returns:
Output filename.
- Return type:
str
- Raises:
InvalidFFmpegConfigError – If neither video_format nor audio_codec is set.
- hardware_accel: str | None¶
- height: int | None¶
- index_thumbnail_input(index: int)[source]¶
Set the thumbnail stream index.
- Parameters:
index (int) – Stream index for thumbnail.
- property is_empty¶
Check if the config is empty (no video/audio settings).
- Returns:
True if empty, False otherwise.
- Return type:
bool
- Raises:
InvalidFFmpegConfigError – If neither video_format nor audio_codec is set.
- log_level: str¶
- model_config: ClassVar[ConfigDict] = {'json_schema_extra': {'example': {'audio_bitrate': '128k', 'audio_codec': 'aac', 'crf': 23, 'height': 1080, 'inputs': [{'path': 'video.mp4', 'type': 'video'}, {'path': 'audio.mp3', 'type': 'audio'}, {'path': 'subtitles.srt', 'type': 'subtitle'}, {'path': 'thumbnail.jpg', 'type': 'thumbnail'}], 'output_path': './output', 'overwrite': True, 'preserve_metadata': True, 'preset': 'medium', 'video_codec': 'libx264', 'video_format': 'mp4', 'width': 1920}}, 'use_enum_values': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_post_init(context: Any, /) None ¶
This function is meant to behave like a BaseModel method to initialise private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self – The BaseModel instance.
context – The context.
- no_codec_compatibility_error: bool¶
- output_filename: str | None¶
- output_path: str¶
- overwrite: bool¶
- preserve_metadata: bool¶
- remove_audio: bool¶
- remove_video: bool¶
- scale_filter: str | None¶
- start_time: str | None¶
- threads: int | None¶
- two_pass: bool¶
- verbose: bool¶
- video_bitrate: str | None¶
- video_codec: VideoCodec¶
- video_filters: List[str]¶
- video_format: VideoFormat | None¶
- width: int | None¶
- class asyncyt.basemodels.FFmpegProgress(*, frame: int = 0, fps: float = 0.0, bitrate: str = '0kbits/s', total_size: int = 0, out_time_us: int = 0, speed: str = '0x', progress: str = 'unknown')[source]¶
Bases:
BaseModel
FFmpeg progress information.
- Parameters:
frame (int) – Current frame.
fps (float) – Frames per second.
bitrate (str) – Bitrate string.
total_size (int) – Total size in bytes.
out_time_us (int) – Output time in microseconds.
speed (str) – Processing speed.
progress (str) – Progress status.
- bitrate: str¶
- fps: float¶
- frame: int¶
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- property out_time_seconds: float¶
- out_time_us: int¶
- progress: str¶
- speed: str¶
- total_size: int¶
- class asyncyt.basemodels.HealthResponse(*, status: str = 'healthy', yt_dlp_available: bool = False, ffmpeg_available: bool = False, version: str = '1.0.0', binaries_path: str | None = None, error: str | None = None)[source]¶
Bases:
BaseModel
Health check response.
- Parameters:
status (str) – Health status.
yt_dlp_available (bool) – Is yt-dlp available.
ffmpeg_available (bool) – Is ffmpeg available.
version (str) – Version string.
binaries_path (Optional[str]) – Path to binaries.
error (Optional[str]) – Error message if any.
- binaries_path: str | None¶
- error: str | None¶
- ffmpeg_available: bool¶
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- status: str¶
- version: str¶
- yt_dlp_available: bool¶
- class asyncyt.basemodels.InputFile(*, path: str, type: ~asyncyt.enums.InputType, options: ~typing.List[str] = <factory>, stream_index: int | None = None)[source]¶
Bases:
BaseModel
Single input file configuration.
- Parameters:
path (str) – Path to input file.
type (InputType) – Type of input file.
options (List[str]) – Input-specific options.
stream_index (Optional[int]) – Specific stream index to use.
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- options: List[str]¶
- path: str¶
- stream_index: int | None¶
- class asyncyt.basemodels.MediaInfo(*, filename: str, format_name: str, format_long_name: str, duration: float, size: int, bit_rate: int, streams: List[StreamInfo])[source]¶
Bases:
BaseModel
Media file information.
- Parameters:
filename (str) – Filename.
format_name (str) – Format name.
format_long_name (str) – Long format name.
duration (float) – Duration in seconds.
size (int) – File size in bytes.
bit_rate (int) – Bitrate.
streams (List[StreamInfo]) – List of stream info.
- bit_rate: int¶
- duration: float¶
- filename: str¶
- format_long_name: str¶
- format_name: str¶
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- size: int¶
- streams: List[StreamInfo]¶
- class asyncyt.basemodels.PlaylistRequest(*, url: str, config: DownloadConfig | None = None, max_videos: Annotated[int, Ge(ge=1), Le(le=1000)] = 100)[source]¶
Bases:
BaseModel
Request model for playlist downloads.
- Parameters:
url (str) – Playlist URL.
config (Optional[DownloadConfig]) – Download configuration.
max_videos (int) – Maximum videos to download.
- config: DownloadConfig | None¶
- max_videos: int¶
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- url: str¶
- class asyncyt.basemodels.PlaylistResponse(*, success: bool, message: str, downloaded_files: ~typing.List[str] = <factory>, failed_downloads: ~typing.List[str] = <factory>, total_videos: int = 0, successful_downloads: int = 0, error: str | None = None)[source]¶
Bases:
BaseModel
Response model for playlist operations.
- Parameters:
success (bool) – Whether the playlist download was successful.
message (str) – Status message.
downloaded_files (List[str]) – List of downloaded files.
failed_downloads (List[str]) – List of failed downloads.
total_videos (int) – Total number of videos in playlist.
successful_downloads (int) – Number of successful downloads.
error (Optional[str]) – Error message if any.
- downloaded_files: List[str]¶
- error: str | None¶
- failed_downloads: List[str]¶
- message: str¶
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- success: bool¶
- successful_downloads: int¶
- total_videos: int¶
- class asyncyt.basemodels.SearchRequest(*, query: Annotated[str, MinLen(min_length=1), MaxLen(max_length=200)], max_results: Annotated[int, Ge(ge=1), Le(le=50)] = 10)[source]¶
Bases:
BaseModel
Request model for search endpoints.
- Parameters:
query (str) – Search query string.
max_results (int) – Maximum number of results.
- class Config[source]¶
Bases:
object
- json_schema_extra = {'example': {'max_results': 5, 'query': 'python tutorial'}}¶
- max_results: int¶
- model_config: ClassVar[ConfigDict] = {'json_schema_extra': {'example': {'max_results': 5, 'query': 'python tutorial'}}}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- query: str¶
- class asyncyt.basemodels.SearchResponse(*, success: bool, message: str, results: ~typing.List[~asyncyt.basemodels.VideoInfo] = <factory>, total_results: int = 0, error: str | None = None)[source]¶
Bases:
BaseModel
Response model for search operations.
- Parameters:
success (bool) – Whether the search was successful.
message (str) – Status message.
results (List[VideoInfo]) – List of search results.
total_results (int) – Total number of results.
error (Optional[str]) – Error message if any.
- class Config[source]¶
Bases:
object
- json_schema_extra = {'example': {'message': 'Search completed successfully', 'results': [{'duration': 1800, 'title': 'Python Tutorial for Beginners', 'uploader': 'Programming Channel', 'url': 'https://www.youtube.com/watch?v=example1'}], 'success': True, 'total_results': 3}}¶
- error: str | None¶
- message: str¶
- model_config: ClassVar[ConfigDict] = {'json_schema_extra': {'example': {'message': 'Search completed successfully', 'results': [{'duration': 1800, 'title': 'Python Tutorial for Beginners', 'uploader': 'Programming Channel', 'url': 'https://www.youtube.com/watch?v=example1'}], 'success': True, 'total_results': 3}}}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- success: bool¶
- total_results: int¶
- class asyncyt.basemodels.SetupProgress(*, file: str = 'yt-dlp', download_file_progress: DownloadFileProgress)[source]¶
Bases:
BaseModel
Progress information for file downloads.
- Parameters:
file (str) – File being downloaded.
download_file_progress (DownloadFileProgress) – Progress of the file being downloaded.
- class Config[source]¶
Bases:
object
- json_encoders = {<class 'float'>: <function SetupProgress.Config.<lambda>>}¶
- download_file_progress: DownloadFileProgress¶
- file: str¶
- model_config: ClassVar[ConfigDict] = {'json_encoders': {<class 'float'>: <function SetupProgress.Config.<lambda>>}}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class asyncyt.basemodels.StreamInfo(*, index: int, codec_type: str, codec_name: str | None = None, width: int | None = None, height: int | None = None, bit_rate: int | None = None, sample_rate: int | None = None, channels: int | None = None, language: str | None = None)[source]¶
Bases:
BaseModel
Stream information for media files.
- Parameters:
index (int) – Stream index.
codec_type (str) – Codec type (audio, video, etc).
codec_name (Optional[str]) – Codec name.
width (Optional[int]) – Video width.
height (Optional[int]) – Video height.
bit_rate (Optional[int]) – Bitrate.
sample_rate (Optional[int]) – Sample rate.
channels (Optional[int]) – Number of channels.
language (Optional[str]) – Language tag.
- bit_rate: int | None¶
- channels: int | None¶
- codec_name: str | None¶
- codec_type: str¶
- height: int | None¶
- index: int¶
- language: str | None¶
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- sample_rate: int | None¶
- width: int | None¶
- class asyncyt.basemodels.VideoInfo(*, url: str, title: str, duration: ~typing.Annotated[float, ~annotated_types.Ge(ge=-1)] = 0, uploader: str, view_count: ~typing.Annotated[int, ~annotated_types.Ge(ge=-1)] = 0, like_count: ~typing.Annotated[int | None, ~annotated_types.Ge(ge=-1)] = None, description: str = '', thumbnail: str = '', upload_date: str = '', formats: ~typing.List[~typing.Dict[str, ~typing.Any]] = <factory>)[source]¶
Bases:
BaseModel
Video information extracted from URL.
- Parameters:
url (str) – Video URL.
title (str) – Video title.
duration (float) – Duration in seconds.
uploader (str) – Uploader name.
view_count (int) – Number of views.
like_count (Optional[int]) – Number of likes.
description (str) – Video description.
thumbnail (str) – Thumbnail URL.
upload_date (str) – Upload date.
formats (List[Dict[str, Any]]) – List of available formats.
- class Config[source]¶
Bases:
object
- json_schema_extra = {'example': {'description': 'Official video...', 'duration': 212, 'like_count': 10000000, 'thumbnail': 'https://i.ytimg.com/vi/dQw4w9WgXcQ/maxresdefault.jpg', 'title': 'Rick Astley - Never Gonna Give You Up', 'upload_date': '20091025', 'uploader': 'RickAstleyVEVO', 'url': 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'view_count': 1000000000}}¶
- description: str¶
- duration: float¶
- formats: List[Dict[str, Any]]¶
- classmethod from_dict(data: dict) VideoInfo [source]¶
Create a VideoInfo instance from a dictionary.
- Parameters:
data (dict) – Dictionary with video info.
- Returns:
VideoInfo instance.
- Return type:
- like_count: int | None¶
- model_config: ClassVar[ConfigDict] = {'json_schema_extra': {'example': {'description': 'Official video...', 'duration': 212, 'like_count': 10000000, 'thumbnail': 'https://i.ytimg.com/vi/dQw4w9WgXcQ/maxresdefault.jpg', 'title': 'Rick Astley - Never Gonna Give You Up', 'upload_date': '20091025', 'uploader': 'RickAstleyVEVO', 'url': 'https://www.youtube.com/watch?v=dQw4w9WgXcQ', 'view_count': 1000000000}}}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- thumbnail: str¶
- title: str¶
- upload_date: str¶
- uploader: str¶
- url: str¶
- view_count: int¶