Skip to content
Draft
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
22 changes: 11 additions & 11 deletions src/renderer/helpers/api/local.js
Original file line number Diff line number Diff line change
Expand Up @@ -1039,7 +1039,7 @@ export function parseShort(short, channelId, channelName) {
return {
type: 'video',
videoId: reelItem.id,
title: reelItem.title.text,
title: reelItem.title.text?.trim(),
author: channelName,
authorId: channelId,
viewCount: reelItem.views.isEmpty() ? null : parseLocalSubscriberCount(reelItem.views.text),
Expand All @@ -1052,7 +1052,7 @@ export function parseShort(short, channelId, channelName) {
return {
type: 'video',
videoId: shortsLockupView.on_tap_endpoint.payload.videoId,
title: shortsLockupView.overlay_metadata.primary_text.text,
title: shortsLockupView.overlay_metadata.primary_text.text?.trim(),
author: channelName,
authorId: channelId,
viewCount: shortsLockupView.overlay_metadata.secondary_text ? parseLocalSubscriberCount(shortsLockupView.overlay_metadata.secondary_text.text) : null,
Expand Down Expand Up @@ -1247,7 +1247,7 @@ export function parseLocalPlaylistVideo(video) {
return {
type: 'video',
videoId: short.id,
title: short.title.text,
title: short.title.text?.trim(),
viewCount: parseLocalSubscriberCount(short.views.text),
lengthSeconds: ''
}
Expand Down Expand Up @@ -1283,7 +1283,7 @@ export function parseLocalPlaylistVideo(video) {
return {
type: 'video',
videoId: shortsLockupView.on_tap_endpoint.payload.videoId,
title: shortsLockupView.overlay_metadata.primary_text.text,
title: shortsLockupView.overlay_metadata.primary_text.text?.trim(),
viewCount,
lengthSeconds: ''
}
Expand Down Expand Up @@ -1329,7 +1329,7 @@ export function parseLocalPlaylistVideo(video) {
return {
type: 'video',
videoId: video_.id,
title: video_.title.text,
title: video_.title.text?.trim(),
author: video_.author.name,
authorId: video_.author.id,
viewCount,
Expand All @@ -1355,7 +1355,7 @@ export function parseLocalListVideo(item, channelId, channelName) {
return {
type: 'video',
videoId: movie.id,
title: movie.title.text,
title: movie.title.text?.trim(),
author: movie.author.name !== 'N/A' ? movie.author.name : channelName,
authorId: movie.author.id !== 'N/A' ? movie.author.id : channelId,
description: movie.description_snippet?.text,
Expand Down Expand Up @@ -1385,7 +1385,7 @@ export function parseLocalListVideo(item, channelId, channelName) {
return {
type: 'video',
videoId: video.video_id,
title: video.title.text,
title: video.title.text?.trim(),
author: video.author?.name ?? channelName,
authorId: video.author?.id ?? channelId,
viewCount: video.views.text == null ? null : extractNumberFromString(video.views.text),
Expand Down Expand Up @@ -1436,7 +1436,7 @@ export function parseLocalListVideo(item, channelId, channelName) {
return {
type: 'video',
videoId: video.video_id,
title: video.title.text,
title: video.title.text?.trim(),
author: video.author.name !== 'N/A' ? video.author.name : channelName,
authorId: video.author.id !== 'N/A' ? video.author.id : channelId,
description: video.description,
Expand Down Expand Up @@ -1545,7 +1545,7 @@ function parseLockupView(lockupView, channelId = undefined, channelName = undefi
return {
type: 'video',
videoId: lockupView.content_id,
title: lockupView.metadata.title.text,
title: lockupView.metadata.title.text?.trim(),
author: lockupView.metadata.metadata?.metadata_rows[0].metadata_parts?.[0].text?.text,
authorId: lockupView.metadata.image?.renderer_context?.command_context?.on_tap?.payload.browseId,
viewCount,
Expand Down Expand Up @@ -1686,7 +1686,7 @@ export function parseLocalWatchNextVideo(video) {
return {
type: 'video',
videoId: video.id,
title: video.title.text,
title: video.title.text?.trim(),
author: video.author.name,
authorId: video.author.id,
lengthSeconds: video.duration.seconds
Expand All @@ -1705,7 +1705,7 @@ export function parseLocalWatchNextVideo(video) {
return {
type: 'video',
videoId: video.video_id,
title: video.title.text,
title: video.title.text?.trim(),
author: video.author.name,
authorId: video.author.id,
viewCount: video.view_count == null ? null : extractNumberFromString(video.view_count.text),
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 @@ -426,7 +426,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.videoTitle = result.primary_info?.title.text?.trim() ?? result.basic_info.title?.trim()
this.videoViewCount = result.basic_info.view_count ?? (result.primary_info.view_count ? extractNumberFromString(result.primary_info.view_count.text) : null)
this.license = result.secondary_info.metadata.rows.find(element => element.title?.text === 'License')?.contents[0]?.text

Expand Down