[cookies] Support custom Safari cookies path (#6783)

Authored by: NextFire
This commit is contained in:
Nam Vu 2023-05-29 15:05:51 +09:00 committed by GitHub
parent 4afb208cf0
commit a58182b75a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -495,11 +495,15 @@ def decrypt(self, encrypted_value):
def _extract_safari_cookies(profile, logger):
if profile is not None:
logger.error('safari does not support profiles')
if sys.platform != 'darwin':
raise ValueError(f'unsupported platform: {sys.platform}')
if profile:
cookies_path = os.path.expanduser(profile)
if not os.path.isfile(cookies_path):
raise FileNotFoundError('custom safari cookies database not found')
else:
cookies_path = os.path.expanduser('~/Library/Cookies/Cookies.binarycookies')
if not os.path.isfile(cookies_path):