fix streamlink

This commit is contained in:
Roy Olav Purser 2023-07-23 12:27:36 +02:00
parent 4593cf84c5
commit a1ac365fad
Signed by: roypur
GPG Key ID: 90142918D5E59AD3

View File

@ -203,6 +203,8 @@ class StreamProvider:
class StreamlinkRunner(StreamProvider): class StreamlinkRunner(StreamProvider):
def stream(self): def stream(self):
if "youtube.com" in urllib.parse.urlparse(self.upstream).hostname.lower():
return StreamData(None, None, None, None, None, None, False)
try: try:
session = None session = None
if self.proxy is None or self.proxy.proxy is None: if self.proxy is None or self.proxy.proxy is None:
@ -212,7 +214,7 @@ class StreamlinkRunner(StreamProvider):
media = session.resolve_url(self.upstream) media = session.resolve_url(self.upstream)
streams = None streams = None
if isinstance(media, tuple): if isinstance(media, tuple):
plugin = media[0](media[1]) plugin = media[1](session=session, url=media[2])
streams = plugin.streams() streams = plugin.streams()
else: else:
streams = media.streams() streams = media.streams()
@ -393,7 +395,7 @@ async def get_any(upstream, proxy, logger):
if isinstance(cached, StreamData): if isinstance(cached, StreamData):
return cached return cached
tasks = [] tasks = []
if not "youtube" in upstream.lower():
tasks.append(asyncio.create_task(get_streamlink(upstream, proxy, logger))) tasks.append(asyncio.create_task(get_streamlink(upstream, proxy, logger)))
tasks.append(asyncio.create_task(get_ytdl(upstream, proxy, logger))) tasks.append(asyncio.create_task(get_ytdl(upstream, proxy, logger)))
tasks.append(asyncio.create_task(get_meta(upstream, proxy, logger))) tasks.append(asyncio.create_task(get_meta(upstream, proxy, logger)))