aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl
diff options
context:
space:
mode:
authorYen Chi Hsuan <yan12125@gmail.com>2015-04-08 21:39:34 +0800
committerYen Chi Hsuan <yan12125@gmail.com>2015-04-08 21:39:34 +0800
commit0a1603634bcf799eeb769d95b6e716e66123b77f (patch)
treee15605172eab5f823f4743713ce23003fb4590c8 /youtube_dl
parenta662163fd5b3c9b1221b8aeaf54ed9083af8574f (diff)
[utils] Remove url_infer_protocol
Diffstat (limited to 'youtube_dl')
-rw-r--r--youtube_dl/extractor/generic.py3
-rw-r--r--youtube_dl/extractor/udn.py8
-rw-r--r--youtube_dl/utils.py11
3 files changed, 4 insertions, 18 deletions
diff --git a/youtube_dl/extractor/generic.py b/youtube_dl/extractor/generic.py
index 9178d2b7b..6c212efac 100644
--- a/youtube_dl/extractor/generic.py
+++ b/youtube_dl/extractor/generic.py
@@ -26,7 +26,6 @@ from ..utils import (
unsmuggle_url,
UnsupportedError,
url_basename,
- url_infer_protocol,
xpath_text,
)
from .brightcove import BrightcoveIE
@@ -1286,7 +1285,7 @@ class GenericIE(InfoExtractor):
r'<iframe[^>]+src="(?P<url>%s)"' % UDNEmbedIE._VALID_URL, webpage)
if mobj is not None:
return self.url_result(
- url_infer_protocol(url, mobj.group('url')), 'UDNEmbed')
+ compat_urlparse.urljoin(url, mobj.group('url')), 'UDNEmbed')
def check_video(vurl):
if YoutubeIE.suitable(vurl):
diff --git a/youtube_dl/extractor/udn.py b/youtube_dl/extractor/udn.py
index 2b9a733e8..bba25bb58 100644
--- a/youtube_dl/extractor/udn.py
+++ b/youtube_dl/extractor/udn.py
@@ -3,10 +3,8 @@ from __future__ import unicode_literals
import json
from .common import InfoExtractor
-from ..utils import (
- url_infer_protocol,
- js_to_json
-)
+from ..utils import js_to_json
+from ..compat import compat_urlparse
class UDNEmbedIE(InfoExtractor):
@@ -45,7 +43,7 @@ class UDNEmbedIE(InfoExtractor):
formats = [{
'url': self._download_webpage(
- url_infer_protocol(url, api_url), video_id,
+ compat_urlparse.urljoin(url, api_url), video_id,
'retrieve url for %s video' % video_type),
'format_id': video_type,
'preference': 0 if video_type == 'mp4' else -1,
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py
index f3b8d9f81..52f0dd09a 100644
--- a/youtube_dl/utils.py
+++ b/youtube_dl/utils.py
@@ -1711,17 +1711,6 @@ 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