1
0
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:
Rico van Zelst
2025-05-08 15:01:34 +02:00
parent ebb4c3ed9a
commit 2bee48cffd
4 changed files with 5 additions and 4 deletions

View File

@@ -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')