mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-27 06:10:12 +01:00
[YoutubeDL] Add new --call-home option for debugging
This commit is contained in:
parent
149f05c7b6
commit
58b1f00d19
|
@ -58,6 +58,7 @@
|
||||||
takewhile_inclusive,
|
takewhile_inclusive,
|
||||||
UnavailableVideoError,
|
UnavailableVideoError,
|
||||||
url_basename,
|
url_basename,
|
||||||
|
version_tuple,
|
||||||
write_json_file,
|
write_json_file,
|
||||||
write_string,
|
write_string,
|
||||||
YoutubeDLHandler,
|
YoutubeDLHandler,
|
||||||
|
@ -212,6 +213,8 @@ class YoutubeDL(object):
|
||||||
- "detect_or_warn": check whether we can do anything
|
- "detect_or_warn": check whether we can do anything
|
||||||
about it, warn otherwise
|
about it, warn otherwise
|
||||||
source_address: (Experimental) Client-side IP address to bind to.
|
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
|
The following parameters are not used by YoutubeDL itself, they are used by
|
||||||
|
@ -1464,6 +1467,17 @@ def print_debug_header(self):
|
||||||
proxy_map.update(handler.proxies)
|
proxy_map.update(handler.proxies)
|
||||||
self._write_string('[debug] Proxy map: ' + compat_str(proxy_map) + '\n')
|
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):
|
def _setup_opener(self):
|
||||||
timeout_val = self.params.get('socket_timeout')
|
timeout_val = self.params.get('socket_timeout')
|
||||||
self._socket_timeout = 600 if timeout_val is None else float(timeout_val)
|
self._socket_timeout = 600 if timeout_val is None else float(timeout_val)
|
||||||
|
|
|
@ -328,6 +328,7 @@ def _real_main(argv=None):
|
||||||
'postprocessors': postprocessors,
|
'postprocessors': postprocessors,
|
||||||
'fixup': opts.fixup,
|
'fixup': opts.fixup,
|
||||||
'source_address': opts.source_address,
|
'source_address': opts.source_address,
|
||||||
|
'call_home': opts.call_home,
|
||||||
}
|
}
|
||||||
|
|
||||||
with YoutubeDL(ydl_opts) as ydl:
|
with YoutubeDL(ydl_opts) as ydl:
|
||||||
|
|
|
@ -505,6 +505,10 @@ def _hide_login_info(opts):
|
||||||
'--print-traffic',
|
'--print-traffic',
|
||||||
dest='debug_printtraffic', action='store_true', default=False,
|
dest='debug_printtraffic', action='store_true', default=False,
|
||||||
help='Display sent and read HTTP traffic')
|
help='Display sent and read HTTP traffic')
|
||||||
|
verbosity.add_option(
|
||||||
|
'-C', '--call-home',
|
||||||
|
dest='call_home', action='store_true', default=False,
|
||||||
|
help='Contact the youtube-dl server for debugging. (Experimental)')
|
||||||
|
|
||||||
filesystem = optparse.OptionGroup(parser, 'Filesystem Options')
|
filesystem = optparse.OptionGroup(parser, 'Filesystem Options')
|
||||||
filesystem.add_option(
|
filesystem.add_option(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user