Rename bypass geo restriction options
This commit is contained in:
parent
0016b84e16
commit
0a840f584c
|
@ -274,10 +274,9 @@ class YoutubeDL(object):
|
||||||
If it returns None, the video is downloaded.
|
If it returns None, the video is downloaded.
|
||||||
match_filter_func in utils.py is one example for this.
|
match_filter_func in utils.py is one example for this.
|
||||||
no_color: Do not emit color codes in output.
|
no_color: Do not emit color codes in output.
|
||||||
bypass_geo_restriction:
|
geo_bypass: Bypass geographic restriction via faking X-Forwarded-For
|
||||||
Bypass geographic restriction via faking X-Forwarded-For
|
|
||||||
HTTP header (experimental)
|
HTTP header (experimental)
|
||||||
bypass_geo_restriction_as_country:
|
geo_bypass_country:
|
||||||
Two-letter ISO 3166-2 country code that will be used for
|
Two-letter ISO 3166-2 country code that will be used for
|
||||||
explicit geographic restriction bypassing via faking
|
explicit geographic restriction bypassing via faking
|
||||||
X-Forwarded-For HTTP header (experimental)
|
X-Forwarded-For HTTP header (experimental)
|
||||||
|
|
|
@ -414,8 +414,8 @@ def _real_main(argv=None):
|
||||||
'cn_verification_proxy': opts.cn_verification_proxy,
|
'cn_verification_proxy': opts.cn_verification_proxy,
|
||||||
'geo_verification_proxy': opts.geo_verification_proxy,
|
'geo_verification_proxy': opts.geo_verification_proxy,
|
||||||
'config_location': opts.config_location,
|
'config_location': opts.config_location,
|
||||||
'bypass_geo_restriction': opts.bypass_geo_restriction,
|
'geo_bypass': opts.geo_bypass,
|
||||||
'bypass_geo_restriction_as_country': opts.bypass_geo_restriction_as_country,
|
'geo_bypass_country': opts.geo_bypass_country,
|
||||||
}
|
}
|
||||||
|
|
||||||
with YoutubeDL(ydl_opts) as ydl:
|
with YoutubeDL(ydl_opts) as ydl:
|
||||||
|
|
|
@ -326,7 +326,7 @@ class InfoExtractor(object):
|
||||||
_BYPASS_GEO attribute may be set to False in order to disable
|
_BYPASS_GEO attribute may be set to False in order to disable
|
||||||
geo restriction bypass mechanisms for a particular extractor.
|
geo restriction bypass mechanisms for a particular extractor.
|
||||||
Though it won't disable explicit geo restriction bypass based on
|
Though it won't disable explicit geo restriction bypass based on
|
||||||
country code provided with bypass_geo_restriction_as_country.
|
country code provided with geo_bypass_country.
|
||||||
|
|
||||||
Finally, the _WORKING attribute should be set to False for broken IEs
|
Finally, the _WORKING attribute should be set to False for broken IEs
|
||||||
in order to warn the users and skip the tests.
|
in order to warn the users and skip the tests.
|
||||||
|
@ -371,7 +371,7 @@ class InfoExtractor(object):
|
||||||
def initialize(self):
|
def initialize(self):
|
||||||
"""Initializes an instance (authentication, etc)."""
|
"""Initializes an instance (authentication, etc)."""
|
||||||
if not self._x_forwarded_for_ip:
|
if not self._x_forwarded_for_ip:
|
||||||
country_code = self._downloader.params.get('bypass_geo_restriction_as_country', None)
|
country_code = self._downloader.params.get('geo_bypass_country', None)
|
||||||
if country_code:
|
if country_code:
|
||||||
self._x_forwarded_for_ip = GeoUtils.random_ipv4(country_code)
|
self._x_forwarded_for_ip = GeoUtils.random_ipv4(country_code)
|
||||||
if not self._ready:
|
if not self._ready:
|
||||||
|
@ -389,9 +389,9 @@ class InfoExtractor(object):
|
||||||
ie_result['__x_forwarded_for_ip'] = self._x_forwarded_for_ip
|
ie_result['__x_forwarded_for_ip'] = self._x_forwarded_for_ip
|
||||||
return ie_result
|
return ie_result
|
||||||
except GeoRestrictedError as e:
|
except GeoRestrictedError as e:
|
||||||
if (not self._downloader.params.get('bypass_geo_restriction_as_country', None) and
|
if (not self._downloader.params.get('geo_bypass_country', None) and
|
||||||
self._BYPASS_GEO and
|
self._BYPASS_GEO and
|
||||||
self._downloader.params.get('bypass_geo_restriction', True) and
|
self._downloader.params.get('geo_bypass', True) and
|
||||||
not self._x_forwarded_for_ip and
|
not self._x_forwarded_for_ip and
|
||||||
e.countries):
|
e.countries):
|
||||||
self._x_forwarded_for_ip = GeoUtils.random_ipv4(random.choice(e.countries))
|
self._x_forwarded_for_ip = GeoUtils.random_ipv4(random.choice(e.countries))
|
||||||
|
|
|
@ -550,16 +550,16 @@ def parseOpts(overrideArguments=None):
|
||||||
'(maximum possible number of seconds to sleep). Must only be used '
|
'(maximum possible number of seconds to sleep). Must only be used '
|
||||||
'along with --min-sleep-interval.'))
|
'along with --min-sleep-interval.'))
|
||||||
workarounds.add_option(
|
workarounds.add_option(
|
||||||
'--bypass-geo',
|
'--geo-bypass',
|
||||||
action='store_true', dest='bypass_geo_restriction', default=True,
|
action='store_true', dest='geo_bypass', default=True,
|
||||||
help='Bypass geographic restriction via faking X-Forwarded-For HTTP header (experimental)')
|
help='Bypass geographic restriction via faking X-Forwarded-For HTTP header (experimental)')
|
||||||
workarounds.add_option(
|
workarounds.add_option(
|
||||||
'--no-bypass-geo',
|
'--no-geo-bypass',
|
||||||
action='store_false', dest='bypass_geo_restriction', default=True,
|
action='store_false', dest='geo_bypass', default=True,
|
||||||
help='Do not bypass geographic restriction via faking X-Forwarded-For HTTP header (experimental)')
|
help='Do not bypass geographic restriction via faking X-Forwarded-For HTTP header (experimental)')
|
||||||
workarounds.add_option(
|
workarounds.add_option(
|
||||||
'--bypass-geo-as-country', metavar='CODE',
|
'--geo-bypass-country', metavar='CODE',
|
||||||
dest='bypass_geo_restriction_as_country', default=None,
|
dest='geo_bypass_country', default=None,
|
||||||
help='Force bypass geographic restriction with explicitly provided two-letter ISO 3166-2 country code (experimental)')
|
help='Force bypass geographic restriction with explicitly provided two-letter ISO 3166-2 country code (experimental)')
|
||||||
|
|
||||||
verbosity = optparse.OptionGroup(parser, 'Verbosity / Simulation Options')
|
verbosity = optparse.OptionGroup(parser, 'Verbosity / Simulation Options')
|
||||||
|
|
Loading…
Reference in New Issue