From 1295d1f429417cb34056657fe338e2be52715f66 Mon Sep 17 00:00:00 2001 From: girst Date: Thu, 5 Aug 2021 18:25:15 +0200 Subject: [PATCH] handle geolocked videos not available in the server's region example video: cjPWJycHImg --- app/youtube/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/youtube/__init__.py b/app/youtube/__init__.py index 52d8e28..1c7ae31 100644 --- a/app/youtube/__init__.py +++ b/app/youtube/__init__.py @@ -90,8 +90,9 @@ def watch(): 'player': errdetails, }.get(error) - # if the video is geolocked, and the proxy is enabled, we can still play it: - if error == 'geolocked' and 'proxy' in current_app.blueprints.keys(): + # if the video is geolocked, and the proxy is enabled, we can still play + # it, if the video is available in the instance server's region: + if error == 'geolocked' and video_url and 'proxy' in current_app.blueprints.keys(): videoplayback = url_for('proxy.videoplayback') query = urlparse(video_url).query video_url = f"{videoplayback}?{query}" -- 2.39.3