[vevo] Allow calling API without https

Not all proxies allow CONNECT
This commit is contained in:
Yen Chi Hsuan 2015-12-11 19:05:51 +08:00
parent ff51983e15
commit ad30dc1e20

View File

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