Compare commits

..

No commits in common. "5a63b0ec715a7e6879ebe16bef6bdd0d87d7ec7a" and "024f81eb4813516def5d11e25fc93593a977fd77" have entirely different histories.

View File

@ -423,18 +423,18 @@ class FacebookIE(InfoExtractor):
snippet = traverse_obj(post, (..., 'video', ..., 'attachments', ..., lambda k, v: ( snippet = traverse_obj(post, (..., 'video', ..., 'attachments', ..., lambda k, v: (
k == 'media' and str(v['id']) == video_id and v['__typename'] == 'Video')), expected_type=dict) or {} k == 'media' and str(v['id']) == video_id and v['__typename'] == 'Video')), expected_type=dict) or {}
locale = self._html_search_meta(['og:locale', 'twitter:locale'], webpage, 'locale', default='en_US') locale = self._html_search_meta(['og:locale', 'twitter:locale'], webpage, 'locale', default='en_US')
captions = get_first(snippet, 'video_available_captions_locales', 'captions_url') captions = get_first(snippet, ('video_available_captions_locales')) or get_first(snippet, ('captions_url')) or None
useIsVideoBroadcast = get_first(snippet, ('is_video_broadcast')) or False useIsVideoBroadcast = get_first(snippet, ('is_video_broadcast')) or False
automatic_captions = {} automatic_captions = {}
subtitles = {} subtitles = {}
if isinstance(captions, str): if isinstance(captions, str):
subtitles[locale] = [{'ext': determine_ext(captions, default_ext='srt'), 'url': captions}] subtitles[locale] = [{'ext': self._search_regex(r'\.(\w{3,})\?', captions, 'captions_ext', default='srt'), 'url': captions}]
elif isinstance(captions, list): elif isinstance(captions, list):
if len(captions) > 1: if len(captions) > 1:
captions = sorted(captions, key=lambda c: (c['locale'] != locale, c['locale'])) captions = sorted(captions, key=lambda c: (c['locale'] != locale, c['locale']))
for c in captions: for c in captions:
s = { s = {
'ext': determine_ext(c['captions_url'], default_ext='srt'), 'ext': self._search_regex(r'\.(\w{3,})\?', c['captions_url'], 'captions_ext', default='srt'),
'url': c['captions_url'], 'url': c['captions_url'],
'name': (c['localized_language'] 'name': (c['localized_language']
+ (' (' + c['localized_country'] + ')' if c['localized_country'] else '') + (' (' + c['localized_country'] + ')' if c['localized_country'] else '')