mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-14 03:11:24 +01:00
Compare commits
No commits in common. "5a63b0ec715a7e6879ebe16bef6bdd0d87d7ec7a" and "024f81eb4813516def5d11e25fc93593a977fd77" have entirely different histories.
5a63b0ec71
...
024f81eb48
|
@ -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', '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
|
||||
automatic_captions = {}
|
||||
subtitles = {}
|
||||
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):
|
||||
if len(captions) > 1:
|
||||
captions = sorted(captions, key=lambda c: (c['locale'] != locale, c['locale']))
|
||||
for c in captions:
|
||||
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'],
|
||||
'name': (c['localized_language']
|
||||
+ (' (' + c['localized_country'] + ')' if c['localized_country'] else '')
|
||||
|
|
Loading…
Reference in New Issue
Block a user