Update PVideoDl to support custom download strategies and enhance cookie handling. Added new downloader registration system, updated README for clarity on downloaders, and introduced cookies configuration in settings. Frontend now includes a dedicated tab for download strategies and API endpoints for listing them.

This commit is contained in:
Leonid Pershin
2026-06-20 09:08:31 +03:00
parent 3e47e95fc4
commit eae4def0bf
15 changed files with 639 additions and 74 deletions
+10
View File
@@ -21,6 +21,11 @@ def _env_int(name: str, default: int) -> int:
return default
def _env_path_opt(name: str) -> Path | None:
value = os.environ.get(name)
return Path(value).expanduser().resolve() if value else None
@dataclass(frozen=True)
class Settings:
# Куда складывать скачанные файлы.
@@ -38,6 +43,11 @@ class Settings:
# Хост/порт веб-сервера.
host: str = os.environ.get("PVDL_HOST", "127.0.0.1")
port: int = _env_int("PVDL_PORT", 8000)
# Cookies для yt-dlp (сайты, блокирующие анонимные запросы: возрастной гейт,
# логин, гео). Браузер: "chrome" | "firefox" | "edge" | … , можно "chrome:Профиль".
cookies_from_browser: str | None = os.environ.get("PVDL_COOKIES_FROM_BROWSER") or None
# Файл cookies в формате Netscape (cookies.txt).
cookies_file: Path | None = _env_path_opt("PVDL_COOKIES_FILE")
settings = Settings()