Skip to content

Commit

Permalink
fix(VideoInfo): Use microformat view_count when videoDetails view_cou…
Browse files Browse the repository at this point in the history
…nt is NaN (#393)
  • Loading branch information
absidue authored Apr 30, 2023
1 parent 8f50c66 commit 7c0abfc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/parser/youtube/VideoInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 7c0abfc

Please sign in to comment.