Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
1552da7
Show content disclosure and AI labels
caetano-dev Sep 5, 2026
4644346
Improve maintainability
caetano-dev Sep 5, 2026
7ba036d
Area label, move description, delete unused translation
caetano-dev Sep 5, 2026
22307a0
Merge branch 'development' into feat/AI_labels
caetano-dev Sep 5, 2026
497aa2f
Use pipe in showAiBadge
caetano-dev Sep 5, 2026
d1e0460
Use hasAI
caetano-dev Sep 5, 2026
9b3bd0d
Add translations for headers and descriptions
caetano-dev Sep 5, 2026
3ddca87
Remove extractAiBadgeTooltip function and use localized version
caetano-dev Sep 5, 2026
9e4ca70
Inline string
caetano-dev Sep 5, 2026
a3b1df0
Refactor content disclosure extraction
caetano-dev Sep 6, 2026
835fca6
Update src/renderer/components/WatchVideoInfo/WatchVideoInfo.vue
caetano-dev Sep 6, 2026
19a68f6
Update src/renderer/components/WatchVideoDescription/WatchVideoDescri…
caetano-dev Sep 6, 2026
07bd5b7
remove faRobot icon
caetano-dev Sep 6, 2026
3faec40
Add disclosure attribution
caetano-dev Sep 8, 2026
885bbe4
Remove translations, CustomHowThisWasMadeSectionView, rename classes
caetano-dev Sep 12, 2026
9d82086
Remove dormant attributionText
caetano-dev Sep 12, 2026
592cc90
Merge branch 'development' into feat/AI_labels
caetano-dev Oct 2, 2026
ca2464f
Display attribution text and new youtube.js version
caetano-dev Oct 2, 2026
e0119d9
Merge branch 'development' into feat/AI_labels
caetano-dev Oct 2, 2026
5eacf8c
yarn lock
caetano-dev Oct 2, 2026
6939b8f
chore: remove yarn.lock
caetano-dev Oct 2, 2026
51d279b
Use regex instead of Array.some()
caetano-dev Oct 3, 2026
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
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,34 @@
.license {
margin-block: 1em;
}

.contentDisclosureSection {
margin-block-start: 1.5em;
}

.contentDisclosureTitle {
font-size: 20px;
font-weight: 600;
margin-block-end: 12px;
}

.contentDisclosureHeader {
font-weight: 600;
font-size: 15px;
margin-block-end: 4px;
}

.contentDisclosureBody,
.contentDisclosureAttribution {
font-size: 15px;
line-height: 1.4;
opacity: 0.9;
}

.contentDisclosureAttribution {
margin-block-start: 6px;
}

