[brightcove] cache brightcove player policy keys
This commit is contained in:
parent
cb7e053e0a
commit
75ef77c1b1
1 changed files with 19 additions and 17 deletions
|
@ -586,12 +586,13 @@ class BrightcoveNewIE(AdobePassIE):
|
||||||
|
|
||||||
account_id, player_id, embed, content_type, video_id = re.match(self._VALID_URL, url).groups()
|
account_id, player_id, embed, content_type, video_id = re.match(self._VALID_URL, url).groups()
|
||||||
|
|
||||||
|
policy_key_id = '%s_%s' % (account_id, player_id)
|
||||||
|
policy_key = self._downloader.cache.load('brightcove', policy_key_id)
|
||||||
|
if not policy_key:
|
||||||
webpage = self._download_webpage(
|
webpage = self._download_webpage(
|
||||||
'http://players.brightcove.net/%s/%s_%s/index.min.js'
|
'http://players.brightcove.net/%s/%s_%s/index.min.js'
|
||||||
% (account_id, player_id, embed), video_id)
|
% (account_id, player_id, embed), video_id)
|
||||||
|
|
||||||
policy_key = None
|
|
||||||
|
|
||||||
catalog = self._search_regex(
|
catalog = self._search_regex(
|
||||||
r'catalog\(({.+?})\);', webpage, 'catalog', default=None)
|
r'catalog\(({.+?})\);', webpage, 'catalog', default=None)
|
||||||
if catalog:
|
if catalog:
|
||||||
|
@ -604,6 +605,7 @@ class BrightcoveNewIE(AdobePassIE):
|
||||||
policy_key = self._search_regex(
|
policy_key = self._search_regex(
|
||||||
r'policyKey\s*:\s*(["\'])(?P<pk>.+?)\1',
|
r'policyKey\s*:\s*(["\'])(?P<pk>.+?)\1',
|
||||||
webpage, 'policy key', group='pk')
|
webpage, 'policy key', group='pk')
|
||||||
|
self._downloader.cache.store('brightcove', policy_key_id, policy_key)
|
||||||
|
|
||||||
api_url = 'https://edge.api.brightcove.com/playback/v1/accounts/%s/%ss/%s' % (account_id, content_type, video_id)
|
api_url = 'https://edge.api.brightcove.com/playback/v1/accounts/%s/%ss/%s' % (account_id, content_type, video_id)
|
||||||
headers = {
|
headers = {
|
||||||
|
|
Loading…
Reference in a new issue