aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--youtube_dl/utils.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py
index eacd81bf9..6d27b80c0 100644
--- a/youtube_dl/utils.py
+++ b/youtube_dl/utils.py
@@ -417,9 +417,12 @@ def sanitize_path(s):
# Prepend protocol-less URLs with `http:` scheme in order to mitigate the number of
# 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):
- return compat_urllib_request.Request(
- 'http:%s' % url if url.startswith('//') else url, *args, **kwargs)
+ return compat_urllib_request.Request(sanitize_url(url), *args, **kwargs)
def orderedSet(iterable):