check for empty proxy
This commit is contained in:
		
							
								
								
									
										14
									
								
								stream.py
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								stream.py
									
									
									
									
									
								
							@@ -200,6 +200,7 @@ class MainHandler(tornado.web.RequestHandler):
 | 
			
		||||
                    streams = proxy.stream.streams(src)
 | 
			
		||||
                    for key in reversed(streams):
 | 
			
		||||
                        stream = streams.get(key)
 | 
			
		||||
                        print(stream)
 | 
			
		||||
                        if hasattr(stream, "url"):
 | 
			
		||||
                            upstream = stream.url
 | 
			
		||||
                            break
 | 
			
		||||
@@ -220,11 +221,14 @@ class MainHandler(tornado.web.RequestHandler):
 | 
			
		||||
                ldata["proxy"] = proxy.proxy
 | 
			
		||||
                ldata["proxied"] = isinstance(proxy.proxy, str)
 | 
			
		||||
                links = [ldata]
 | 
			
		||||
                resp = requests.post(proxy_server, json=links)
 | 
			
		||||
                if isinstance(resp.text, str):
 | 
			
		||||
                    new_links = json.loads(resp.text)
 | 
			
		||||
                    if isinstance(new_links, list) and len(new_links) == 1:
 | 
			
		||||
                        upstream = new_links.pop()
 | 
			
		||||
                try:
 | 
			
		||||
                    resp = requests.post(proxy_server, json=links)
 | 
			
		||||
                    if isinstance(resp.text, str):
 | 
			
		||||
                        new_links = json.loads(resp.text)
 | 
			
		||||
                        if isinstance(new_links, list) and len(new_links) == 1:
 | 
			
		||||
                            upstream = new_links.pop()
 | 
			
		||||
                except Exception as e:
 | 
			
		||||
                    print(e)
 | 
			
		||||
            if data is None:
 | 
			
		||||
                self.redirect(upstream, status=303)
 | 
			
		||||
            else:
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user