Skip to content

Commit

Permalink
server: only send visitor data to specific domains
Browse files Browse the repository at this point in the history
Only send visitor data header to specific google domains.
  • Loading branch information
alive4ever committed Nov 24, 2024
1 parent 418511a commit c7e1cac
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions server.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,12 @@ def proxy_site(env, start_response, video=False):
except OSError:
print('An OS error prevents accessing po_token_cache.txt')

if visitor_data != None:
send_headers['X-Goog-Visitor-Id'] = visitor_data
google_domains = [ 'youtube.com', 'youtube-nocookie.com', 'youtu.be', 'googlevideo.com', 'ytimg.com', 'ggpht.com', 'googleapis.com' ]
for domain in google_domains:
if env['SERVER_NAME'].endswith(domain):
if visitor_data != None:
send_headers['X-Goog-Visitor-Id'] = visitor_data
break

current_range_start = 0
range_end = None
Expand Down

0 comments on commit c7e1cac

Please sign in to comment.