mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-27 07:06:52 +01:00
add support for subtitles
This commit is contained in:
parent
f86f46a010
commit
c640231330
@ -25,9 +25,11 @@ def _real_extract(self, url):
|
|||||||
video_url = self._html_search_regex(r'"([^\"]*\.m3u8)"', webpage_video, 'video URL')
|
video_url = self._html_search_regex(r'"([^\"]*\.m3u8)"', webpage_video, 'video URL')
|
||||||
|
|
||||||
formats = []
|
formats = []
|
||||||
formats.extend(self._extract_m3u8_formats(
|
subtitles = {}
|
||||||
video_url, video_id, ext='mp4', m3u8_id='hls'),
|
|
||||||
note='Downloading HD m3u8 information', errnote='Unable to download HD m3u8 information')
|
fmts, subs = self._extract_m3u8_formats_and_subtitles(video_url, video_id, 'mp4', fatal=False)
|
||||||
|
formats.extend(fmts)
|
||||||
|
self._merge_subtitles(subs, target=subtitles)
|
||||||
|
|
||||||
title = self._og_search_title(webpage) or self._html_search_regex(r'<title>(.+?)</title>', webpage, 'title')
|
title = self._og_search_title(webpage) or self._html_search_regex(r'<title>(.+?)</title>', webpage, 'title')
|
||||||
|
|
||||||
@ -35,4 +37,5 @@ def _real_extract(self, url):
|
|||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': title,
|
'title': title,
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
|
'subtitles': subtitles,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user