diff --git a/XstreamDL_CLI/extractor.py b/XstreamDL_CLI/extractor.py index b1c2868..34e4b6c 100644 --- a/XstreamDL_CLI/extractor.py +++ b/XstreamDL_CLI/extractor.py @@ -1,4 +1,5 @@ import asyncio +import platform from typing import List from pathlib import Path from aiohttp.connector import TCPConnector @@ -46,6 +47,8 @@ def fetch_metadata(self, uri: str, parent_stream: Stream = None): 从链接/文件/文件夹等加载内容 解析metadata ''' if uri.startswith('http://') or uri.startswith('https://') or uri.startswith('ftp://'): + if platform.system() == 'Windows': + asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) loop = asyncio.get_event_loop() return self.raw2streams('url', *loop.run_until_complete(self.fetch(uri)), parent_stream) if '\\' in uri: diff --git a/XstreamDL_CLI/extractors/hls/ext/xkey.py b/XstreamDL_CLI/extractors/hls/ext/xkey.py index 2a5b1e6..19596b2 100644 --- a/XstreamDL_CLI/extractors/hls/ext/xkey.py +++ b/XstreamDL_CLI/extractors/hls/ext/xkey.py @@ -1,5 +1,5 @@ - import asyncio +import platform from aiohttp_socks import ProxyConnector from aiohttp import ClientSession, ClientResponse from aiohttp.connector import TCPConnector @@ -105,6 +105,8 @@ def load(self, args: CmdArgs, custom_xkey: 'XKey'): return True if self.uri.startswith('http://') or self.uri.startswith('https://'): logger.info(f'key uri => {self.uri}') + if platform.system() == 'Windows': + asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) loop = asyncio.get_event_loop() self.key = loop.run_until_complete(self.fetch(self.uri, args)) elif self.uri.startswith('ftp://'):