1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-06-27 17:08:32 +00:00
This commit is contained in:
Iuri Campos 2025-06-27 00:26:59 +01:00 committed by GitHub
commit 544135af46
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -32,6 +32,7 @@
class FacebookIE(InfoExtractor): class FacebookIE(InfoExtractor):
_MAX_TITLE_LENGTH = 20 # Maximum title length for the video
_VALID_URL = r'''(?x) _VALID_URL = r'''(?x)
(?: (?:
https?:// https?://
@ -541,6 +542,9 @@ def extract_metadata(webpage):
info_json_ld = self._search_json_ld(webpage, video_id, default={}) info_json_ld = self._search_json_ld(webpage, video_id, default={})
info_json_ld['title'] = (re.sub(r'\s*\|\s*Facebook$', '', title or info_json_ld.get('title') or page_title or '') info_json_ld['title'] = (re.sub(r'\s*\|\s*Facebook$', '', title or info_json_ld.get('title') or page_title or '')
or (description or '').replace('\n', ' ') or f'Facebook video #{video_id}') or (description or '').replace('\n', ' ') or f'Facebook video #{video_id}')
if len(info_json_ld.get('title')) > FacebookIE._MAX_TITLE_LENGTH:
self.report_warning(f'Truncating title to {FacebookIE._MAX_TITLE_LENGTH} characters')
info_json_ld['title'] = info_json_ld.get('title')[: FacebookIE._MAX_TITLE_LENGTH - 3] + '...'
return merge_dicts(info_json_ld, info_dict) return merge_dicts(info_json_ld, info_dict)
video_data = None video_data = None