Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect and properly error on DRM protected videos #6479

Merged
merged 2 commits into from
Dec 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
13 changes: 11 additions & 2 deletions 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 ?? extractNumberFromString(result.primary_info.view_count.text)
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 Expand Up @@ -509,7 +509,9 @@ export default defineComponent({
// The apostrophe is intentionally that one (char code 8217), because that is the one YouTube uses
const BOT_MESSAGE = 'Sign in to confirm you’re not a bot'

if (playabilityStatus.status === 'UNPLAYABLE' || playabilityStatus.status === 'LOGIN_REQUIRED') {
const isDrmProtected = result.streaming_data?.adaptive_formats.some(format => format.drm_families || format.drm_track_type)

if (playabilityStatus.status === 'UNPLAYABLE' || playabilityStatus.status === 'LOGIN_REQUIRED' || isDrmProtected) {
if (playabilityStatus.error_screen?.offer_id === 'sponsors_only_video') {
// Members-only videos can only be watched while logged into a Google account that is a paid channel member
// so there is no point trying any other backends as it will always fail
Expand All @@ -525,6 +527,13 @@ export default defineComponent({
this.isLoading = false
this.updateTitle()
return
} else if (isDrmProtected) {
// DRM protected videos (e.g. movies) cannot be played in FreeTube,
// as they require the proprietary and closed source Wideview CDM which is understandably not included in standard Electron builds
this.errorMessage = this.$t('Video.DRMProtected')
this.isLoading = false
this.updateTitle()
return
}

let errorText
Expand Down
1 change: 1 addition & 0 deletions static/locales/en-US.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,7 @@ Video:
IP block: 'YouTube has blocked your IP address from watching videos. Please try switching to a different VPN or proxy.'
MembersOnly: Members-only videos cannot be watched with FreeTube as they require Google login and paid membership to the uploader's channel.
AgeRestricted: Age-restricted videos cannot be watched with FreeTube as they require Google login and using an age-verified YouTube account.
DRMProtected: DRM protected videos cannot be played in FreeTube, as they require proprietary, closed source components. If you want to watch this video please watch it on the official YouTube website in a DRM enabled web browser.
More Options: More Options
Mark As Watched: Mark As Watched
Remove From History: Remove From History
Expand Down
Loading