Add playlist format extraction.
This commit is contained in:
parent
30d2664c59
commit
93748c89e1
@ -32,7 +32,6 @@ from ..utils import (
|
||||
update_url_query,
|
||||
clean_html,
|
||||
mimetype2ext,
|
||||
url_or_none,
|
||||
)
|
||||
|
||||
|
||||
@ -614,9 +613,7 @@ class BrightcoveNewIE(AdobePassIE):
|
||||
title = json_data['name'].strip()
|
||||
|
||||
formats = []
|
||||
# playlistId data starts from `videos`, videoId from `sources`
|
||||
for vid in json_data.get('videos', [json_data]):
|
||||
for source in vid.get('sources', []):
|
||||
for source in json_data.get('sources', []):
|
||||
container = source.get('container')
|
||||
ext = mimetype2ext(source.get('type'))
|
||||
src = source.get('src')
|
||||
@ -724,6 +721,17 @@ class BrightcoveNewIE(AdobePassIE):
|
||||
'is_live': is_live,
|
||||
}
|
||||
|
||||
def _extract_playlist(self, json_data, headers):
|
||||
playlist_id = json_data.get('id')
|
||||
playlist_title = json_data.get('name')
|
||||
playlist_description = json_data.get('description')
|
||||
playlist_vids = json_data.get('videos', [])
|
||||
|
||||
return self.playlist_result(
|
||||
[self._parse_brightcove_metadata(vid, vid.get('id'), headers) for vid in playlist_vids],
|
||||
playlist_id, playlist_title, playlist_description,
|
||||
)
|
||||
|
||||
def _real_extract(self, url):
|
||||
url, smuggled_data = unsmuggle_url(url, {})
|
||||
self._initialize_geo_bypass({
|
||||
@ -787,5 +795,8 @@ class BrightcoveNewIE(AdobePassIE):
|
||||
'tveToken': tve_token,
|
||||
})
|
||||
|
||||
if content_type == 'playlist':
|
||||
return self._extract_playlist(json_data, headers)
|
||||
|
||||
return self._parse_brightcove_metadata(
|
||||
json_data, video_id, headers=headers)
|
||||
|
Loading…
x
Reference in New Issue
Block a user