From ff04cf8ac34ccc90b8859b0095eb554ff24abbe1 Mon Sep 17 00:00:00 2001 From: CREATIVE_tg1 <1+creative_tg1@noreply.localhost> Date: Wed, 27 May 2026 14:55:52 +0000 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20API=20wiki=20=D0=BD=D0=B0=20=D1=80=D1=83=D1=81=D1=81?= =?UTF-8?q?=D0=BA=D0=B8=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- API.md | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/API.md b/API.md index 64523d3..2591d64 100644 --- a/API.md +++ b/API.md @@ -1,8 +1,8 @@ # API -## Exported objects +## Экспортируемые объекты -The package exports: +Пакет экспортирует: - `download` - `download_short` @@ -24,15 +24,15 @@ from yt_shorts_downloader import download video = download(url, session_path) ``` -Behavior: +Поведение: -- validates the YouTube URL -- validates the cookie file -- downloads into a temporary directory -- ensures the final file is MP4 -- returns a `DownloadedVideo` +- валидирует YouTube URL +- валидирует cookie-файл +- скачивает видео во временную директорию +- убеждается, что итоговый файл является MP4 +- возвращает `DownloadedVideo` -`DownloadedVideo` fields: +Поля `DownloadedVideo`: - `filename` - `content` @@ -40,7 +40,7 @@ Behavior: ## download_short -Alias for `download`. +Алиас для `download`. ## download_to_path @@ -50,11 +50,11 @@ from yt_shorts_downloader import download_to_path path = download_to_path(url, session_path, output_dir='downloads') ``` -Behavior: +Поведение: -- validates the URL and session file -- downloads directly into the target output directory -- returns the saved file path +- валидирует URL и session file +- скачивает MP4 прямо в целевую директорию +- возвращает итоговый путь к файлу ## validate_session_file @@ -65,7 +65,7 @@ from yt_shorts_downloader import validate_session_file result = validate_session_file(Path('cookies.txt')) ``` -`SessionValidation` fields: +Поля `SessionValidation`: - `exists` - `structurally_valid` @@ -73,14 +73,14 @@ result = validate_session_file(Path('cookies.txt')) - `is_usable` - `message` -## Exceptions +## Исключения -- `InvalidUrlError`: unsupported or malformed URL -- `InvalidSessionError`: invalid or stale cookie file -- `JsRuntimeUnavailableError`: Deno or Node.js 22+ not found -- `VideoDownloadError`: yt-dlp failed or did not produce MP4 -- `YtShortsDownloaderError`: base package exception +- `InvalidUrlError`: неподдерживаемая или некорректная ссылка +- `InvalidSessionError`: невалидный или устаревший cookie-файл +- `JsRuntimeUnavailableError`: не найден Deno или Node.js 22+ +- `VideoDownloadError`: yt-dlp не смог получить MP4 +- `YtShortsDownloaderError`: базовое исключение библиотеки -## Notes +## Замечание -The public API is designed so that server-side integrations can immediately return MP4 bytes without managing temporary files themselves. +Публичный API специально устроен так, чтобы серверная интеграция могла сразу вернуть MP4-байты клиенту без управления временными файлами на своей стороне.