Skip to content

Commit

Permalink
[ie/youtube] Fix like_count extraction (yt-dlp#8763)
Browse files Browse the repository at this point in the history
Closes yt-dlp#8759
Authored by: Ganesh910
  • Loading branch information
pandeyganesha authored Dec 13, 2023
1 parent 298230e commit 6b5d93b
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions yt_dlp/extractor/youtube.py
Original file line number Diff line number Diff line change
Expand Up @@ -4480,14 +4480,13 @@ def process_language(container, base_url, lang_code, sub_name, query):
if mobj:
info[mobj.group('type') + '_count'] = str_to_int(mobj.group('count'))
break
sbr_tooltip = try_get(
vpir, lambda x: x['sentimentBar']['sentimentBarRenderer']['tooltip'])
if sbr_tooltip:
like_count, dislike_count = sbr_tooltip.split(' / ')
info.update({
'like_count': str_to_int(like_count),
'dislike_count': str_to_int(dislike_count),
})

info['like_count'] = traverse_obj(vpir, (
'videoActions', 'menuRenderer', 'topLevelButtons', ...,
'segmentedLikeDislikeButtonViewModel', 'likeButtonViewModel', 'likeButtonViewModel',
'toggleButtonViewModel', 'toggleButtonViewModel', 'defaultButtonViewModel',
'buttonViewModel', 'accessibilityText', {parse_count}), get_all=False)

vcr = traverse_obj(vpir, ('viewCount', 'videoViewCountRenderer'))
if vcr:
vc = self._get_count(vcr, 'viewCount')
Expand Down

0 comments on commit 6b5d93b

Please sign in to comment.