diff options
author | Lesmiscore (Naoya Ozaki) <nao20010128@gmail.com> | 2022-02-25 11:16:23 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-25 11:16:23 +0900 |
commit | 15dfb3929c3eaca897c85dc1ad792df3fbf5ebc7 (patch) | |
tree | 135688fa245f603a89a6a421c3dd0cb1d6318811 /yt_dlp/utils.py | |
parent | 3e9b66d761048d568ed0da40e43d02e1bf02f759 (diff) | |
download | hypervideo-pre-15dfb3929c3eaca897c85dc1ad792df3fbf5ebc7.tar.lz hypervideo-pre-15dfb3929c3eaca897c85dc1ad792df3fbf5ebc7.tar.xz hypervideo-pre-15dfb3929c3eaca897c85dc1ad792df3fbf5ebc7.zip |
[fc2:live] Add extractor (#2418)
Authored by: Lesmiscore
Diffstat (limited to 'yt_dlp/utils.py')
-rw-r--r-- | yt_dlp/utils.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/yt_dlp/utils.py b/yt_dlp/utils.py index 012a115ba..6ec8da11b 100644 --- a/yt_dlp/utils.py +++ b/yt_dlp/utils.py @@ -4,6 +4,7 @@ from __future__ import unicode_literals import asyncio +import atexit import base64 import binascii import calendar @@ -5348,6 +5349,7 @@ class WebSocketsWrapper(): self.conn = compat_websockets.connect( url, extra_headers=headers, ping_interval=None, close_timeout=float('inf'), loop=self.loop, ping_timeout=float('inf')) + atexit.register(self.__exit__, None, None, None) def __enter__(self): self.pool = self.run_with_loop(self.conn.__aenter__(), self.loop) @@ -5364,7 +5366,7 @@ class WebSocketsWrapper(): return self.run_with_loop(self.conn.__aexit__(type, value, traceback), self.loop) finally: self.loop.close() - self.r_cancel_all_tasks(self.loop) + self._cancel_all_tasks(self.loop) # taken from https://github.com/python/cpython/blob/3.9/Lib/asyncio/runners.py with modifications # for contributors: If there's any new library using asyncio needs to be run in non-async, move these function out of this class |