fix proxy url

This commit is contained in:
Roy Olav Purser 2021-05-29 11:03:46 +02:00
parent 0505fee331
commit 6463dd8cda
Signed by: roypur
GPG Key ID: E14D26A036F21656

View File

@ -81,7 +81,7 @@ class StreamProvider():
self.logger = logger self.logger = logger
proxy = str(proxy) proxy = str(proxy)
if len(proxy) > 5: if len(proxy) > 5:
self.proxy = "socks5://" + proxy self.proxy = proxy
async def run(self): async def run(self):
data = None data = None
try: try:
@ -120,7 +120,7 @@ class YoutubeRunner(StreamProvider):
opts = {} opts = {}
opts["logger"] = DummyLogger() opts["logger"] = DummyLogger()
if isinstance(self.proxy, str): if isinstance(self.proxy, str):
opts["proxy"] = self.proxy opts["proxy"] = f'socks5://{self.proxy}'
with youtube_dl.YoutubeDL(opts) as ydl: with youtube_dl.YoutubeDL(opts) as ydl:
info = ydl.extract_info(self.upstream, download=False) info = ydl.extract_info(self.upstream, download=False)
vformats = info.get("formats") vformats = info.get("formats")