Skip to content

Commit

Permalink
Fix view count handling
Browse files Browse the repository at this point in the history
  • Loading branch information
absidue committed Dec 30, 2024
1 parent a2ec742 commit e6f10d9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/renderer/components/watch-video-info/watch-video-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default defineComponent({
},
viewCount: {
type: Number,
required: true
default: null
},
subscriptionCountText: {
type: String,
Expand Down Expand Up @@ -197,7 +197,7 @@ export default defineComponent({
},

parsedViewCount: function () {
if (this.hideVideoViews) {
if (this.hideVideoViews || this.viewCount == null) {
return null
}

Expand Down
2 changes: 1 addition & 1 deletion src/renderer/views/Watch/Watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ export default defineComponent({

// extract localised title first and fall back to the not localised one
this.videoTitle = result.primary_info?.title.text ?? result.basic_info.title
this.videoViewCount = result.basic_info.view_count ?? (result.primary_info.view_count ? extractNumberFromString(result.primary_info.view_count.text) : 0)
this.videoViewCount = result.basic_info.view_count ?? (result.primary_info.view_count ? extractNumberFromString(result.primary_info.view_count.text) : null)

this.channelId = result.basic_info.channel_id ?? result.secondary_info.owner?.author.id
this.channelName = result.basic_info.author ?? result.secondary_info.owner?.author.name
Expand Down

0 comments on commit e6f10d9

Please sign in to comment.