aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/YoutubeDL.py
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2015-01-10 21:02:27 +0100
committerPhilipp Hagemeister <phihag@phihag.de>2015-01-10 21:02:27 +0100
commit58b1f00d19d608470540b111f3825eefafbdae97 (patch)
treefa05db3215bf6516e350746a3bc446cc4fc5d605 /youtube_dl/YoutubeDL.py
parent149f05c7b6adcb55b96c4ca60abc4e42d98623a7 (diff)
[YoutubeDL] Add new --call-home option for debugging
Diffstat (limited to 'youtube_dl/YoutubeDL.py')
-rwxr-xr-xyoutube_dl/YoutubeDL.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py
index fd2c0e044..84cea472c 100755
--- a/youtube_dl/YoutubeDL.py
+++ b/youtube_dl/YoutubeDL.py
@@ -58,6 +58,7 @@ from .utils import (
takewhile_inclusive,
UnavailableVideoError,
url_basename,
+ version_tuple,
write_json_file,
write_string,
YoutubeDLHandler,
@@ -212,6 +213,8 @@ class YoutubeDL(object):
- "detect_or_warn": check whether we can do anything
about it, warn otherwise
source_address: (Experimental) Client-side IP address to bind to.
+ call_home: (Experimental) Boolean, true iff we are allowed to
+ contact the youtube-dl servers for debugging.
The following parameters are not used by YoutubeDL itself, they are used by
@@ -1464,6 +1467,17 @@ class YoutubeDL(object):
proxy_map.update(handler.proxies)
self._write_string('[debug] Proxy map: ' + compat_str(proxy_map) + '\n')
+ if self.params.get('call_home', False):
+ ipaddr = self.urlopen('https://yt-dl.org/ip').read().decode('utf-8')
+ self._write_string('[debug] Public IP address: %s\n' % ipaddr)
+ latest_version = self.urlopen(
+ 'https://yt-dl.org/latest/version').read().decode('utf-8')
+ if version_tuple(latest_version) > version_tuple(__version__):
+ self.report_warning(
+ 'You are using an outdated version (newest version: %s)! '
+ 'See https://yt-dl.org/update if you need help updating.' %
+ latest_version)
+
def _setup_opener(self):
timeout_val = self.params.get('socket_timeout')
self._socket_timeout = 600 if timeout_val is None else float(timeout_val)