summary refs log tree commit diff
diff options
context:
space:
mode:
authorSergey M <dstftw@gmail.com>2015-11-15 11:13:22 +0000
committerSergey M <dstftw@gmail.com>2015-11-15 11:13:22 +0000
commitb328295910c2d69822819450617cff2a1cf53106 (patch)
treef8f2007509d7ad796f0b39cf25f75886adbd51e4
parent2ff7cbeaaabbc8d67caa224a5cef1fbd32761918 (diff)
parent828b2a5cd971ae04469aeb7b11dfeaab7962c4d9 (diff)
downloadyoutube-dl-b328295910c2d69822819450617cff2a1cf53106.tar.gz
youtube-dl-b328295910c2d69822819450617cff2a1cf53106.tar.xz
youtube-dl-b328295910c2d69822819450617cff2a1cf53106.zip
Merge pull request #7436 from davidbz/add_proxy_to_update_procedure
Add proxy support for update_self
-rw-r--r--youtube_dl/__init__.py2
-rw-r--r--youtube_dl/update.py12
2 files changed, 4 insertions, 10 deletions
diff --git a/youtube_dl/__init__.py b/youtube_dl/__init__.py
index 5e2ed4d4b..9f131f5db 100644
--- a/youtube_dl/__init__.py
+++ b/youtube_dl/__init__.py
@@ -377,7 +377,7 @@ def _real_main(argv=None):
     with YoutubeDL(ydl_opts) as ydl:
         # Update version
         if opts.update_self:
-            update_self(ydl.to_screen, opts.verbose)
+            update_self(ydl.to_screen, opts.verbose, ydl._opener)
 
         # Remove cache dir
         if opts.rm_cachedir:
diff --git a/youtube_dl/update.py b/youtube_dl/update.py
index fc7ac8305..074eb64a7 100644
--- a/youtube_dl/update.py
+++ b/youtube_dl/update.py
@@ -9,11 +9,8 @@ import subprocess
 import sys
 from zipimport import zipimporter
 
-from .compat import (
-    compat_str,
-    compat_urllib_request,
-)
-from .utils import make_HTTPS_handler
+from .compat import compat_str
+
 from .version import __version__
 
 
@@ -47,7 +44,7 @@ def rsa_verify(message, signature, key):
     return True
 
 
-def update_self(to_screen, verbose):
+def update_self(to_screen, verbose, opener):
     """Update the program file with the latest version from the repository"""
 
     UPDATE_URL = "https://rg3.github.io/youtube-dl/update/"
@@ -59,9 +56,6 @@ def update_self(to_screen, verbose):
         to_screen('It looks like you installed youtube-dl with a package manager, pip, setup.py or a tarball. Please use that to update.')
         return
 
-    https_handler = make_HTTPS_handler({})
-    opener = compat_urllib_request.build_opener(https_handler)
-
     # Check if there is a new version
     try:
         newversion = opener.open(VERSION_URL).read().decode('utf-8').strip()