From 2d5552158213f546177e1c2a77d0481ce01188b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Wed, 14 Aug 2024 18:34:17 +0200 Subject: [PATCH] [cookies:firefox] extract only cookies without container by default (#5957) add support for 'all' to extract all cookies regardless of container --- docs/options.md | 2 +- gallery_dl/cookies.py | 9 +++++---- gallery_dl/option.py | 3 ++- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/docs/options.md b/docs/options.md index f16fa5b9..7eee73bd 100644 --- a/docs/options.md +++ b/docs/options.md @@ -106,7 +106,7 @@ optional domain prefixed with '/', keyring name prefixed with '+', profile prefixed with ':', and container prefixed with '::' ('none' for no - container) + container (default), 'all' for all containers) ## Selection Options: -A, --abort N Stop current extractor run after N consecutive diff --git a/gallery_dl/cookies.py b/gallery_dl/cookies.py index f0179292..deb7c7b1 100644 --- a/gallery_dl/cookies.py +++ b/gallery_dl/cookies.py @@ -179,11 +179,14 @@ def _firefox_cookies_database(profile=None, container=None): "{}".format(search_root)) _log_debug("Extracting cookies from %s", path) - if container == "none": + if not container or container == "none": container_id = False _log_debug("Only loading cookies not belonging to any container") - elif container: + elif container == "all": + container_id = None + + else: containers_path = os.path.join( os.path.dirname(path), "containers.json") @@ -207,8 +210,6 @@ def _firefox_cookies_database(profile=None, container=None): container)) _log_debug("Only loading cookies from container '%s' (ID %s)", container, container_id) - else: - container_id = None return path, container_id diff --git a/gallery_dl/option.py b/gallery_dl/option.py index 21aa9ffe..f33ecf5f 100644 --- a/gallery_dl/option.py +++ b/gallery_dl/option.py @@ -526,7 +526,8 @@ def build_parser(): "domain prefixed with '/', " "keyring name prefixed with '+', " "profile prefixed with ':', and " - "container prefixed with '::' ('none' for no container)"), + "container prefixed with '::' " + "('none' for no container (default), 'all' for all containers)"), ) selection = parser.add_argument_group("Selection Options")