mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-14 23:32:33 +00:00
Merge pull request #7436 from davidbz/add_proxy_to_update_procedure
Add proxy support for update_self
This commit is contained in:
commit
b328295910
2 changed files with 4 additions and 10 deletions
|
@ -377,7 +377,7 @@ def _real_main(argv=None):
|
||||||
with YoutubeDL(ydl_opts) as ydl:
|
with YoutubeDL(ydl_opts) as ydl:
|
||||||
# Update version
|
# Update version
|
||||||
if opts.update_self:
|
if opts.update_self:
|
||||||
update_self(ydl.to_screen, opts.verbose)
|
update_self(ydl.to_screen, opts.verbose, ydl._opener)
|
||||||
|
|
||||||
# Remove cache dir
|
# Remove cache dir
|
||||||
if opts.rm_cachedir:
|
if opts.rm_cachedir:
|
||||||
|
|
|
@ -9,11 +9,8 @@ import subprocess
|
||||||
import sys
|
import sys
|
||||||
from zipimport import zipimporter
|
from zipimport import zipimporter
|
||||||
|
|
||||||
from .compat import (
|
from .compat import compat_str
|
||||||
compat_str,
|
|
||||||
compat_urllib_request,
|
|
||||||
)
|
|
||||||
from .utils import make_HTTPS_handler
|
|
||||||
from .version import __version__
|
from .version import __version__
|
||||||
|
|
||||||
|
|
||||||
|
@ -47,7 +44,7 @@ def rsa_verify(message, signature, key):
|
||||||
return True
|
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 the program file with the latest version from the repository"""
|
||||||
|
|
||||||
UPDATE_URL = "https://rg3.github.io/youtube-dl/update/"
|
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.')
|
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
|
return
|
||||||
|
|
||||||
https_handler = make_HTTPS_handler({})
|
|
||||||
opener = compat_urllib_request.build_opener(https_handler)
|
|
||||||
|
|
||||||
# Check if there is a new version
|
# Check if there is a new version
|
||||||
try:
|
try:
|
||||||
newversion = opener.open(VERSION_URL).read().decode('utf-8').strip()
|
newversion = opener.open(VERSION_URL).read().decode('utf-8').strip()
|
||||||
|
|
Loading…
Reference in a new issue