diff options
| author | 2022-02-14 17:17:07 -0500 | |
|---|---|---|
| committer | 2022-02-14 17:17:07 -0500 | |
| commit | 7900ee4e3692dbd8056c3e47c81bb22eda030b65 (patch) | |
| tree | 54d10ca35e4b8538d2c61470490642b660e2ae77 /gallery_dl/extractor/common.py | |
| parent | 99bc014c924c755f10a4a930b1a83efabd84fde1 (diff) | |
New upstream version 1.20.5.upstream/1.20.5
Diffstat (limited to 'gallery_dl/extractor/common.py')
| -rw-r--r-- | gallery_dl/extractor/common.py | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/gallery_dl/extractor/common.py b/gallery_dl/extractor/common.py index 1d81dfc..5a2d3a3 100644 --- a/gallery_dl/extractor/common.py +++ b/gallery_dl/extractor/common.py @@ -371,8 +371,16 @@ class Extractor(): for cookie in self._cookiejar: if cookie.name in names and ( not domain or cookie.domain == domain): - if cookie.expires and cookie.expires < now: - self.log.warning("Cookie '%s' has expired", cookie.name) + if cookie.expires: + diff = int(cookie.expires - now) + if diff <= 0: + self.log.warning( + "Cookie '%s' has expired", cookie.name) + elif diff <= 86400: + hours = diff // 3600 + self.log.warning( + "Cookie '%s' will expire in less than %s hour%s", + cookie.name, hours + 1, "s" if hours else "") else: names.discard(cookie.name) if not names: @@ -607,6 +615,9 @@ class BaseExtractor(Extractor): if group is not None: if index: self.category, self.root = self.instances[index-1] + if not self.root: + url = text.ensure_http_scheme(match.group(0)) + self.root = url[:url.index("/", 8)] else: self.root = group self.category = group.partition("://")[2] @@ -624,7 +635,9 @@ class BaseExtractor(Extractor): pattern_list = [] instance_list = cls.instances = [] for category, info in instances.items(): - root = info["root"].rstrip("/") + root = info["root"] + if root: + root = root.rstrip("/") instance_list.append((category, root)) pattern = info.get("pattern") |
