mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-11 01:41:26 +01:00
Compare commits
3 Commits
024f81eb48
...
5a63b0ec71
Author | SHA1 | Date | |
---|---|---|---|
|
5a63b0ec71 | ||
|
ff849f1ddc | ||
|
8cc7f16d80 |
|
@ -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 '')
|
||||
|
|
Loading…
Reference in New Issue
Block a user