A feature-rich command-line audio/video downloader
Fix bug in ae1035646a6be09c2aed3e22eb8910f341ddacfe
pukkandan941e881e1fe2
diff --git a/yt_dlp/YoutubeDL.py b/yt_dlp/YoutubeDL.pyindex 95fa5fb19a..83b5100eef 100644--- a/yt_dlp/YoutubeDL.py+++ b/yt_dlp/YoutubeDL.py@@ -108,6 +108,7 @@ from .utils import (get_domain,int_or_none,iri_to_uri,+ is_path_like,join_nonempty,locked_file,make_archive_id,@@ -725,7 +726,7 @@ class YoutubeDL:archive = set()if fn is None:return archive- elif not isinstance(fn, os.PathLike):+ elif not is_path_like(fn):return fnself.write_debug(f'Loading archive file {fn!r}')diff --git a/yt_dlp/utils.py b/yt_dlp/utils.pyindex 06699341c9..a036e2233b 100644--- a/yt_dlp/utils.py+++ b/yt_dlp/utils.py@@ -1497,6 +1497,10 @@ class YoutubeDLHTTPSHandler(urllib.request.HTTPSHandler):raise+def is_path_like(f):+ return isinstance(f, (str, bytes, os.PathLike))++class YoutubeDLCookieJar(http.cookiejar.MozillaCookieJar):"""See [1] for cookie file format.@@ -1515,7 +1519,7 @@ class YoutubeDLCookieJar(http.cookiejar.MozillaCookieJar):def __init__(self, filename=None, *args, **kwargs):super().__init__(None, *args, **kwargs)- if self.is_path(filename):+ if is_path_like(filename):filename = os.fspath(filename)self.filename = filename@@ -1523,13 +1527,9 @@ class YoutubeDLCookieJar(http.cookiejar.MozillaCookieJar):def _true_or_false(cndn):return 'TRUE' if cndn else 'FALSE'- @staticmethod- def is_path(file):- return isinstance(file, (str, bytes, os.PathLike))-@contextlib.contextmanagerdef open(self, file, *, write=False):- if self.is_path(file):+ if is_path_like(file):with open(file, 'w' if write else 'r', encoding='utf-8') as f:yield felse: