Обновить API wiki на русский

2026-05-27 14:55:52 +00:00
parent 9719c5e4cb
commit ff04cf8ac3
+23 -23
@@ -1,8 +1,8 @@
# API # API
## Exported objects ## Экспортируемые объекты
The package exports: Пакет экспортирует:
- `download` - `download`
- `download_short` - `download_short`
@@ -24,15 +24,15 @@ from yt_shorts_downloader import download
video = download(url, session_path) video = download(url, session_path)
``` ```
Behavior: Поведение:
- validates the YouTube URL - валидирует YouTube URL
- validates the cookie file - валидирует cookie-файл
- downloads into a temporary directory - скачивает видео во временную директорию
- ensures the final file is MP4 - убеждается, что итоговый файл является MP4
- returns a `DownloadedVideo` - возвращает `DownloadedVideo`
`DownloadedVideo` fields: Поля `DownloadedVideo`:
- `filename` - `filename`
- `content` - `content`
@@ -40,7 +40,7 @@ Behavior:
## download_short ## download_short
Alias for `download`. Алиас для `download`.
## download_to_path ## 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') path = download_to_path(url, session_path, output_dir='downloads')
``` ```
Behavior: Поведение:
- validates the URL and session file - валидирует URL и session file
- downloads directly into the target output directory - скачивает MP4 прямо в целевую директорию
- returns the saved file path - возвращает итоговый путь к файлу
## validate_session_file ## validate_session_file
@@ -65,7 +65,7 @@ from yt_shorts_downloader import validate_session_file
result = validate_session_file(Path('cookies.txt')) result = validate_session_file(Path('cookies.txt'))
``` ```
`SessionValidation` fields: Поля `SessionValidation`:
- `exists` - `exists`
- `structurally_valid` - `structurally_valid`
@@ -73,14 +73,14 @@ result = validate_session_file(Path('cookies.txt'))
- `is_usable` - `is_usable`
- `message` - `message`
## Exceptions ## Исключения
- `InvalidUrlError`: unsupported or malformed URL - `InvalidUrlError`: неподдерживаемая или некорректная ссылка
- `InvalidSessionError`: invalid or stale cookie file - `InvalidSessionError`: невалидный или устаревший cookie-файл
- `JsRuntimeUnavailableError`: Deno or Node.js 22+ not found - `JsRuntimeUnavailableError`: не найден Deno или Node.js 22+
- `VideoDownloadError`: yt-dlp failed or did not produce MP4 - `VideoDownloadError`: yt-dlp не смог получить MP4
- `YtShortsDownloaderError`: base package exception - `YtShortsDownloaderError`: базовое исключение библиотеки
## Notes ## Замечание
The public API is designed so that server-side integrations can immediately return MP4 bytes without managing temporary files themselves. Публичный API специально устроен так, чтобы серверная интеграция могла сразу вернуть MP4-байты клиенту без управления временными файлами на своей стороне.