0
0
Fork 0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-27 03:03:01 +00:00

[jwplatform] Improve subtitles extraction

This commit is contained in:
Sergey M․ 2016-12-17 18:45:44 +07:00
parent b0c65c677f
commit a495840d3b
No known key found for this signature in database
GPG key ID: 2C393E0F18A9236D

View file

@ -11,6 +11,7 @@
int_or_none,
js_to_json,
mimetype2ext,
urljoin,
)
@ -110,10 +111,14 @@ def _parse_jwplayer_data(self, jwplayer_data, video_id=None, require_title=True,
tracks = video_data.get('tracks')
if tracks and isinstance(tracks, list):
for track in tracks:
if track.get('file') and track.get('kind') == 'captions':
subtitles.setdefault(track.get('label') or 'en', []).append({
'url': self._proto_relative_url(track['file'])
})
if track.get('kind') != 'captions':
continue
track_url = urljoin(base_url, track.get('file'))
if not track_url:
continue
subtitles.setdefault(track.get('label') or 'en', []).append({
'url': self._proto_relative_url(track_url)
})
entries.append({
'id': this_video_id,