mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-27 02:42:30 +00:00
[extractor/youtube] Fix video like count extraction
Support new combined button layout Authored by: coletdjnz
This commit is contained in:
parent
ae1035646a
commit
3ffb2f5bea
@ -3911,19 +3911,24 @@ def process_language(container, base_url, lang_code, sub_name, query):
|
|||||||
vpir,
|
vpir,
|
||||||
lambda x: x['videoActions']['menuRenderer']['topLevelButtons'],
|
lambda x: x['videoActions']['menuRenderer']['topLevelButtons'],
|
||||||
list) or []):
|
list) or []):
|
||||||
tbr = tlb.get('toggleButtonRenderer') or {}
|
tbrs = variadic(
|
||||||
for getter, regex in [(
|
traverse_obj(
|
||||||
lambda x: x['defaultText']['accessibility']['accessibilityData'],
|
tlb, 'toggleButtonRenderer',
|
||||||
r'(?P<count>[\d,]+)\s*(?P<type>(?:dis)?like)'), ([
|
('segmentedLikeDislikeButtonRenderer', ..., 'toggleButtonRenderer'),
|
||||||
lambda x: x['accessibility'],
|
default=[]))
|
||||||
lambda x: x['accessibilityData']['accessibilityData'],
|
for tbr in tbrs:
|
||||||
], r'(?P<type>(?:dis)?like) this video along with (?P<count>[\d,]+) other people')]:
|
for getter, regex in [(
|
||||||
label = (try_get(tbr, getter, dict) or {}).get('label')
|
lambda x: x['defaultText']['accessibility']['accessibilityData'],
|
||||||
if label:
|
r'(?P<count>[\d,]+)\s*(?P<type>(?:dis)?like)'), ([
|
||||||
mobj = re.match(regex, label)
|
lambda x: x['accessibility'],
|
||||||
if mobj:
|
lambda x: x['accessibilityData']['accessibilityData'],
|
||||||
info[mobj.group('type') + '_count'] = str_to_int(mobj.group('count'))
|
], r'(?P<type>(?:dis)?like) this video along with (?P<count>[\d,]+) other people')]:
|
||||||
break
|
label = (try_get(tbr, getter, dict) or {}).get('label')
|
||||||
|
if label:
|
||||||
|
mobj = re.match(regex, label)
|
||||||
|
if mobj:
|
||||||
|
info[mobj.group('type') + '_count'] = str_to_int(mobj.group('count'))
|
||||||
|
break
|
||||||
sbr_tooltip = try_get(
|
sbr_tooltip = try_get(
|
||||||
vpir, lambda x: x['sentimentBar']['sentimentBarRenderer']['tooltip'])
|
vpir, lambda x: x['sentimentBar']['sentimentBarRenderer']['tooltip'])
|
||||||
if sbr_tooltip:
|
if sbr_tooltip:
|
||||||
|
Loading…
Reference in New Issue
Block a user