From 6bcd9ad0eeade81dfe6b7681d763db4cb198b294 Mon Sep 17 00:00:00 2001 From: girst Date: Fri, 13 Aug 2021 19:27:47 +0200 Subject: [PATCH] handle the case when we can't connect to googlevideo note: we should also verify the ?mn param's contents --- app/proxy/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/proxy/__init__.py b/app/proxy/__init__.py index ccfacdd..78d6d19 100644 --- a/app/proxy/__init__.py +++ b/app/proxy/__init__.py @@ -51,10 +51,13 @@ def videoplayback(path=None): if k.lower() in REQUEST_HEADERS_WHITELIST } with requests_cache.disabled(): + try: r = requests.get(f"https://{host}/videoplayback{path}", request.args.to_dict(), headers=req_headers, stream=True) + except requests.exceptions.ConnectionError: + return f"unable to connect to {host}", 502 resp_headers = { k:v for k,v in r.headers.items() -- 2.39.3