aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/jwplatform.py
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2016-12-17 18:45:44 +0700
committerSergey M․ <dstftw@gmail.com>2016-12-17 18:50:00 +0700
commita495840d3bb05619f9d38168b47f55f7aeb1ca87 (patch)
treee198e85d0e1a415098ad2b2d07b3eae9ddf43757 /youtube_dl/extractor/jwplatform.py
parentb0c65c677f5298df8653df1e382b406bea420ba3 (diff)
[jwplatform] Improve subtitles extraction
Diffstat (limited to 'youtube_dl/extractor/jwplatform.py')
-rw-r--r--youtube_dl/extractor/jwplatform.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/youtube_dl/extractor/jwplatform.py b/youtube_dl/extractor/jwplatform.py
index 5d56e0a28..7037763cb 100644
--- a/youtube_dl/extractor/jwplatform.py
+++ b/youtube_dl/extractor/jwplatform.py
@@ -11,6 +11,7 @@ from ..utils import (
int_or_none,
js_to_json,
mimetype2ext,
+ urljoin,
)
@@ -110,10 +111,14 @@ class JWPlatformBaseIE(InfoExtractor):
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,