load cookie only domain match

This commit is contained in:
4ft35t 2022-08-18 18:14:56 +08:00
parent 4119a1493e
commit 5b11d77f9f

View File

@ -467,7 +467,8 @@ def get_content(url, headers={}, decoded=True):
# Here we add cookies to the request headers manually # Here we add cookies to the request headers manually
cookie_strings = [] cookie_strings = []
for cookie in list(cookies): for cookie in list(cookies):
cookie_strings.append(cookie.name + '=' + cookie.value) if cookie.domain in url and cookie.path in url:
cookie_strings.append(cookie.name + '=' + cookie.value)
cookie_headers = {'Cookie': '; '.join(cookie_strings)} cookie_headers = {'Cookie': '; '.join(cookie_strings)}
req.headers.update(cookie_headers) req.headers.update(cookie_headers)