mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-12-14 04:05:16 +00:00
[ie/youtube] Make short views type an extractor argument
- Add `short_views_type` as an extractor argument to address [#13122](https://github.com/yt-dlp/yt-dlp/issues/13122#issuecomment-2862720272)
This commit is contained in:
@@ -3999,6 +3999,8 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
|
||||
'toggleButtonViewModel', 'toggleButtonViewModel', 'defaultButtonViewModel',
|
||||
'buttonViewModel', 'accessibilityText', {parse_count}), get_all=False)
|
||||
|
||||
short_views_type = self._configuration_arg('short_views_type', ['engaged'])[0].lower()
|
||||
|
||||
vcr = traverse_obj(vpir, ('viewCount', 'videoViewCountRenderer'))
|
||||
if vcr:
|
||||
vc = self._get_count(vcr, 'viewCount')
|
||||
@@ -4007,8 +4009,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
|
||||
info['concurrent_view_count'] = vc
|
||||
elif info.get('view_count') is None:
|
||||
info['view_count'] = vc
|
||||
elif get_first(microformats, 'isShortsEligible'):
|
||||
info['engaged_view_count'] = info['view_count']
|
||||
elif get_first(microformats, 'isShortsEligible') and short_views_type == 'seen':
|
||||
info['view_count'] = vc
|
||||
|
||||
vsir = get_first(contents, 'videoSecondaryInfoRenderer')
|
||||
|
||||
Reference in New Issue
Block a user