1
0
Fork 0
mirror of https://gitlab.com/dstftw/youtube-dl.git synced 2020-11-16 09:42:26 +00:00

[brightcove:new] extract subtitles and strip video title

This commit is contained in:
remitamine 2016-04-02 18:56:01 +01:00
parent 41f5492fbc
commit e47d19e991

View file

@ -515,7 +515,7 @@ class BrightcoveNewIE(InfoExtractor):
raise ExtractorError(json_data[0]['message'], expected=True) raise ExtractorError(json_data[0]['message'], expected=True)
raise raise
title = json_data['name'] title = json_data['name'].strip()
formats = [] formats = []
for source in json_data.get('sources', []): for source in json_data.get('sources', []):
@ -579,20 +579,22 @@ class BrightcoveNewIE(InfoExtractor):
formats.append(f) formats.append(f)
self._sort_formats(formats) self._sort_formats(formats)
description = json_data.get('description') subtitles = {}
thumbnail = json_data.get('thumbnail') for text_track in json_data.get('text_tracks', []):
timestamp = parse_iso8601(json_data.get('published_at')) if text_track.get('src'):
duration = float_or_none(json_data.get('duration'), 1000) subtitles.setdefault(text_track.get('srclang'), []).append({
tags = json_data.get('tags', []) 'url': text_track['src'],
})
return { return {
'id': video_id, 'id': video_id,
'title': title, 'title': title,
'description': description, 'description': json_data.get('description'),
'thumbnail': thumbnail, 'thumbnail': json_data.get('thumbnail') or json_data.get('poster'),
'duration': duration, 'duration': float_or_none(json_data.get('duration'), 1000),
'timestamp': timestamp, 'timestamp': parse_iso8601(json_data.get('published_at')),
'uploader_id': account_id, 'uploader_id': account_id,
'formats': formats, 'formats': formats,
'tags': tags, 'subtitles': subtitles,
'tags': json_data.get('tags', []),
} }