1
0
mirror of https://github.com/l1ving/youtube-dl synced 2025-03-10 19:27:16 +08:00

adding option to extract comments count

This commit is contained in:
Avichai 2020-03-11 18:50:42 +02:00
parent 056baf9e9f
commit d003505adc

View File

@ -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))
comment_count = parse_count(self._extract_meta_count(['commentCount'], webpage, tahoe_data, 'shares'))
shares_count = parse_count(self._extract_shares(webpage, tahoe_data))
comment_count = parse_count(self._extract_comments_count(webpage, tahoe_data))
info_dict = {
'id': video_id,
@ -547,7 +547,6 @@ class FacebookIE(InfoExtractor):
if values:
return values[-1]
values = re.findall(r'[\'\"]\blikecount[\'\"]\s*:\s*(\d+)', tahoe_data.secondary)
if values:
return values[-1]
@ -565,6 +564,15 @@ class FacebookIE(InfoExtractor):
if values:
return values[-1]
def _extract_comments_count(self, webpage, tahoe_data):
value = self._extract_meta_count(['commentCount'], webpage, tahoe_data, 'comment_count')
if value:
return value
values = re.findall(r'Comments\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:
@ -599,7 +607,6 @@ class FacebookIE(InfoExtractor):
video_id, fatal_if_no_video=True)
return info_dict
class FacebookTahoeData:
def __init__(self, extractor, page, video_id):
self._page = page