Bulk asynchronous downloader for multiple file hosts
Python asynciobunkrcyberdropdownloaderdropboxfilestergofilegoogle-drivemediafiremegamega-nzonedrivepatreonpawchivepinterestpixeldraintransfer-ittwitchtwittervk
Improve Cookie Import (#754)
Jacobf6575b02eb3c
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 035166f81..37fb5bede 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -7,10 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0## [UNRELEASED]+### Added++- Add an option to import cookies from all supported sites+### Changed- Speed up checking for empty files & folders by up to 2x- Speed up sorting files by up to 1.5x+- Remove browsers that aren't supported by the user's OS from the list of available browsers++### Fixed++- Fixed an error when trying to select done after choosing to import cookies## [6.6.1] - 2025-02-28diff --git a/cyberdrop_dl/ui/prompts/user_prompts.py b/cyberdrop_dl/ui/prompts/user_prompts.pyindex 4172ec332..48ccbf20a 100644--- a/cyberdrop_dl/ui/prompts/user_prompts.py+++ b/cyberdrop_dl/ui/prompts/user_prompts.py@@ -2,6 +2,7 @@ from __future__ import annotationsimport asynciofrom enum import IntEnum+from platform import systemfrom typing import TYPE_CHECKINGfrom InquirerPy import get_style@@ -17,7 +18,11 @@ from cyberdrop_dl.ui.prompts import basic_promptsfrom cyberdrop_dl.ui.prompts.defaults import ALL_CHOICE, DONE_CHOICE, EXIT_CHOICEfrom cyberdrop_dl.utils.constants import BROWSERS, RESERVED_CONFIG_NAMESfrom cyberdrop_dl.utils.cookie_management import get_cookies_from_browsers-from cyberdrop_dl.utils.data_enums_classes.supported_domains import SUPPORTED_FORUMS, SUPPORTED_WEBSITES+from cyberdrop_dl.utils.data_enums_classes.supported_domains import (+ SUPPORTED_FORUMS,+ SUPPORTED_SITES_DOMAINS,+ SUPPORTED_WEBSITES,+)from cyberdrop_dl.utils.utilities import clear_termif TYPE_CHECKING:@@ -154,12 +159,15 @@ class DomainType(IntEnum):def domains_prompt(*, domain_message: str = "Select site(s):") -> tuple[list[str], list[str]]:"""Asks the user to select website(s) for cookie actions and cache actions."""- OPTIONS = [["forum", "file-host"]]+ OPTIONS = [["Forum", "File Host"], ["All Supported Websites"]]choices = basic_prompts.create_choices(OPTIONS)domain_type = basic_prompts.ask_choice(choices, message="Select category:")if domain_type == DONE_CHOICE.value:- return []+ return [], []++ if domain_type == 3:+ return SUPPORTED_SITES_DOMAINS, SUPPORTED_SITES_DOMAINSall_domains = list(SUPPORTED_FORUMS.values() if domain_type == DomainType.FORUM else SUPPORTED_WEBSITES.values())domain_choices = [Choice(site) for site in all_domains] + [ALL_CHOICE]@@ -193,6 +201,8 @@ def extract_cookies(manager: Manager, *, dry_run: bool = False) -> None:"""Asks the user to select browser(s) and domains(s) to import cookies from."""domains, all_domains = domains_prompt(domain_message="Select site(s) to import cookies from:")+ if domains == []:+ returnbrowsers = browser_prompt()if ALL_CHOICE.value in browsers:@@ -211,7 +221,13 @@ def extract_cookies(manager: Manager, *, dry_run: bool = False) -> None:def browser_prompt() -> str:- choices = [Choice(browser, browser.capitalize()) for browser in BROWSERS]+ """Asks the user to select browser(s) for cookie extraction."""+ unsupported_browsers = {+ "Windows": {"safari"},+ "Linux": {"safari", "edge"},+ "Darwin": {"edge"},+ }.get(system(), set())+ choices = [Choice(browser, browser.capitalize()) for browser in BROWSERS if browser not in unsupported_browsers]return basic_prompts.ask_checkbox(choices, message="Select the browser(s) for extraction:")