diff options
author | Simon Sawicki <contact@grub4k.xyz> | 2024-03-10 16:14:53 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-10 20:44:53 +0530 |
commit | dbd8b1bff9afd8f05f982bcd52c20bc173c266ca (patch) | |
tree | 8bdb0e37d89c17c135fbddf5c72d73ab74a39f66 | |
parent | 8993721ecb34867b52b79f6e92b233008d1cbe78 (diff) |
Improve 069b2aedae2279668b6051627a81fc4fbd9c146a
Authored by: Grub4k
-rw-r--r-- | yt_dlp/YoutubeDL.py | 5 | ||||
-rw-r--r-- | yt_dlp/networking/common.py | 2 |
2 files changed, 4 insertions, 3 deletions
diff --git a/yt_dlp/YoutubeDL.py b/yt_dlp/YoutubeDL.py index 2a0fabfd7..08d608a52 100644 --- a/yt_dlp/YoutubeDL.py +++ b/yt_dlp/YoutubeDL.py @@ -962,8 +962,9 @@ class YoutubeDL: def close(self): self.save_cookies() - self._request_director.close() - del self._request_director + if '_request_director' in self.__dict__: + self._request_director.close() + del self._request_director def trouble(self, message=None, tb=None, is_error=True): """Determine action to take when a download problem appears. diff --git a/yt_dlp/networking/common.py b/yt_dlp/networking/common.py index 7da2652ae..e43d74ead 100644 --- a/yt_dlp/networking/common.py +++ b/yt_dlp/networking/common.py @@ -68,7 +68,7 @@ class RequestDirector: def close(self): for handler in self.handlers.values(): handler.close() - self.handlers = {} + self.handlers.clear() def add_handler(self, handler: RequestHandler): """Add a handler. If a handler of the same RH_KEY exists, it will overwrite it""" |