From aa199cdf57671efc99bb77e54990764b8bb052c0 Mon Sep 17 00:00:00 2001 From: James Taylor Date: Fri, 25 Sep 2020 13:47:13 -0700 Subject: Use tor video routing instead of invidious for 403s Using invidious isn't always successful, whereas Tor video routing appears to be near 100% successful. --- server.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'server.py') diff --git a/server.py b/server.py index 6fb61de..acce420 100644 --- a/server.py +++ b/server.py @@ -44,12 +44,12 @@ def proxy_site(env, start_response, video=False): if env['QUERY_STRING']: url += '?' + env['QUERY_STRING'] - if video and settings.route_tor == 1: - response, cleanup_func = util.fetch_url_response(url, headers, - use_tor=False, - max_redirects=10) - elif video: + if video: + params = urllib.parse.parse_qs(env['QUERY_STRING']) + params_use_tor = int(params.get('use_tor', '0')[0]) + use_tor = (settings.route_tor == 2) or params_use_tor response, cleanup_func = util.fetch_url_response(url, headers, + use_tor=use_tor, max_redirects=10) else: response, cleanup_func = util.fetch_url_response(url, headers) -- cgit v1.2.3