mirror of
https://github.com/mikf/gallery-dl.git
synced 2025-02-01 03:51:42 +01:00
improve _check_cookies()
Only loop over all cookies once instead of calling cookiejar._find() for each cookie name.
This commit is contained in:
parent
76e60d10a6
commit
a4dd8b3dab
@ -229,12 +229,14 @@ class Extractor():
|
||||
"""Check if all 'cookienames' are in the session's cookiejar"""
|
||||
if domain is None:
|
||||
domain = self.cookiedomain
|
||||
try:
|
||||
for name in cookienames:
|
||||
self._cookiejar._find(name, domain)
|
||||
except KeyError:
|
||||
return False
|
||||
return True
|
||||
|
||||
names = set(cookienames)
|
||||
for cookie in self._cookiejar:
|
||||
if cookie.domain == domain:
|
||||
names.discard(cookie.name)
|
||||
if not names:
|
||||
return True
|
||||
return False
|
||||
|
||||
def _get_date_min_max(self, dmin=None, dmax=None):
|
||||
"""Retrieve and parse 'date-min' and 'date-max' config values"""
|
||||
|
Loading…
x
Reference in New Issue
Block a user