]> git.bitcoin.ninja Git - youtube-dl/commitdiff
[vevo] Allow calling API without https
authorYen Chi Hsuan <yan12125@gmail.com>
Fri, 11 Dec 2015 11:05:51 +0000 (19:05 +0800)
committerYen Chi Hsuan <yan12125@gmail.com>
Fri, 11 Dec 2015 11:07:13 +0000 (19:07 +0800)
Not all proxies allow CONNECT

youtube_dl/extractor/vevo.py

index 38d382581bb9aae91f355294b3776735e1012f42..3e3b25da029d5507fbadb038f07ad60a3529088e 100644 (file)
@@ -3,7 +3,10 @@ from __future__ import unicode_literals
 import re
 
 from .common import InfoExtractor
-from ..compat import compat_etree_fromstring
+from ..compat import (
+    compat_etree_fromstring,
+    compat_urlparse,
+)
 from ..utils import (
     ExtractorError,
     int_or_none,
@@ -162,14 +165,14 @@ class VevoIE(InfoExtractor):
             })
         return formats
 
-    def _download_api_formats(self, video_id):
+    def _download_api_formats(self, video_id, video_url):
         if not self._oauth_token:
             self._downloader.report_warning(
                 'No oauth token available, skipping API HLS download')
             return []
 
-        api_url = 'https://apiv2.vevo.com/video/%s/streams/hls?token=%s' % (
-            video_id, self._oauth_token)
+        api_url = compat_urlparse.urljoin(video_url, '//apiv2.vevo.com/video/%s/streams/hls?token=%s' % (
+            video_id, self._oauth_token))
         api_data = self._download_json(
             api_url, video_id,
             note='Downloading HLS formats',
@@ -214,7 +217,7 @@ class VevoIE(InfoExtractor):
             age_limit = None
 
         # Download via HLS API
-        formats.extend(self._download_api_formats(video_id))
+        formats.extend(self._download_api_formats(video_id, url))
 
         # Download SMIL
         smil_blocks = sorted((