From 8ebd1ff488558c71a372d39be50c09b40ea380b5 Mon Sep 17 00:00:00 2001 From: bhodaya Date: Mon, 10 Aug 2020 14:14:20 +0300 Subject: [PATCH] generic title fix --- youtube_dl/extractor/facebook.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/youtube_dl/extractor/facebook.py b/youtube_dl/extractor/facebook.py index 8beffb22c..4088f6f84 100644 --- a/youtube_dl/extractor/facebook.py +++ b/youtube_dl/extractor/facebook.py @@ -692,8 +692,7 @@ class FacebookIE(InfoExtractor): if not self._valid_video_title(video_title): video_title = self._og_search_title(webpage, default=None) if not self._valid_video_title(video_title): - video_title = self._html_search_meta( - 'description', webpage, 'title', default=None) + video_title = self._resolve_description(webpage, tahoe_data) if not self._valid_video_title(video_title): values = re.findall(r'videoTitle"\s*:\s*"(.*?)"', tahoe_data.secondary) if values: @@ -816,7 +815,7 @@ class FacebookIE(InfoExtractor): def _valid_video_title(self, video_title): if video_title: video_title = video_title.lower() - return video_title and not u'log in or sign up to view' in video_title + return video_title and not u'log in or sign up to view' in video_title and not u'on facebook watch' in video_title def validate_webpage(self, webpage): m_msg = re.search(r'class="[^"]*uiInterstitialContent[^"]*">
(.*?)
', webpage) @@ -831,6 +830,11 @@ class FacebookIE(InfoExtractor): elif '>You must log in to continue' in webpage: self.raise_login_required() + def _resolve_description(self, webpage, tahoe_data): + description = self._html_search_meta( + 'description', webpage, 'title', default=None) + return description + class FacebookTahoeData: def __init__(self, extractor, page, video_id):