From 9dfd27538ef8b9c19e54bdb0f56f7e79ad33c75d Mon Sep 17 00:00:00 2001 From: Moritz Barsnick Date: Thu, 3 Jan 2019 17:00:28 +0100 Subject: [PATCH] [facebook] extract better titles (fixes #14156) This now tries to find the primary title, which is displayed in bold above the previously extracted full text. This is the title which is also displayed - if given by the uploader - to the top left when displaying a video fullscreen. For videos posted to groups, the extractor still doesn't use the given comment text as a title, and now extracts e.g. "[group name] Public Group" instead of "[group name] has 481 members", which may or may not be better. --- youtube_dl/extractor/facebook.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/youtube_dl/extractor/facebook.py b/youtube_dl/extractor/facebook.py index 74954049d..5b3195335 100644 --- a/youtube_dl/extractor/facebook.py +++ b/youtube_dl/extractor/facebook.py @@ -410,6 +410,10 @@ class FacebookIE(InfoExtractor): video_title = self._html_search_regex( r']*class="uiHeaderTitle"[^>]*>([^<]*)', webpage, 'title', default=None) + if not video_title: + video_title = self._html_search_regex( + r'(?s)]*>([^<]*)(?: \| Facebook)', + webpage, 'title', default=None) if not video_title: video_title = self._html_search_regex( r'(?s)(.*?)',