From 7c0abfccd78a6c291d898f898d73a4f16170e2a9 Mon Sep 17 00:00:00 2001 From: absidue <48293849+absidue@users.noreply.github.com> Date: Sun, 30 Apr 2023 22:21:57 +0200 Subject: [PATCH] fix(VideoInfo): Use microformat view_count when videoDetails view_count is NaN (#393) --- src/parser/youtube/VideoInfo.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/parser/youtube/VideoInfo.ts b/src/parser/youtube/VideoInfo.ts index 255a21be6..d7977f18b 100644 --- a/src/parser/youtube/VideoInfo.ts +++ b/src/parser/youtube/VideoInfo.ts @@ -83,7 +83,8 @@ class VideoInfo extends MediaInfo { is_family_safe: info.microformat?.is_family_safe, category: info.microformat?.is(PlayerMicroformat) ? info.microformat?.category : null, has_ypc_metadata: info.microformat?.is(PlayerMicroformat) ? info.microformat?.has_ypc_metadata : null, - start_timestamp: info.microformat?.is(PlayerMicroformat) ? info.microformat.start_timestamp : null + start_timestamp: info.microformat?.is(PlayerMicroformat) ? info.microformat.start_timestamp : null, + view_count: info.microformat?.is(PlayerMicroformat) && isNaN(info.video_details?.view_count as number) ? info.microformat.view_count : info.video_details?.view_count }, like_count: undefined as number | undefined, is_liked: undefined as boolean | undefined,