0
0
Fork 0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-22 02:15:12 +00:00

Validate --get-bypass-country

Closes #1834
This commit is contained in:
pukkandan 2021-11-30 00:48:51 +05:30
parent 5c22c63da3
commit 717216b093
No known key found for this signature in database
GPG key ID: 0F00D95A001F4698

View file

@ -29,6 +29,7 @@
DownloadError,
error_to_compat_str,
expand_path,
GeoUtils,
float_or_none,
int_or_none,
match_filter_func,
@ -255,12 +256,17 @@ def parse_retries(retries, name=''):
if opts.convertthumbnails is not None:
if opts.convertthumbnails not in FFmpegThumbnailsConvertorPP.SUPPORTED_EXTS:
parser.error('invalid thumbnail format specified')
if opts.cookiesfrombrowser is not None:
opts.cookiesfrombrowser = [
part.strip() or None for part in opts.cookiesfrombrowser.split(':', 1)]
if opts.cookiesfrombrowser[0].lower() not in SUPPORTED_BROWSERS:
parser.error('unsupported browser specified for cookies')
geo_bypass_code = opts.geo_bypass_ip_block or opts.geo_bypass_country
if geo_bypass_code is not None:
try:
GeoUtils.random_ipv4(geo_bypass_code)
except Exception:
parser.error('unsupported geo-bypass country or ip-block')
if opts.date is not None:
date = DateRange.day(opts.date)