[facebook] extract subtitles(closes #22777)
authorRemita Amine <remitamine@gmail.com>
Tue, 22 Oct 2019 16:53:47 +0000 (17:53 +0100)
committerRemita Amine <remitamine@gmail.com>
Tue, 22 Oct 2019 16:59:14 +0000 (17:59 +0100)
youtube_dl/extractor/ceskatelevize.py
youtube_dl/extractor/facebook.py

index 1ec58f7d8d40d92eacb0aa723e49f189f118ffcd..7cb4efb746b5f7eae929ccd16993e530122d9ed3 100644 (file)
@@ -147,6 +147,8 @@ class CeskaTelevizeIE(InfoExtractor):
                 is_live = item.get('type') == 'LIVE'
                 formats = []
                 for format_id, stream_url in item.get('streamUrls', {}).items():
+                    if 'drmOnly=true' in stream_url:
+                        continue
                     if 'playerType=flash' in stream_url:
                         stream_formats = self._extract_m3u8_formats(
                             stream_url, playlist_id, 'mp4', 'm3u8_native',
index a56f85c216177810e2ea217dd4309aee6a453b00..c723726b77ed451d6effeda84408b97399dd6920 100644 (file)
@@ -379,6 +379,7 @@ class FacebookIE(InfoExtractor):
         if not video_data:
             raise ExtractorError('Cannot parse data')
 
+        subtitles = {}
         formats = []
         for f in video_data:
             format_id = f['stream_type']
@@ -402,6 +403,9 @@ class FacebookIE(InfoExtractor):
             if dash_manifest:
                 formats.extend(self._parse_mpd_formats(
                     compat_etree_fromstring(compat_urllib_parse_unquote_plus(dash_manifest))))
+            subtitles_src = f[0].get('subtitles_src')
+            if subtitles_src:
+                subtitles.setdefault('en', []).append({'url': subtitles_src})
         if not formats:
             raise ExtractorError('Cannot find video formats')
 
@@ -447,6 +451,7 @@ class FacebookIE(InfoExtractor):
             'timestamp': timestamp,
             'thumbnail': thumbnail,
             'view_count': view_count,
+            'subtitles': subtitles,
         }
 
         return webpage, info_dict