clean tuple

This commit is contained in:
Roy Olav Purser 2021-11-19 12:31:33 +01:00
parent 2077673849
commit 42f24ba169
Signed by: roypur
GPG Key ID: E14D26A036F21656

View File

@ -45,8 +45,15 @@ class ProxyElem():
def __repr__(self): def __repr__(self):
return str(self.proxy) return str(self.proxy)
async def proxy_url(self, urls): async def proxy_url(self, urls):
clean_urls = []
for url in urls:
if isinstance(url, tuple):
clean_urls.append(url[0])
else:
clean_urls.append(url)
if not isinstance(proxy_server, str): if not isinstance(proxy_server, str):
return urls return clean_urls
jdata = None jdata = None
data_list = [] data_list = []
for url in urls: for url in urls:
@ -73,14 +80,14 @@ class ProxyElem():
logger.info(e) logger.info(e)
if isinstance(jdata, list): if isinstance(jdata, list):
ret_data = [] ret_data = []
for src, dst in zip(urls, jdata): for src, dst in zip(clean_urls, jdata):
if isinstance(src, str): if isinstance(src, str):
ret_data.append(dst) ret_data.append(dst)
else: else:
ret_data.append(None) ret_data.append(None)
return ret_data return ret_data
else: else:
return urls return clean_urls
proxies = {} proxies = {}
new_providers = {} new_providers = {}