aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/utils.py
diff options
context:
space:
mode:
authorYen Chi Hsuan <yan12125@gmail.com>2015-04-08 17:26:51 +0800
committerYen Chi Hsuan <yan12125@gmail.com>2015-04-08 17:26:51 +0800
commit418c5cc3fc3ea99b791ad1774a6b03504eab7086 (patch)
treee5d7d597e173c26138af915b15b0522c130a324f /youtube_dl/utils.py
parentde5c54564874fd870fdfe3fd24f47e3e5f6cedf7 (diff)
downloadyoutube-dl-418c5cc3fc3ea99b791ad1774a6b03504eab7086.tar.xz
[udn] Add new extractor
Diffstat (limited to 'youtube_dl/utils.py')
-rw-r--r--youtube_dl/utils.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py
index 52f0dd09a..f3b8d9f81 100644
--- a/youtube_dl/utils.py
+++ b/youtube_dl/utils.py
@@ -1711,6 +1711,17 @@ def determine_protocol(info_dict):
return compat_urllib_parse_urlparse(url).scheme
+def url_infer_protocol(ref_url, target_url):
+ """ Infer protocol for protocol independent target urls """
+ parsed_target_url = list(compat_urllib_parse_urlparse(target_url))
+ if parsed_target_url[0]:
+ return target_url
+
+ parsed_target_url[0] = compat_urllib_parse_urlparse(ref_url).scheme
+
+ return compat_urlparse.urlunparse(parsed_target_url)
+
+
def render_table(header_row, data):
""" Render a list of rows, each as a list of values """
table = [header_row] + data