Compare commits

...

3 Commits

Author SHA1 Message Date
kclauhk
5a63b0ec71
Update yt_dlp/extractor/facebook.py
Co-authored-by: sepro <4618135+seproDev@users.noreply.github.com>
2023-11-01 19:03:34 +08:00
kclauhk
ff849f1ddc
Update yt_dlp/extractor/facebook.py
Co-authored-by: sepro <4618135+seproDev@users.noreply.github.com>
2023-11-01 19:03:26 +08:00
kclauhk
8cc7f16d80
Update yt_dlp/extractor/facebook.py
Co-authored-by: sepro <4618135+seproDev@users.noreply.github.com>
2023-11-01 19:03:14 +08:00

View File

@ -423,18 +423,18 @@ class FacebookIE(InfoExtractor):
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 {}
locale = self._html_search_meta(['og:locale', 'twitter:locale'], webpage, 'locale', default='en_US')
captions = get_first(snippet, ('video_available_captions_locales')) or get_first(snippet, ('captions_url')) or None
captions = get_first(snippet, 'video_available_captions_locales', 'captions_url')
useIsVideoBroadcast = get_first(snippet, ('is_video_broadcast')) or False
automatic_captions = {}
subtitles = {}
if isinstance(captions, str):
subtitles[locale] = [{'ext': self._search_regex(r'\.(\w{3,})\?', captions, 'captions_ext', default='srt'), 'url': captions}]
subtitles[locale] = [{'ext': determine_ext(captions, default_ext='srt'), 'url': captions}]
elif isinstance(captions, list):
if len(captions) > 1:
captions = sorted(captions, key=lambda c: (c['locale'] != locale, c['locale']))
for c in captions:
s = {
'ext': self._search_regex(r'\.(\w{3,})\?', c['captions_url'], 'captions_ext', default='srt'),
'ext': determine_ext(c['captions_url'], default_ext='srt'),
'url': c['captions_url'],
'name': (c['localized_language']
+ (' (' + c['localized_country'] + ')' if c['localized_country'] else '')