X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=youtube_dl%2Futils.py;h=d7b737e21639679fe665d22e6ca4089f5c791618;hb=0cc71785461d273294f2ab96d50854172ba29c04;hp=c0325f054ddfccd2c601acaee3812be5e00a4e6e;hpb=5ae17037a31edec0dd232f6ccb72212ab4dc5f2e;p=youtube-dl diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py index c0325f054..d7b737e21 100644 --- a/youtube_dl/utils.py +++ b/youtube_dl/utils.py @@ -373,6 +373,13 @@ def sanitize_path(s): return os.path.join(*sanitized_path) +# Prepend protocol-less URLs with `http:` scheme in order to mitigate the number of +# unwanted failures due to missing protocol +def sanitized_Request(url, *args, **kwargs): + return compat_urllib_request.Request( + 'http:%s' % url if url.startswith('//') else url, *args, **kwargs) + + def orderedSet(iterable): """ Remove all duplicates from the input iterable """ res = []