Skip to content
This repository has been archived by the owner on Sep 20, 2023. It is now read-only.

Commit

Permalink
Add Check for Premium content
Browse files Browse the repository at this point in the history
  • Loading branch information
PrestonN committed Apr 30, 2021
1 parent 2ac5ebd commit 5606105
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion app/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ class YoutubeGrabberHelper {
let video
let liveNow = false
let premiere = false
let premium = false
let viewCount
let viewCountText
let lengthSeconds = 0
Expand Down Expand Up @@ -131,6 +132,12 @@ class YoutubeGrabberHelper {
viewCountText = '0 views'
const premiereDate = new Date(parseInt(video.upcomingEventData.startTime * 1000))
publishedText = premiereDate.toLocaleString()
} else if (typeof (video.viewCountText) === 'undefined') {
premium = true
publishedText = video.publishedTimeText.simpleText
durationText = 'PREMIERE'
viewCount = 0
viewCountText = '0 views'
} else {
viewCount = parseInt(video.viewCountText.simpleText.split(' ')[0].split(',').join(''))
viewCountText = video.viewCountText.simpleText
Expand Down Expand Up @@ -171,7 +178,8 @@ class YoutubeGrabberHelper {
durationText: durationText,
lengthSeconds: lengthSeconds,
liveNow: liveNow,
premiere: premiere
premiere: premiere,
premium: premium
}
}

Expand Down

0 comments on commit 5606105

Please sign in to comment.