2 from __future__
import unicode_literals
8 from .adobepass
import AdobePassIE
9 from .common
import InfoExtractor
10 from ..compat
import (
11 compat_etree_fromstring
,
14 compat_urllib_parse_urlparse
,
16 compat_xml_parse_error
,
39 class BrightcoveLegacyIE(InfoExtractor
):
40 IE_NAME
= 'brightcove:legacy'
41 _VALID_URL
= r
'(?:https?://.*brightcove\.com/(services|viewer).*?\?|brightcove:)(?P<query>.*)'
45 # From http://www.8tv.cat/8aldia/videos/xavier-sala-i-martin-aquesta-tarda-a-8-al-dia/
46 'url': 'http://c.brightcove.com/services/viewer/htmlFederated?playerID=1654948606001&flashID=myExperience&%40videoPlayer=2371591881001',
47 'md5': '5423e113865d26e40624dce2e4b45d95',
48 'note': 'Test Brightcove downloads and detection in GenericIE',
50 'id': '2371591881001',
52 'title': 'Xavier Sala i Martín: “Un banc que no presta és un banc zombi que no serveix per a res”',
54 'description': 'md5:a950cc4285c43e44d763d036710cd9cd',
55 'timestamp': 1368213670,
56 'upload_date': '20130510',
57 'uploader_id': '1589608506001',
59 'skip': 'The player has been deactivated by the content owner',
62 # From http://medianetwork.oracle.com/video/player/1785452137001
63 'url': 'http://c.brightcove.com/services/viewer/htmlFederated?playerID=1217746023001&flashID=myPlayer&%40videoPlayer=1785452137001',
65 'id': '1785452137001',
67 'title': 'JVMLS 2012: Arrays 2.0 - Opportunities and Challenges',
68 'description': 'John Rose speaks at the JVM Language Summit, August 1, 2012.',
70 'timestamp': 1344975024,
71 'upload_date': '20120814',
72 'uploader_id': '1460825906',
74 'skip': 'video not playable',
77 # From http://mashable.com/2013/10/26/thermoelectric-bracelet-lets-you-control-your-body-temperature/
78 'url': 'http://c.brightcove.com/services/viewer/federated_f9?&playerID=1265504713001&publisherID=AQ%7E%7E%2CAAABBzUwv1E%7E%2CxP-xFHVUstiMFlNYfvF4G9yFnNaqCw_9&videoID=2750934548001',
80 'id': '2750934548001',
82 'title': 'This Bracelet Acts as a Personal Thermostat',
83 'description': 'md5:547b78c64f4112766ccf4e151c20b6a0',
84 # 'uploader': 'Mashable',
85 'timestamp': 1382041798,
86 'upload_date': '20131017',
87 'uploader_id': '1130468786001',
91 # test that the default referer works
92 # from http://national.ballet.ca/interact/video/Lost_in_Motion_II/
93 'url': 'http://link.brightcove.com/services/player/bcpid756015033001?bckey=AQ~~,AAAApYJi_Ck~,GxhXCegT1Dp39ilhXuxMJxasUhVNZiil&bctid=2878862109001',
95 'id': '2878862109001',
97 'title': 'Lost in Motion II',
98 'description': 'md5:363109c02998fee92ec02211bd8000df',
99 'uploader': 'National Ballet of Canada',
101 'skip': 'Video gone',
104 # test flv videos served by akamaihd.net
105 # From http://www.redbull.com/en/bike/stories/1331655643987/replay-uci-dh-world-cup-2014-from-fort-william
106 'url': 'http://c.brightcove.com/services/viewer/htmlFederated?%40videoPlayer=ref%3Aevent-stream-356&linkBaseURL=http%3A%2F%2Fwww.redbull.com%2Fen%2Fbike%2Fvideos%2F1331655630249%2Freplay-uci-fort-william-2014-dh&playerKey=AQ%7E%7E%2CAAAApYJ7UqE%7E%2Cxqr_zXk0I-zzNndy8NlHogrCb5QdyZRf&playerID=1398061561001#__youtubedl_smuggle=%7B%22Referer%22%3A+%22http%3A%2F%2Fwww.redbull.com%2Fen%2Fbike%2Fstories%2F1331655643987%2Freplay-uci-dh-world-cup-2014-from-fort-william%22%7D',
107 # The md5 checksum changes on each download
109 'id': '3750436379001',
111 'title': 'UCI MTB World Cup 2014: Fort William, UK - Downhill Finals',
112 'uploader': 'RBTV Old (do not use)',
113 'description': 'UCI MTB World Cup 2014: Fort William, UK - Downhill Finals',
114 'timestamp': 1409122195,
115 'upload_date': '20140827',
116 'uploader_id': '710858724001',
118 'skip': 'Video gone',
121 # playlist with 'videoList'
122 # from http://support.brightcove.com/en/video-cloud/docs/playlist-support-single-video-players
123 'url': 'http://c.brightcove.com/services/viewer/htmlFederated?playerID=3550052898001&playerKey=AQ%7E%7E%2CAAABmA9XpXk%7E%2C-Kp7jNgisre1fG5OdqpAFUTcs0lP_ZoL',
126 'id': '3550319591001',
128 'playlist_mincount': 7,
129 'skip': 'Unsupported URL',
132 # playlist with 'playlistTab' (https://github.com/ytdl-org/youtube-dl/issues/9965)
133 'url': 'http://c.brightcove.com/services/json/experience/runtime/?command=get_programming_for_experience&playerKey=AQ%7E%7E,AAABXlLMdok%7E,NJ4EoMlZ4rZdx9eU1rkMVd8EaYPBBUlg',
135 'id': '1522758701001',
136 'title': 'Lesson 08',
138 'playlist_mincount': 10,
139 'skip': 'Unsupported URL',
142 # playerID inferred from bcpid
143 # from http://www.un.org/chinese/News/story.asp?NewsID=27724
144 'url': 'https://link.brightcove.com/services/player/bcpid1722935254001/?bctid=5360463607001&autoStart=false&secureConnections=true&width=650&height=350',
145 'only_matching': True, # Tested in GenericIE
150 def _build_brighcove_url(cls
, object_str
):
152 Build a Brightcove url from a xml string containing
153 <object class="BrightcoveExperience">{params}</object>
156 # Fix up some stupid HTML, see https://github.com/ytdl-org/youtube-dl/issues/1553
157 object_str
= re
.sub(r
'(<param(?:\s+[a-zA-Z0-9_]+="[^"]*")*)>',
158 lambda m
: m
.group(1) + '/>', object_str
)
159 # Fix up some stupid XML, see https://github.com/ytdl-org/youtube-dl/issues/1608
160 object_str
= object_str
.replace('<--', '<!--')
161 # remove namespace to simplify extraction
162 object_str
= re
.sub(r
'(<object[^>]*)(xmlns=".*?")', r
'\1', object_str
)
163 object_str
= fix_xml_ampersands(object_str
)
166 object_doc
= compat_etree_fromstring(object_str
.encode('utf-8'))
167 except compat_xml_parse_error
:
170 fv_el
= find_xpath_attr(object_doc
, './param', 'name', 'flashVars')
171 if fv_el
is not None:
174 for k
, v
in compat_parse_qs(fv_el
.attrib
['value']).items())
178 data_url
= object_doc
.attrib
.get('data', '')
179 data_url_params
= compat_parse_qs(compat_urllib_parse_urlparse(data_url
).query
)
181 def find_param(name
):
182 if name
in flashvars
:
183 return flashvars
[name
]
184 node
= find_xpath_attr(object_doc
, './param', 'name', name
)
186 return node
.attrib
['value']
187 return data_url_params
.get(name
)
191 playerID
= find_param('playerID') or find_param('playerId')
193 raise ExtractorError('Cannot find player ID')
194 params
['playerID'] = playerID
196 playerKey
= find_param('playerKey')
197 # Not all pages define this value
198 if playerKey
is not None:
199 params
['playerKey'] = playerKey
200 # These fields hold the id of the video
201 videoPlayer
= find_param('@videoPlayer') or find_param('videoId') or find_param('videoID') or find_param('@videoList')
202 if videoPlayer
is not None:
203 if isinstance(videoPlayer
, list):
204 videoPlayer
= videoPlayer
[0]
205 videoPlayer
= videoPlayer
.strip()
206 # UUID is also possible for videoPlayer (e.g.
207 # http://www.popcornflix.com/hoodies-vs-hooligans/7f2d2b87-bbf2-4623-acfb-ea942b4f01dd
208 # or http://www8.hp.com/cn/zh/home.html)
210 r
'^(?:\d+|[\da-fA-F]{8}-?[\da-fA-F]{4}-?[\da-fA-F]{4}-?[\da-fA-F]{4}-?[\da-fA-F]{12})$',
211 videoPlayer
) or videoPlayer
.startswith('ref:')):
213 params
['@videoPlayer'] = videoPlayer
214 linkBase
= find_param('linkBaseURL')
215 if linkBase
is not None:
216 params
['linkBaseURL'] = linkBase
217 return cls
._make
_brightcove
_url
(params
)
220 def _build_brighcove_url_from_js(cls
, object_js
):
221 # The layout of JS is as follows:
222 # customBC.createVideo = function (width, height, playerID, playerKey, videoPlayer, VideoRandomID) {
223 # // build Brightcove <object /> XML
226 r
'''(?x)customBC\.createVideo\(
227 .*? # skipping width and height
228 ["\'](?P
<playerID
>\d
+)["\']\s*,\s* # playerID
229 ["\'](?P
<playerKey
>AQ
[^
"\']{48})[^"\']*["\']\s*,\s* # playerKey begins with AQ and is 50 characters
230 # in length, however it's appended to itself
231 # in places, so truncate
232 ["\'](?P
<videoID
>\d
+)["\'] # @videoPlayer
235 return cls._make_brightcove_url(m.groupdict())
238 def _make_brightcove_url(cls, params):
239 return update_url_query(
240 'http://c.brightcove.com/services/viewer/htmlFederated', params)
243 def _extract_brightcove_url(cls, webpage):
244 """Try to extract the brightcove url from the webpage, returns None
247 urls = cls._extract_brightcove_urls(webpage)
248 return urls[0] if urls else None
251 def _extract_brightcove_urls(cls, webpage):
252 """Return a list of all Brightcove URLs from the webpage """
257 (?:property|itemprop)=([\'"])(?
:og
:video|embedURL
)\
1[^
>]+
258 content
=([\'"])(?P<url>https?://(?:secure|c)\.brightcove.com/(?:(?!\2).)+)\2
261 url = unescapeHTML(url_m.group('url'))
262 # Some sites don't add it, we can't download with this url, for example:
263 # http://www.ktvu.com/videos/news/raw-video-caltrain-releases-video-of-man-almost/vCTZdY/
264 if 'playerKey' in url or 'videoId' in url or 'idVideo' in url:
267 matches = re.findall(
270 [^>]+?class=[\'"][^
>]*?BrightcoveExperience
.*?
[\'"] |
271 [^>]*?>\s*<param\s+name="movie
"\s+value="https?
://[^
/]*brightcove\
.com
/
272 ).+?
>\s
*</object>''',
275 return list(filter(None, [cls._build_brighcove_url(m) for m in matches]))
277 matches = re.findall(r'(customBC\.createVideo\(.+?\);)', webpage)
279 return list(filter(None, [
280 cls._build_brighcove_url_from_js(custom_bc)
281 for custom_bc in matches]))
282 return [src for _, src in re.findall(
283 r'<iframe[^>]+src=([\'"])((?:https?:)?//link\.brightcove\.com/services/player/(?!\1).+)\1', webpage)]
285 def _real_extract(self, url):
286 url, smuggled_data = unsmuggle_url(url, {})
288 # Change the 'videoId' and others field to '@videoPlayer'
289 url = re.sub(r'(?<=[?&])(videoI(d|D)|idVideo|bctid)', '%40videoPlayer', url)
290 # Change bckey (used by bcove.me urls) to playerKey
291 url = re.sub(r'(?<=[?&])bckey', 'playerKey', url)
292 mobj = re.match(self._VALID_URL, url)
293 query_str = mobj.group('query')
294 query = compat_urlparse.parse_qs(query_str)
296 videoPlayer = query.get('@videoPlayer')
298 # We set the original url as the default 'Referer' header
299 referer = query.get('linkBaseURL', [None])[0] or smuggled_data.get('Referer', url)
300 video_id = videoPlayer[0]
301 if 'playerID' not in query:
302 mobj = re.search(r'/bcpid(\d+)', url)
304 query['playerID'] = [mobj.group(1)]
305 publisher_id = query.get('publisherId')
306 if publisher_id and publisher_id[0].isdigit():
307 publisher_id = publisher_id[0]
309 player_key = query.get('playerKey')
310 if player_key and ',' in player_key[0]:
311 player_key = player_key[0]
313 player_id = query.get('playerID')
314 if player_id and player_id[0].isdigit():
317 headers['Referer'] = referer
318 player_page = self._download_webpage(
319 'http://link.brightcove.com/services/player/bcpid' + player_id[0],
320 video_id, headers=headers, fatal=False)
322 player_key = self._search_regex(
323 r'<param\s+name="playerKey"\s+value="([\w~,-]+)"',
324 player_page, 'player key', fatal=False)
326 enc_pub_id = player_key.split(',')[1].replace('~', '=')
327 publisher_id = struct.unpack('>Q', base64.urlsafe_b64decode(enc_pub_id))[0]
329 brightcove_new_url = 'http://players.brightcove.net/%s/default_default/index.html?videoId=%s' % (publisher_id, video_id)
331 brightcove_new_url = smuggle_url(brightcove_new_url, {'referrer': referer})
332 return self.url_result(brightcove_new_url, BrightcoveNewIE.ie_key(), video_id)
333 # TODO: figure out if it's possible to extract playlistId from playerKey
334 # elif 'playerKey' in query:
335 # player_key = query['playerKey']
336 # return self._get_playlist_info(player_key[0])
337 raise UnsupportedError(url)
340 class BrightcoveNewIE(AdobePassIE):
341 IE_NAME = 'brightcove:new'
342 _VALID_URL = r'https?://players\.brightcove\.net/(?P<account_id>\d+)/(?P<player_id>[^/]+)_(?P<embed>[^/]+)/index\.html\?.*(?P<content_type>video|playlist)Id=(?P<video_id>\d+|ref:[^&]+)'
344 'url': 'http://players.brightcove.net/929656772001/e41d32dc-ec74-459e-a845-6c69f7b724ea_default/index.html?videoId=4463358922001',
345 'md5': 'c8100925723840d4b0d243f7025703be',
347 'id': '4463358922001',
349 'title': 'Meet the man behind Popcorn Time',
350 'description': 'md5:eac376a4fe366edc70279bfb681aea16',
352 'timestamp': 1441391203,
353 'upload_date': '20150904',
354 'uploader_id': '929656772001',
355 'formats': 'mincount:20',
359 'url': 'http://players.brightcove.net/4036320279001/5d112ed9-283f-485f-a7f9-33f42e8bc042_default/index.html?videoId=4279049078001',
361 'id': '4279049078001',
363 'title': 'Titansgrave: Chapter 0',
364 'description': 'Titansgrave: Chapter 0',
365 'duration': 1242.058,
366 'timestamp': 1433556729,
367 'upload_date': '20150606',
368 'uploader_id': '4036320279001',
369 'formats': 'mincount:39',
373 'skip_download': True,
377 'url': 'https://players.brightcove.net/1752604059001/S13cJdUBz_default/index.html?playlistId=5718313430001',
379 'id': '5718313430001',
380 'title': 'No Audio Playlist',
385 'skip_download': True,
388 'url': 'http://players.brightcove.net/5690807595001/HyZNerRl7_default/index.html?playlistId=5743160747001',
389 'only_matching': True,
391 # ref: prefixed video id
392 'url': 'http://players.brightcove.net/3910869709001/21519b5c-4b3b-4363-accb-bdc8f358f823_default/index.html?videoId=ref:7069442',
393 'only_matching': True,
395 # non numeric ref: prefixed video id
396 'url': 'http://players.brightcove.net/710858724001/default_default/index.html?videoId=ref:event-stream-356',
397 'only_matching': True,
399 # unavailable video without message but with error_code
400 'url': 'http://players.brightcove.net/1305187701/c832abfb-641b-44eb-9da0-2fe76786505f_default/index.html?videoId=4377407326001',
401 'only_matching': True,
405 def _extract_url(ie, webpage):
406 urls = BrightcoveNewIE._extract_urls(ie, webpage)
407 return urls[0] if urls else None
410 def _extract_urls(ie, webpage):
412 # 1. http://docs.brightcove.com/en/video-cloud/brightcove-player/guides/publish-video.html#setvideoiniframe
413 # 2. http://docs.brightcove.com/en/video-cloud/brightcove-player/guides/publish-video.html#tag
414 # 3. http://docs.brightcove.com/en/video-cloud/brightcove-player/guides/publish-video.html#setvideousingjavascript
415 # 4. http://docs.brightcove.com/en/video-cloud/brightcove-player/guides/in-page-embed-player-implementation.html
416 # 5. https://support.brightcove.com/en/video-cloud/docs/dynamically-assigning-videos-player
420 # Look for iframe embeds [1]
421 for _, url in re.findall(
422 r'<iframe[^>]+src=(["\'])((?:https?:)?//players\.brightcove\.net/\d+/[^/]+/index\.html.+?)\1', webpage):
423 entries.append(url if url.startswith('http') else 'http:' + url)
425 # Look for <video> tags [2] and embed_in_page embeds [3]
427 for video, script_tag, account_id, player_id, embed in re.findall(
429 (<video(?
:-js
)?\s
+[^
>]*\bdata
-video
-id\s
*=\s
*['"]?[^>]+>)
432 src=["\'](?:https?:)?//players\.brightcove\.net/
433 (\d+)/([^/]+)_([^/]+)/index(?:\.min)?\.js
437 attrs = extract_attributes(video)
439 # According to examples from [4] it's unclear whether video
id
440 # may be optional and what to do when it is
441 video_id
= attrs
.get('data-video-id')
445 account_id
= account_id
or attrs
.get('data-account')
449 player_id
= player_id
or attrs
.get('data-player') or 'default'
450 embed
= embed
or attrs
.get('data-embed') or 'default'
452 bc_url
= 'http://players.brightcove.net/%s/%s_%s/index.html?videoId=%s' % (
453 account_id
, player_id
, embed
, video_id
)
455 # Some brightcove videos may be embedded with video tag only and
456 # without script tag or any mentioning of brightcove at all. Such
457 # embeds are considered ambiguous since they are matched based only
458 # on data-video-id and data-account attributes and in the wild may
459 # not be brightcove embeds at all. Let's check reconstructed
460 # brightcove URLs in case of such embeds and only process valid
461 # ones. By this we ensure there is indeed a brightcove embed.
462 if not script_tag
and not ie
._is
_valid
_url
(
463 bc_url
, video_id
, 'possible brightcove video'):
466 entries
.append(bc_url
)
470 def _parse_brightcove_metadata(self
, json_data
, video_id
, headers
={}):
471 title
= json_data
['name'].strip()
474 sources_num
= len(json_data
.get('sources'))
475 key_systems_present
= 0
476 for source
in json_data
.get('sources', []):
477 container
= source
.get('container')
478 ext
= mimetype2ext(source
.get('type'))
479 src
= source
.get('src')
480 # https://apis.support.brightcove.com/playback/references/playback-api-video-fields-reference.html
481 if source
.get('key_systems'):
482 key_systems_present
+= 1
484 elif ext
== 'ism' or container
== 'WVM':
486 elif ext
== 'm3u8' or container
== 'M2TS':
489 formats
.extend(self
._extract
_m
3u8_formats
(
490 src
, video_id
, 'mp4', 'm3u8_native', m3u8_id
='hls', fatal
=False))
494 formats
.extend(self
._extract
_mpd
_formats
(src
, video_id
, 'dash', fatal
=False))
496 streaming_src
= source
.get('streaming_src')
497 stream_name
, app_name
= source
.get('stream_name'), source
.get('app_name')
498 if not src
and not streaming_src
and (not stream_name
or not app_name
):
500 tbr
= float_or_none(source
.get('avg_bitrate'), 1000)
501 height
= int_or_none(source
.get('height'))
502 width
= int_or_none(source
.get('width'))
505 'filesize': int_or_none(source
.get('size')),
506 'container': container
,
507 'ext': ext
or container
.lower(),
509 if width
== 0 and height
== 0:
517 'vcodec': source
.get('codec'),
520 def build_format_id(kind
):
523 format_id
+= '-%dk' % int(tbr
)
525 format_id
+= '-%dp' % height
528 if src
or streaming_src
:
530 'url': src
or streaming_src
,
531 'format_id': build_format_id('http' if src
else 'http-streaming'),
532 'source_preference': 0 if src
else -1,
537 'play_path': stream_name
,
538 'format_id': build_format_id('rtmp'),
542 if sources_num
== key_systems_present
:
543 raise ExtractorError('This video is DRM protected', expected
=True)
546 # for sonyliv.com DRM protected videos
547 s3_source_url
= json_data
.get('custom_fields', {}).get('s3sourceurl')
550 'url': s3_source_url
,
551 'format_id': 'source',
554 errors
= json_data
.get('errors')
555 if not formats
and errors
:
557 raise ExtractorError(
558 error
.get('message') or error
.get('error_subcode') or error
['error_code'], expected
=True)
560 self
._sort
_formats
(formats
)
563 f
.setdefault('http_headers', {}).update(headers
)
566 for text_track
in json_data
.get('text_tracks', []):
567 if text_track
.get('kind') != 'captions':
569 text_track_url
= url_or_none(text_track
.get('src'))
570 if not text_track_url
:
572 lang
= (str_or_none(text_track
.get('srclang'))
573 or str_or_none(text_track
.get('label')) or 'en').lower()
574 subtitles
.setdefault(lang
, []).append({
575 'url': text_track_url
,
579 duration
= float_or_none(json_data
.get('duration'), 1000)
580 if duration
is not None and duration
<= 0:
585 'title': self
._live
_title
(title
) if is_live
else title
,
586 'description': clean_html(json_data
.get('description')),
587 'thumbnail': json_data
.get('thumbnail') or json_data
.get('poster'),
588 'duration': duration
,
589 'timestamp': parse_iso8601(json_data
.get('published_at')),
590 'uploader_id': json_data
.get('account_id'),
592 'subtitles': subtitles
,
593 'tags': json_data
.get('tags', []),
597 def _real_extract(self
, url
):
598 url
, smuggled_data
= unsmuggle_url(url
, {})
599 self
._initialize
_geo
_bypass
({
600 'countries': smuggled_data
.get('geo_countries'),
601 'ip_blocks': smuggled_data
.get('geo_ip_blocks'),
604 account_id
, player_id
, embed
, content_type
, video_id
= re
.match(self
._VALID
_URL
, url
).groups()
606 policy_key_id
= '%s_%s' % (account_id
, player_id
)
607 policy_key
= self
._downloader
.cache
.load('brightcove', policy_key_id
)
608 policy_key_extracted
= False
609 store_pk
= lambda x
: self
._downloader
.cache
.store('brightcove', policy_key_id
, x
)
611 def extract_policy_key():
612 webpage
= self
._download
_webpage
(
613 'http://players.brightcove.net/%s/%s_%s/index.min.js'
614 % (account_id
, player_id
, embed
), video_id
)
618 catalog
= self
._search
_regex
(
619 r
'catalog\(({.+?})\);', webpage
, 'catalog', default
=None)
621 catalog
= self
._parse
_json
(
622 js_to_json(catalog
), video_id
, fatal
=False)
624 policy_key
= catalog
.get('policyKey')
627 policy_key
= self
._search
_regex
(
628 r
'policyKey\s*:\s*(["\'])(?P
<pk
>.+?
)\
1',
629 webpage, 'policy key
', group='pk
')
634 api_url = 'https
://edge
.api
.brightcove
.com
/playback
/v1
/accounts
/%s/%ss/%s' % (account_id, content_type, video_id)
636 referrer = smuggled_data.get('referrer
')
640 'Origin
': re.search(r'https?
://[^
/]+', referrer).group(0),
645 policy_key = extract_policy_key()
646 policy_key_extracted = True
647 headers['Accept
'] = 'application
/json
;pk
=%s' % policy_key
649 json_data = self._download_json(api_url, video_id, headers=headers)
651 except ExtractorError as e:
652 if isinstance(e.cause, compat_HTTPError) and e.cause.code in (401, 403):
653 json_data = self._parse_json(e.cause.read().decode(), video_id)[0]
654 message = json_data.get('message
') or json_data['error_code
']
655 if json_data.get('error_subcode
') == 'CLIENT_GEO
':
656 self.raise_geo_restricted(msg=message)
657 elif json_data.get('error_code
') == 'INVALID_POLICY_KEY
' and not policy_key_extracted:
661 raise ExtractorError(message, expected=True)
664 errors = json_data.get('errors
')
665 if errors and errors[0].get('error_subcode
') == 'TVE_AUTH
':
666 custom_fields = json_data['custom_fields
']
667 tve_token = self._extract_mvpd_auth(
668 smuggled_data['source_url
'], video_id,
669 custom_fields['bcadobepassrequestorid
'],
670 custom_fields['bcadobepassresourceid
'])
671 json_data = self._download_json(
672 api_url, video_id, headers={
673 'Accept
': 'application
/json
;pk
=%s' % policy_key
675 'tveToken
': tve_token,
678 if content_type == 'playlist
':
679 return self.playlist_result(
680 [self._parse_brightcove_metadata(vid, vid.get('id'), headers)
681 for vid in json_data.get('videos
', []) if vid.get('id')],
682 json_data.get('id'), json_data.get('name
'),
683 json_data.get('description
'))
685 return self._parse_brightcove_metadata(
686 json_data, video_id, headers=headers)