diff options
author | James Taylor <user234683@users.noreply.github.com> | 2020-09-25 13:47:13 -0700 |
---|---|---|
committer | James Taylor <user234683@users.noreply.github.com> | 2020-09-25 13:47:13 -0700 |
commit | aa199cdf57671efc99bb77e54990764b8bb052c0 (patch) | |
tree | 4145270034874cd56621d889f350e643de00bbba /server.py | |
parent | cf08f96de9d5470a72b97ee169641e25cfabc0e6 (diff) | |
download | yt-local-aa199cdf57671efc99bb77e54990764b8bb052c0.tar.lz yt-local-aa199cdf57671efc99bb77e54990764b8bb052c0.tar.xz yt-local-aa199cdf57671efc99bb77e54990764b8bb052c0.zip |
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.
Diffstat (limited to 'server.py')
-rw-r--r-- | server.py | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -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) |