diff options
author | Remita Amine <remitamine@gmail.com> | 2019-12-31 19:48:40 +0100 |
---|---|---|
committer | Remita Amine <remitamine@gmail.com> | 2019-12-31 19:49:01 +0100 |
commit | 2d30b92e116d097f5d9d794ad97f71ef6aadf8a9 (patch) | |
tree | bb33fb22d3cbedba037bdb1ce332a8cd168396e4 /youtube_dl/extractor/brightcove.py | |
parent | 0164cd5dacf76b0fd295e82412fda60e7c60df61 (diff) |
[brightcove] invalidate policy key cache on failing requests
Diffstat (limited to 'youtube_dl/extractor/brightcove.py')
-rw-r--r-- | youtube_dl/extractor/brightcove.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/youtube_dl/extractor/brightcove.py b/youtube_dl/extractor/brightcove.py index 5e0c4bc3e..85001b3ad 100644 --- a/youtube_dl/extractor/brightcove.py +++ b/youtube_dl/extractor/brightcove.py @@ -589,6 +589,7 @@ class BrightcoveNewIE(AdobePassIE): policy_key_id = '%s_%s' % (account_id, player_id) policy_key = self._downloader.cache.load('brightcove', policy_key_id) policy_key_extracted = False + store_pk = lambda x: self._downloader.cache.store('brightcove', policy_key_id, x) def extract_policy_key(): webpage = self._download_webpage( @@ -610,7 +611,7 @@ class BrightcoveNewIE(AdobePassIE): r'policyKey\s*:\s*(["\'])(?P<pk>.+?)\1', webpage, 'policy key', group='pk') - self._downloader.cache.store('brightcove', policy_key_id, policy_key) + store_pk(policy_key) return policy_key api_url = 'https://edge.api.brightcove.com/playback/v1/accounts/%s/%ss/%s' % (account_id, content_type, video_id) @@ -638,6 +639,7 @@ class BrightcoveNewIE(AdobePassIE): self.raise_geo_restricted(msg=message) elif json_data.get('error_code') == 'INVALID_POLICY_KEY' and not policy_key_extracted: policy_key = None + store_pk(None) continue raise ExtractorError(message, expected=True) raise |