A feature-rich command-line audio/video downloader
Improve 5736d79172c47ff84740d5720467370a560febad
pukkandan2b24afa6d7f0
diff --git a/yt_dlp/__init__.py b/yt_dlp/__init__.pyindex cab2dd62f9..29c467b0e8 100644--- a/yt_dlp/__init__.py+++ b/yt_dlp/__init__.py@@ -411,6 +411,9 @@ def validate_options(opts):if opts.download_archive is not None:opts.download_archive = expand_path(opts.download_archive)+ if opts.ffmpeg_location is not None:+ opts.ffmpeg_location = expand_path(opts.ffmpeg_location)+if opts.user_agent is not None:opts.headers.setdefault('User-Agent', opts.user_agent)if opts.referer is not None:@@ -920,7 +923,6 @@ def _real_main(argv=None):# We may need ffmpeg_location without having access to the YoutubeDL instance# See https://github.com/yt-dlp/yt-dlp/issues/2191if opts.ffmpeg_location:- opts.ffmpeg_location = expand_path(opts.ffmpeg_location)FFmpegPostProcessor._ffmpeg_location.set(opts.ffmpeg_location)with YoutubeDL(ydl_opts) as ydl:diff --git a/yt_dlp/cookies.py b/yt_dlp/cookies.pyindex d502e91da6..24a8250dab 100644--- a/yt_dlp/cookies.py+++ b/yt_dlp/cookies.py@@ -988,8 +988,8 @@ def _parse_browser_specification(browser_name, profile=None, keyring=None, contaraise ValueError(f'unsupported browser: "{browser_name}"')if keyring not in (None, *SUPPORTED_KEYRINGS):raise ValueError(f'unsupported keyring: "{keyring}"')- if profile is not None and _is_path(profile):- profile = os.path.expanduser(profile)+ if profile is not None and _is_path(expand_path(profile)):+ profile = expand_path(profile)return browser_name, profile, keyring, containerdiff --git a/yt_dlp/utils.py b/yt_dlp/utils.pyindex 25910ed6c7..a24ca828e0 100644--- a/yt_dlp/utils.py+++ b/yt_dlp/utils.py@@ -762,7 +762,7 @@ def sanitized_Request(url, *args, **kwargs):def expand_path(s):- """Expand shell variables and ~"""+ """Expand $ shell variables and ~"""return os.path.expandvars(compat_expanduser(s))