1
0
mirror of https://github.com/l1ving/youtube-dl synced 2025-03-10 17:07:18 +08:00

adding option for views extraction

This commit is contained in:
Avichai 2020-03-11 18:48:24 +02:00
parent 1f52df87c3
commit 2b594af6f0

View File

@ -490,7 +490,7 @@ class FacebookIE(InfoExtractor):
self._search_regex(r'[\'\"]viewerCount[\'\"]\s*:\s*(\d+)', tahoe_data.primary, 'views', fatal=False)
)
else:
view_count = parse_count(self._extract_meta_count(['postViewCount', 'viewCount'], webpage, tahoe_data, 'likes'))
view_count = parse_count(self._extract_views(webpage, tahoe_data))
other_posts_view_count = parse_count(self._extract_meta_count(['otherPostsViewCount'], webpage, tahoe_data, 'other_post_views'))
likes_count = parse_count(self._extract_likes(webpage, tahoe_data))
@ -552,6 +552,15 @@ class FacebookIE(InfoExtractor):
if values:
return values[-1]
def _extract_views(self, webpage, tahoe_data):
value = self._extract_meta_count(['postViewCount', 'viewCount'], webpage, tahoe_data, 'likes')
if value:
return value
values = re.findall(r'(\d+\w?) Views', tahoe_data.secondary)
if values:
return values[-1]
def _real_extract(self, url):
video_id = self._match_id(url)