aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp/compat.py
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2021-06-21 22:53:17 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2021-06-21 22:56:36 +0530
commite36d50c5dd35973c090f87df05d4e94963e8036c (patch)
treebe74700890c89fde704fd725ff5c43816e0ee3e3 /yt_dlp/compat.py
parentff0f78e1fef082b7702f3ce783381d3609415649 (diff)
downloadhypervideo-pre-e36d50c5dd35973c090f87df05d4e94963e8036c.tar.lz
hypervideo-pre-e36d50c5dd35973c090f87df05d4e94963e8036c.tar.xz
hypervideo-pre-e36d50c5dd35973c090f87df05d4e94963e8036c.zip
[websockets] Add `WebSocketFragmentFD` (#399)
Necessary for #392 Co-authored by: nao20010128nao, pukkandan
Diffstat (limited to 'yt_dlp/compat.py')
-rw-r--r--yt_dlp/compat.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/yt_dlp/compat.py b/yt_dlp/compat.py
index 863bd2287..cffaa74a6 100644
--- a/yt_dlp/compat.py
+++ b/yt_dlp/compat.py
@@ -3030,6 +3030,21 @@ except AttributeError:
compat_Match = type(re.compile('').match(''))
+import asyncio
+try:
+ compat_asyncio_run = asyncio.run
+except AttributeError:
+ def compat_asyncio_run(coro):
+ try:
+ loop = asyncio.get_event_loop()
+ except RuntimeError:
+ loop = asyncio.new_event_loop()
+ asyncio.set_event_loop(loop)
+ loop.run_until_complete(coro)
+
+ asyncio.run = compat_asyncio_run
+
+
__all__ = [
'compat_HTMLParseError',
'compat_HTMLParser',
@@ -3037,6 +3052,7 @@ __all__ = [
'compat_Match',
'compat_Pattern',
'compat_Struct',
+ 'compat_asyncio_run',
'compat_b64decode',
'compat_basestring',
'compat_chr',