mirror of https://github.com/yt-dlp/yt-dlp.git
[jwplatform] Improve subtitles extraction
This commit is contained in:
parent
b0c65c677f
commit
a495840d3b
|
@ -11,6 +11,7 @@ from ..utils import (
|
||||||
int_or_none,
|
int_or_none,
|
||||||
js_to_json,
|
js_to_json,
|
||||||
mimetype2ext,
|
mimetype2ext,
|
||||||
|
urljoin,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -110,9 +111,13 @@ class JWPlatformBaseIE(InfoExtractor):
|
||||||
tracks = video_data.get('tracks')
|
tracks = video_data.get('tracks')
|
||||||
if tracks and isinstance(tracks, list):
|
if tracks and isinstance(tracks, list):
|
||||||
for track in tracks:
|
for track in tracks:
|
||||||
if track.get('file') and track.get('kind') == 'captions':
|
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({
|
subtitles.setdefault(track.get('label') or 'en', []).append({
|
||||||
'url': self._proto_relative_url(track['file'])
|
'url': self._proto_relative_url(track_url)
|
||||||
})
|
})
|
||||||
|
|
||||||
entries.append({
|
entries.append({
|
||||||
|
|
Loading…
Reference in New Issue