aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Sawicki <contact@grub4k.xyz>2024-01-31 09:56:14 +0100
committerGitHub <noreply@github.com>2024-01-31 09:56:14 +0100
commit2792092afd367e39251ace1fb2819c855ab8919f (patch)
treed1ec25be8e764c33b71c14817938ada3fe2d9eba
parentcbed249aaa053a3f425b9bafc97f8dbd71c44487 (diff)
[cookies] Improve error message for Windows `--cookies-from-browser chrome` issue (#9080)
Authored by: Grub4K
-rw-r--r--yt_dlp/cookies.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/yt_dlp/cookies.py b/yt_dlp/cookies.py
index a92ab4164..deb2e35f2 100644
--- a/yt_dlp/cookies.py
+++ b/yt_dlp/cookies.py
@@ -24,7 +24,8 @@ from .aes import (
aes_gcm_decrypt_and_verify_bytes,
unpad_pkcs7,
)
-from .compat import functools
+from .compat import functools # isort: split
+from .compat import compat_os_name
from .dependencies import (
_SECRETSTORAGE_UNAVAILABLE_REASON,
secretstorage,
@@ -32,6 +33,7 @@ from .dependencies import (
)
from .minicurses import MultilinePrinter, QuietMultilinePrinter
from .utils import (
+ DownloadError,
Popen,
error_to_str,
expand_path,
@@ -318,6 +320,12 @@ def _extract_chrome_cookies(browser_name, profile, keyring, logger):
counts['unencrypted'] = unencrypted_cookies
logger.debug(f'cookie version breakdown: {counts}')
return jar
+ except PermissionError as error:
+ if compat_os_name == 'nt' and error.errno == 13:
+ message = 'Could not copy Chrome cookie database. See https://github.com/yt-dlp/yt-dlp/issues/7271 for more info'
+ logger.error(message)
+ raise DownloadError(message) # force exit
+ raise
finally:
if cursor is not None:
cursor.connection.close()