[facebook] Extract description and fix title

Partially fixes: #453
This commit is contained in:
pukkandan 2021-07-02 07:44:11 +05:30
parent 6b6c16ca6c
commit b1e60d1806

View File

@ -629,16 +629,11 @@ class FacebookIE(InfoExtractor):
process_formats(formats) process_formats(formats)
description = self._html_search_meta('description', webpage, default=None)
video_title = self._html_search_regex( video_title = self._html_search_regex(
r'<h2\s+[^>]*class="uiHeaderTitle"[^>]*>([^<]*)</h2>', webpage, (r'<h2\s+[^>]*class="uiHeaderTitle"[^>]*>([^<]*)</h2>',
'title', default=None) r'(?s)<span class="fbPhotosPhotoCaption".*?id="fbPhotoPageCaption"><span class="hasCaption">(.*?)</span>'),
if not video_title: webpage, 'title', default=None) or self._og_search_title(webpage, default=None) or description
video_title = self._html_search_regex(
r'(?s)<span class="fbPhotosPhotoCaption".*?id="fbPhotoPageCaption"><span class="hasCaption">(.*?)</span>',
webpage, 'alternative title', default=None)
if not video_title:
video_title = self._html_search_meta(
'description', webpage, 'title', default=None)
if video_title: if video_title:
video_title = limit_length(video_title, 80) video_title = limit_length(video_title, 80)
else: else:
@ -662,6 +657,7 @@ class FacebookIE(InfoExtractor):
'formats': formats, 'formats': formats,
'uploader': uploader, 'uploader': uploader,
'timestamp': timestamp, 'timestamp': timestamp,
'description': description,
'thumbnail': thumbnail, 'thumbnail': thumbnail,
'view_count': view_count, 'view_count': view_count,
'subtitles': subtitles, 'subtitles': subtitles,