From 0989d55db1520330a0f0cea21359520a8cc7ef18 Mon Sep 17 00:00:00 2001 From: James Taylor Date: Tue, 18 Feb 2020 22:17:50 -0800 Subject: Ensure urllib3 and python version not leaked during video file check This is likely not a big deal since it is already assumed that video file server logs are not plugged into Google's tracking infrastructure, but it doesn't hurt to give less info. --- youtube/util.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'youtube') diff --git a/youtube/util.py b/youtube/util.py index c7168a8..a70bd7e 100644 --- a/youtube/util.py +++ b/youtube/util.py @@ -206,7 +206,8 @@ def head(url, use_tor=False, report_text=None, max_redirects=10): # to 10 since googlevideo redirects a lot. retries = urllib3.Retry(3+max_redirects, redirect=max_redirects, raise_on_redirect=False) - response = pool.request('HEAD', url, retries=retries) + headers = {'User-Agent': 'Python-urllib'} + response = pool.request('HEAD', url, headers=headers, retries=retries) if report_text: print(report_text, ' Latency:', round(time.time() - start_time,3)) return response -- cgit v1.2.3