1
0
Fork 0
mirror of https://github.com/ytdl-org/youtube-dl.git synced 2024-06-15 16:29:36 +00:00

[utils] Extract sanitize_url routine

This commit is contained in:
Sergey M․ 2016-03-26 19:33:57 +06:00
parent b5a5bbf376
commit 17bcc626bf

View file

@ -417,9 +417,12 @@ def sanitize_path(s):
# Prepend protocol-less URLs with `http:` scheme in order to mitigate the number of # Prepend protocol-less URLs with `http:` scheme in order to mitigate the number of
# unwanted failures due to missing protocol # unwanted failures due to missing protocol
def sanitize_url(url):
return 'http:%s' % url if url.startswith('//') else url
def sanitized_Request(url, *args, **kwargs): def sanitized_Request(url, *args, **kwargs):
return compat_urllib_request.Request( return compat_urllib_request.Request(sanitize_url(url), *args, **kwargs)
'http:%s' % url if url.startswith('//') else url, *args, **kwargs)
def orderedSet(iterable): def orderedSet(iterable):