mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-07 20:30:41 -05:00
[wdr] fix subtitle extraction
This commit is contained in:
parent
974311b5aa
commit
6de54568d4
1 changed files with 9 additions and 8 deletions
|
@ -45,9 +45,18 @@ def _real_extract(self, url):
|
||||||
media_resource = metadata['mediaResource']
|
media_resource = metadata['mediaResource']
|
||||||
|
|
||||||
formats = []
|
formats = []
|
||||||
|
subtitles = {}
|
||||||
|
|
||||||
# check if the metadata contains a direct URL to a file
|
# check if the metadata contains a direct URL to a file
|
||||||
for kind, media_resource in media_resource.items():
|
for kind, media_resource in media_resource.items():
|
||||||
|
if kind == 'captionsHash':
|
||||||
|
for ext, url in media_resource.items():
|
||||||
|
subtitles.setdefault('de', []).append({
|
||||||
|
'url': url,
|
||||||
|
'ext': ext,
|
||||||
|
})
|
||||||
|
continue
|
||||||
|
|
||||||
if kind not in ('dflt', 'alt'):
|
if kind not in ('dflt', 'alt'):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
@ -81,14 +90,6 @@ def _real_extract(self, url):
|
||||||
|
|
||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
|
|
||||||
subtitles = {}
|
|
||||||
caption_url = media_resource.get('captionURL')
|
|
||||||
if caption_url:
|
|
||||||
subtitles['de'] = [{
|
|
||||||
'url': caption_url,
|
|
||||||
'ext': 'ttml',
|
|
||||||
}]
|
|
||||||
|
|
||||||
title = tracker_data['trackerClipTitle']
|
title = tracker_data['trackerClipTitle']
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
Loading…
Reference in a new issue