.contentDisclosureItem + .contentDisclosureItem {
margin-block-start: 12px;
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<FtCard
v-if="shownDescription.length > 0"
v-if="shownDescription.length > 0 || showHowThisWasMade"
:class="{ videoDescription: true, short: !showFullDescription }"
>
<span
Expand All @@ -14,13 +14,43 @@
{{ $t("Description.Expand Description") }}
</span>
<FtTimestampCatcher
v-if="shownDescription.length > 0"
ref="descriptionContainer"
class="description"
:input-html="processedShownDescription"
:link-tab-index="linkTabIndex"
@timestamp-event="onTimestamp"
@click="expandDescriptionWithClick"
/>
<div
v-if="showHowThisWasMade && showFullDescription"
class="contentDisclosureSection"
>
<div class="contentDisclosureTitle">
{{ t('Video.How this was made') }}
</div>
<div
v-for="(item, index) in contentDisclosures"
:key="index"
class="contentDisclosureItem"
>
<div class="contentDisclosureHeader">
{{ item.label }}
</div>
<div
v-if="item.description"
class="contentDisclosureBody"
>
{{ item.description }}
</div>
<div
v-if="item.attribution"
class="contentDisclosureAttribution"
>
{{ item.attribution }}
</div>
</div>
</div>
<bdi
v-if="license && showFullDescription"
class="license"
Expand All @@ -44,6 +74,7 @@
import autolinker from 'autolinker'

import { onMounted, ref, computed, useTemplateRef } from 'vue'
import { useI18n } from 'vue-i18n'
import FtCard from '../ft-card/ft-card.vue'
import FtTimestampCatcher from '../FtTimestampCatcher.vue'

Expand All @@ -59,9 +90,17 @@ const props = defineProps({
license: {
type: String,
default: null,
},
contentDisclosures: {
type: Array,
default: null
}
})

const { t } = useI18n()

const showHowThisWasMade = computed(() => (props.contentDisclosures?.length ?? 0) > 0)

const emit = defineEmits(['timestamp-event'])

let shownDescription = ''
Expand Down Expand Up @@ -139,6 +178,13 @@ function isShortDescription() {
}

onMounted(() => {
// There is no description, so do not show the controls
if (shownDescription.length === 0) {
Comment thread
caetano-dev marked this conversation as resolved.
showFullDescription.value = true
showControls.value = false
return
}

// To verify whether or not the description is too short for displaying
// description controls, we need to check the description's dimensions.
// The only way to make this work is to check on mount.
Expand Down
14 changes: 12 additions & 2 deletions src/renderer/components/WatchVideoInfo/WatchVideoInfo.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,20 @@
gap: 10px;
}

.unlistedBadge {
.videoBadges {
display: flex;
flex-wrap: wrap;
gap: 6px;
margin-block-start: 4px;
}

.unlistedBadge,
.aiBadge {
background-color: var(--secondary-card-bg-color);
border-radius: 5px;
display: inline;
display: inline-flex;
align-items: center;
gap: 5px;
padding-inline: 5px;
padding-block: 2px;
white-space: nowrap;
Expand Down
30 changes: 27 additions & 3 deletions src/renderer/components/WatchVideoInfo/WatchVideoInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,24 @@
{{ title }}
</h1>
<div
v-if="isUnlisted"
class="unlistedBadge"
v-if="isUnlisted || showAiBadge"
class="videoBadges"
>
{{ t('Video.Unlisted') }}
<div
v-if="isUnlisted"
class="unlistedBadge"
>
{{ t('Video.Unlisted') }}
</div>
<div
v-if="showAiBadge"
class="aiBadge"
:title="t('Video.AI: Content was made with AI')"
:aria-label="t('Video.AI: Content was made with AI')"
>
<FontAwesomeIcon :icon="['fas', 'circle-info']" />
<span>{{ t('Video.AI') }}</span>
</div>
</div>
</div>
<div class="videoMetrics">
Expand Down Expand Up @@ -231,6 +245,10 @@ const props = defineProps({
type: Boolean,
required: false
},
contentDisclosures: {
type: Array,
default: null
},
canSaveWatchedProgress: {
type: Boolean,
required: true
Expand All @@ -247,6 +265,12 @@ const USING_ELECTRON = process.env.IS_ELECTRON

const { locale, t } = useI18n()

const showAiBadge = computed(() => {
const LABEL_REGEX = /\b(ai|artificial intelligence|altered|synthetic)\b/i

return props.contentDisclosures?.some(item => LABEL_REGEX.test(item.label)) || false
})

/** @type {import('vue').ComputedRef<boolean>} */
const hideSharingActions = computed(() => store.getters.getHideSharingActions)

Expand Down
32 changes: 31 additions & 1 deletion src/renderer/helpers/api/local.js
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ export async function getLocalVideoInfo(id) {

if ((info.playability_status.status === 'UNPLAYABLE' && (!hasTrailer || trailerIsAgeRestricted)) ||
info.playability_status.status === 'LOGIN_REQUIRED') {
return { info, poToken: undefined, clientInfo }
return { info, poToken: undefined, clientInfo, contentDisclosures: extractLocalContentDisclosures(info) }
}

if (hasTrailer && info.playability_status.status !== 'OK') {
Expand Down Expand Up @@ -769,9 +769,39 @@ export async function getLocalVideoInfo(id) {
poToken: contentPoToken,
clientInfo,
adEndTimeUnixMs,
contentDisclosures: extractLocalContentDisclosures(info),
}
}

/**
* Extracts content disclosures ('How this was made') from YouTube VideoInfo response
* @param {import('youtubei.js').YT.VideoInfo} info
* @returns {{ label: string, description: string, attribution: string }[] | null}
*/
export function extractLocalContentDisclosures(info) {
Comment thread
caetano-dev marked this conversation as resolved.
if (info?.page?.[1]?.engagement_panels) {
const structuredDescPanel = info.page[1].engagement_panels.find(
panel => panel.target_id === 'engagement-panel-structured-description'
)

if (structuredDescPanel?.content?.is(YTNodes.StructuredDescriptionContent)) {
const LEARN_MORE_REGEX = /\s*Learn more\.?$/i

const items = structuredDescPanel.content.items
.filterType(YTNodes.HowThisWasMadeSectionView)
.map(item => ({
label: item.body_header?.text ?? '',
description: item.body_text?.text?.replace(LEARN_MORE_REGEX, '').trim() ?? '',
attribution: item.attribution_text?.text ?? '',
}))

return items.length > 0 ? items : null
}
}

return null
}

/**
* @type {object}
*/
Expand Down
6 changes: 5 additions & 1 deletion src/renderer/views/Watch/Watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ export default defineComponent({
/** @type {string[]|null} */
customErrorIcon: null,
videoGenreIsMusic: false,
contentDisclosures: null,
/** @type {Date|null} */
streamingDataExpiryDate: null,
currentPlaybackRate: null,
Expand Down Expand Up @@ -401,6 +402,7 @@ export default defineComponent({
this.videoDescription = ''
this.videoDescriptionHtml = ''
this.license = ''
this.contentDisclosures = null
this.videoViewCount = 0
this.videoLikeCount = 0
this.videoDislikeCount = 0
Expand Down Expand Up @@ -503,7 +505,8 @@ export default defineComponent({

try {
const videoInfo = await getLocalVideoInfo(this.videoId)
const { info: result, poToken, clientInfo, adEndTimeUnixMs } = videoInfo
const { info: result, poToken, clientInfo, adEndTimeUnixMs, contentDisclosures } = videoInfo
this.contentDisclosures = contentDisclosures || null

const playabilityStatus = result.playability_status
this.playabilityStatus = playabilityStatus.status
Expand Down Expand Up @@ -1033,6 +1036,7 @@ export default defineComponent({
this.isFamilyFriendly = result.isFamilyFriendly
this.isPostLiveDvr = !!result.isPostLiveDvr
this.isUnlisted = !result.isListed
this.contentDisclosures = null

this.captions = sortCaptions(result.captions.map(caption => {
return {
Expand Down
2 changes: 2 additions & 0 deletions src/renderer/views/Watch/Watch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@
:video-thumbnail="thumbnail"
:in-user-playlist="!!selectedUserPlaylist"
:is-unlisted="isUnlisted"
:content-disclosures="contentDisclosures"
:can-save-watched-progress="canSaveWatchProgress"
class="watchVideo"
:class="{ theatreWatchVideo: useTheatreMode }"
Expand All @@ -173,6 +174,7 @@
:description="videoDescription"
:description-html="videoDescriptionHtml"
:license="license"
:content-disclosures="contentDisclosures"
class="watchVideo"
:class="{ theatreWatchVideo: useTheatreMode }"
@timestamp-event="changeTimestamp"
Expand Down
3 changes: 3 additions & 0 deletions static/locales/en-US.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -902,6 +902,9 @@ Video:
Premieres: Premieres
Upcoming: Upcoming
Unlisted: Unlisted
AI: AI
'AI: Content was made with AI': 'AI: Content was made with AI'
How this was made: How this was made
Station: Station
Premiere: Premiere
Live: Live
Expand Down
Loading