[extractor/youtube] Fix video like count extraction

Support new combined button layout
Authored by: coletdjnz
This commit is contained in:
coletdjnz 2022-09-09 12:34:39 +12:00
parent ae1035646a
commit 3ffb2f5bea
No known key found for this signature in database
GPG key ID: 91984263BB39894A

View file

@ -3911,7 +3911,12 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
vpir,
lambda x: x['videoActions']['menuRenderer']['topLevelButtons'],
list) or []):
tbr = tlb.get('toggleButtonRenderer') or {}
tbrs = variadic(
traverse_obj(
tlb, 'toggleButtonRenderer',
('segmentedLikeDislikeButtonRenderer', ..., 'toggleButtonRenderer'),
default=[]))
for tbr in tbrs:
for getter, regex in [(
lambda x: x['defaultText']['accessibility']['accessibilityData'],
r'(?P<count>[\d,]+)\s*(?P<type>(?:dis)?like)'), ([