refactor proxy handling code (#2357)
- allow gallery-dl proxy settings to overwrite environment proxies
- allow specifying different proxies for data extraction and download
- add 'downloader.proxy' option
- '-o extractor.proxy=–PROXY_URL -o downloader.proxy=null'
now has the same effect as youtube-dl's '--geo-verification-proxy'
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2014-2020 Mike Fährmann
|
||||
# Copyright 2014-2022 Mike Fährmann
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License version 2 as
|
||||
@@ -27,6 +27,12 @@ class DownloaderBase():
|
||||
self.partdir = util.expand_path(self.partdir)
|
||||
os.makedirs(self.partdir, exist_ok=True)
|
||||
|
||||
proxies = self.config("proxy", util.SENTINEL)
|
||||
if proxies is util.SENTINEL:
|
||||
self.proxies = job.extractor._proxies
|
||||
else:
|
||||
self.proxies = util.build_proxy_map(proxies, self.log)
|
||||
|
||||
def config(self, key, default=None):
|
||||
"""Interpolate downloader config value for 'key'"""
|
||||
return config.interpolate(("downloader", self.scheme), key, default)
|
||||
|
||||
Reference in New Issue
Block a user