|
|
@ -10,10 +10,12 @@ from ..utils import (
|
|
|
|
find_xpath_attr,
|
|
|
|
find_xpath_attr,
|
|
|
|
compat_urlparse,
|
|
|
|
compat_urlparse,
|
|
|
|
compat_str,
|
|
|
|
compat_str,
|
|
|
|
|
|
|
|
compat_urllib_request,
|
|
|
|
|
|
|
|
|
|
|
|
ExtractorError,
|
|
|
|
ExtractorError,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class BrightcoveIE(InfoExtractor):
|
|
|
|
class BrightcoveIE(InfoExtractor):
|
|
|
|
_VALID_URL = r'https?://.*brightcove\.com/(services|viewer).*\?(?P<query>.*)'
|
|
|
|
_VALID_URL = r'https?://.*brightcove\.com/(services|viewer).*\?(?P<query>.*)'
|
|
|
|
_FEDERATED_URL_TEMPLATE = 'http://c.brightcove.com/services/viewer/htmlFederated?%s'
|
|
|
|
_FEDERATED_URL_TEMPLATE = 'http://c.brightcove.com/services/viewer/htmlFederated?%s'
|
|
|
@ -80,6 +82,9 @@ class BrightcoveIE(InfoExtractor):
|
|
|
|
videoPlayer = find_xpath_attr(object_doc, './param', 'name', '@videoPlayer')
|
|
|
|
videoPlayer = find_xpath_attr(object_doc, './param', 'name', '@videoPlayer')
|
|
|
|
if videoPlayer is not None:
|
|
|
|
if videoPlayer is not None:
|
|
|
|
params['@videoPlayer'] = videoPlayer.attrib['value']
|
|
|
|
params['@videoPlayer'] = videoPlayer.attrib['value']
|
|
|
|
|
|
|
|
linkBase = find_xpath_attr(object_doc, './param', 'name', 'linkBaseURL')
|
|
|
|
|
|
|
|
if linkBase is not None:
|
|
|
|
|
|
|
|
params['linkBaseURL'] = linkBase.attrib['value']
|
|
|
|
data = compat_urllib_parse.urlencode(params)
|
|
|
|
data = compat_urllib_parse.urlencode(params)
|
|
|
|
return cls._FEDERATED_URL_TEMPLATE % data
|
|
|
|
return cls._FEDERATED_URL_TEMPLATE % data
|
|
|
|
|
|
|
|
|
|
|
@ -107,14 +112,18 @@ class BrightcoveIE(InfoExtractor):
|
|
|
|
|
|
|
|
|
|
|
|
videoPlayer = query.get('@videoPlayer')
|
|
|
|
videoPlayer = query.get('@videoPlayer')
|
|
|
|
if videoPlayer:
|
|
|
|
if videoPlayer:
|
|
|
|
return self._get_video_info(videoPlayer[0], query_str)
|
|
|
|
return self._get_video_info(videoPlayer[0], query_str, query)
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
player_key = query['playerKey']
|
|
|
|
player_key = query['playerKey']
|
|
|
|
return self._get_playlist_info(player_key[0])
|
|
|
|
return self._get_playlist_info(player_key[0])
|
|
|
|
|
|
|
|
|
|
|
|
def _get_video_info(self, video_id, query):
|
|
|
|
def _get_video_info(self, video_id, query_str, query):
|
|
|
|
request_url = self._FEDERATED_URL_TEMPLATE % query
|
|
|
|
request_url = self._FEDERATED_URL_TEMPLATE % query_str
|
|
|
|
webpage = self._download_webpage(request_url, video_id)
|
|
|
|
req = compat_urllib_request.Request(request_url)
|
|
|
|
|
|
|
|
linkBase = query.get('linkBaseURL')
|
|
|
|
|
|
|
|
if linkBase is not None:
|
|
|
|
|
|
|
|
req.add_header('Referer', linkBase[0])
|
|
|
|
|
|
|
|
webpage = self._download_webpage(req, video_id)
|
|
|
|
|
|
|
|
|
|
|
|
self.report_extraction(video_id)
|
|
|
|
self.report_extraction(video_id)
|
|
|
|
info = self._search_regex(r'var experienceJSON = ({.*?});', webpage, 'json')
|
|
|
|
info = self._search_regex(r'var experienceJSON = ({.*?});', webpage, 'json')
|
|
|
|