1
0
Fork 0
mirror of https://github.com/blackjack4494/yt-dlc.git synced 2024-12-22 15:57:23 +00:00

[facebook] Make title optional (closes #12443)

This commit is contained in:
Sergey M․ 2017-03-14 00:37:39 +07:00
parent 9d08963022
commit 66bf351f80
No known key found for this signature in database
GPG key ID: 2C393E0F18A9236D

View file

@ -196,6 +196,10 @@ class FacebookIE(InfoExtractor):
}, { }, {
'url': 'https://www.facebookcorewwwi.onion/video.php?v=274175099429670', 'url': 'https://www.facebookcorewwwi.onion/video.php?v=274175099429670',
'only_matching': True, 'only_matching': True,
}, {
# no title
'url': 'https://www.facebook.com/onlycleverentertainment/videos/1947995502095005/',
'only_matching': True,
}] }]
@staticmethod @staticmethod
@ -353,15 +357,15 @@ class FacebookIE(InfoExtractor):
self._sort_formats(formats) self._sort_formats(formats)
video_title = self._html_search_regex( video_title = self._html_search_regex(
r'<h2\s+[^>]*class="uiHeaderTitle"[^>]*>([^<]*)</h2>', webpage, 'title', r'<h2\s+[^>]*class="uiHeaderTitle"[^>]*>([^<]*)</h2>', webpage,
default=None) 'title', default=None)
if not video_title: if not video_title:
video_title = self._html_search_regex( video_title = self._html_search_regex(
r'(?s)<span class="fbPhotosPhotoCaption".*?id="fbPhotoPageCaption"><span class="hasCaption">(.*?)</span>', r'(?s)<span class="fbPhotosPhotoCaption".*?id="fbPhotoPageCaption"><span class="hasCaption">(.*?)</span>',
webpage, 'alternative title', default=None) webpage, 'alternative title', default=None)
if not video_title: if not video_title:
video_title = self._html_search_meta( video_title = self._html_search_meta(
'description', webpage, 'title') '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: