From 056baf9e9fa0f3d1fa5631415873cfacf6b49a7e Mon Sep 17 00:00:00 2001 From: Avichai Date: Wed, 11 Mar 2020 18:50:13 +0200 Subject: [PATCH] adding option to shares extraction --- youtube_dl/extractor/facebook.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/youtube_dl/extractor/facebook.py b/youtube_dl/extractor/facebook.py index b41c040dc..4fe9bd01a 100644 --- a/youtube_dl/extractor/facebook.py +++ b/youtube_dl/extractor/facebook.py @@ -494,8 +494,8 @@ class FacebookIE(InfoExtractor): 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)) - shares_count = parse_count(self._extract_meta_count(['sharecount'], webpage, tahoe_data, 'shares')) comment_count = parse_count(self._extract_meta_count(['commentCount'], webpage, tahoe_data, 'shares')) + shares_count = parse_count(self._extract_shares(webpage, tahoe_data)) info_dict = { 'id': video_id, @@ -556,6 +556,15 @@ class FacebookIE(InfoExtractor): if values: return values[-1] + def _extract_shares(self, webpage, tahoe_data): + value = self._extract_meta_count(['sharecount'], webpage, tahoe_data, 'shares') + if value: + return value + a = r'(\d+\w) Views' + values = re.findall(r'"share_count"\s*:\s*{\s*"count"\s*:\s*(\d+)', tahoe_data.secondary) + 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: