mirror of
				https://github.com/yt-dlp/yt-dlp.git
				synced 2025-10-31 06:35:12 +00:00 
			
		
		
		
	| @@ -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.contextmanager | ||||
|     def 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 f | ||||
|         else: | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 pukkandan
					pukkandan