Skip to content

Commit

Permalink
[facebook] extract subtitles(closes #22777)
Browse files Browse the repository at this point in the history
  • Loading branch information
remitamine committed Oct 22, 2019
1 parent 0c2d10d commit 07154c7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions youtube_dl/extractor/ceskatelevize.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ def _real_extract(self, url):
is_live = item.get('type') == 'LIVE'
formats = []
for format_id, stream_url in item.get('streamUrls', {}).items():
if 'drmOnly=true' in stream_url:

This comment has been minimized.

Copy link
@kasal

kasal Nov 6, 2019

With this change, I cannot extract any video from ceskatelevize.cz, not only the AES encrypted ones.

This comment has been minimized.

Copy link
@remitamine

remitamine Nov 6, 2019

Author Collaborator

provide an example that is not DRM protected.

This comment has been minimized.

Copy link
@kasal

kasal Nov 6, 2019

I'm sorry, it was a mistake on my side. It seems that all the URL's I tried were SAMPLE AES encoded.

But most of the newly added videos seem to be encoded by SAMPLE AES. The key must be available somewhere, as all the videos are available through the web player. (Ceska televize doesn't offer any subscription.)

continue
if 'playerType=flash' in stream_url:
stream_formats = self._extract_m3u8_formats(
stream_url, playlist_id, 'mp4', 'm3u8_native',
Expand Down
5 changes: 5 additions & 0 deletions youtube_dl/extractor/facebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,7 @@ def extract_from_jsmods_instances(js_data):
if not video_data:
raise ExtractorError('Cannot parse data')

subtitles = {}
formats = []
for f in video_data:
format_id = f['stream_type']
Expand All @@ -402,6 +403,9 @@ def extract_from_jsmods_instances(js_data):
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')

Expand Down Expand Up @@ -447,6 +451,7 @@ def extract_from_jsmods_instances(js_data):
'timestamp': timestamp,
'thumbnail': thumbnail,
'view_count': view_count,
'subtitles': subtitles,
}

return webpage, info_dict
Expand Down

0 comments on commit 07154c7

Please sign in to comment.