aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/YoutubeDL.py
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2013-12-29 15:28:32 +0100
committerPhilipp Hagemeister <phihag@phihag.de>2013-12-29 15:28:32 +0100
commita0ddb8a2faaacdcf7b3a089ca9baeee5f310d03c (patch)
treecb38eb8288d3e2fa9e73c2e58eaf026a53c13d0c /youtube_dl/YoutubeDL.py
parentc1d1facd06690bbffc7637be4ace62261b5b2552 (diff)
Add new --print-traffic option
Diffstat (limited to 'youtube_dl/YoutubeDL.py')
-rw-r--r--youtube_dl/YoutubeDL.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py
index a9a3639d7..8ebbfe78f 100644
--- a/youtube_dl/YoutubeDL.py
+++ b/youtube_dl/YoutubeDL.py
@@ -148,6 +148,7 @@ class YoutubeDL(object):
socket_timeout: Time to wait for unresponsive hosts, in seconds
bidi_workaround: Work around buggy terminals without bidirectional text
support, using fridibi
+ debug_printtraffic:Print out sent and received HTTP traffic
The following parameters are not used by YoutubeDL itself, they are used by
the FileDownloader:
@@ -1124,10 +1125,13 @@ class YoutubeDL(object):
if 'http' in proxies and 'https' not in proxies:
proxies['https'] = proxies['http']
proxy_handler = compat_urllib_request.ProxyHandler(proxies)
+
+ debuglevel = 1 if self.params.get('debug_printtraffic') else 0
https_handler = make_HTTPS_handler(
- self.params.get('nocheckcertificate', False))
+ self.params.get('nocheckcertificate', False), debuglevel=debuglevel)
+ ydlh = YoutubeDLHandler(debuglevel=debuglevel)
opener = compat_urllib_request.build_opener(
- https_handler, proxy_handler, cookie_processor, YoutubeDLHandler())
+ https_handler, proxy_handler, cookie_processor, ydlh)
# Delete the default user-agent header, which would otherwise apply in
# cases where our custom HTTP handler doesn't come into play
# (See https://github.com/rg3/youtube-dl/issues/1309 for details)