aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Taylor <user234683@users.noreply.github.com>2020-02-18 22:17:50 -0800
committerJames Taylor <user234683@users.noreply.github.com>2020-02-18 22:17:50 -0800
commit0989d55db1520330a0f0cea21359520a8cc7ef18 (patch)
tree9573f87517ed539a1e40f8418f5df07683317b10
parent3beb2809ae8dc2c3aa0a328a10b9f012a4f1ebed (diff)
downloadyt-local-0989d55db1520330a0f0cea21359520a8cc7ef18.tar.lz
yt-local-0989d55db1520330a0f0cea21359520a8cc7ef18.tar.xz
yt-local-0989d55db1520330a0f0cea21359520a8cc7ef18.zip
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.
-rw-r--r--youtube/util.py3
1 files changed, 2 insertions, 1 deletions
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