Bulk asynchronous downloader for multiple file hosts
Python asynciobunkrcyberdropdownloaderdropboxfilestergofilegoogle-drivemediafiremegamega-nzonedrivepatreonpawchivepinterestpixeldraintransfer-ittwitchtwittervk
refactor: simplify
NTFSvolume3ca4250eae9c
diff --git a/cyberdrop_dl/managers/client_manager.py b/cyberdrop_dl/managers/client_manager.pyindex a7e801dd0..bb0ec5ee7 100644--- a/cyberdrop_dl/managers/client_manager.py+++ b/cyberdrop_dl/managers/client_manager.py@@ -3,8 +3,8 @@ from __future__ import annotationsimport asyncioimport contextlibimport ssl+import timefrom dataclasses import dataclass-from datetime import UTC, datetimefrom http import HTTPStatusfrom http.cookiejar import MozillaCookieJarfrom typing import TYPE_CHECKING, Any@@ -110,7 +110,7 @@ class ClientManager:if not cookie_files:return- now = datetime.now(UTC)+ now = time.time()domains_seen = set()for file in cookie_files:cookie_jar = MozillaCookieJar(file)@@ -120,7 +120,7 @@ class ClientManager:log(f"Unable to load cookies from '{file.name}':\n {e!s}", 40)continuecurrent_cookie_file_domains: set[str] = set()- expire_dates: set[datetime] = set()+ expired_cookies_domains: set[str] = set()for cookie in cookie_jar:simplified_domain = cookie.domain.removeprefix(".")if simplified_domain not in current_cookie_file_domains:@@ -129,13 +129,13 @@ class ClientManager:if simplified_domain in domains_seen:log(f"Previous cookies for domain {simplified_domain} detected. They will be overwritten", 30)- if cookie.expires:- expire_dates.add(datetime.fromtimestamp(cookie.expires))+ if (simplified_domain not in expired_cookies_domains) and cookie.is_expired(now): # type: ignore+ expired_cookies_domains.add(simplified_domain)domains_seen.add(simplified_domain)self.cookies.update_cookies({cookie.name: cookie.value}, response_url=URL(f"https://{cookie.domain}")) # type: ignore- if expire_dates and any(date < now for date in expire_dates):+ for simplified_domain in expired_cookies_domains:log(f"Cookies for {simplified_domain} are expired", 30)log_spacer(20, log_to_console=False)