diff --git a/src/renderer/components/ft-list-playlist/ft-list-playlist.js b/src/renderer/components/ft-list-playlist/ft-list-playlist.js index 1f8c7ade03da4..ea70fa8eba00d 100644 --- a/src/renderer/components/ft-list-playlist/ft-list-playlist.js +++ b/src/renderer/components/ft-list-playlist/ft-list-playlist.js @@ -42,6 +42,10 @@ export default defineComponent({ }, channelId: function () { + if (this.channelLink === null) { + return null + } + let id = this.channelLink.replace('https://www.youtube.com/user/', '') id = id.replace('https://www.youtube.com/channel/', '') return id diff --git a/src/renderer/components/ft-list-playlist/ft-list-playlist.vue b/src/renderer/components/ft-list-playlist/ft-list-playlist.vue index 2294832832d9e..41860c129dba7 100644 --- a/src/renderer/components/ft-list-playlist/ft-list-playlist.vue +++ b/src/renderer/components/ft-list-playlist/ft-list-playlist.vue @@ -41,11 +41,18 @@
{{ channelName }} + + {{ channelName }} +
diff --git a/src/renderer/helpers/api/local.js b/src/renderer/helpers/api/local.js index 13a95c5d150a0..de73e75e263f3 100644 --- a/src/renderer/helpers/api/local.js +++ b/src/renderer/helpers/api/local.js @@ -1,6 +1,7 @@ import { Innertube } from 'youtubei.js' import { ClientType } from 'youtubei.js/dist/src/core/Session' import EmojiRun from 'youtubei.js/dist/src/parser/classes/misc/EmojiRun' +import Text from 'youtubei.js/dist/src/parser/classes/misc/Text' import Autolinker from 'autolinker' import { join } from 'path' @@ -221,7 +222,7 @@ function parseListVideo(video) { authorId: video.author.id, description: video.description, viewCount: extractNumberFromString(video.view_count.text), - publishedText: video.published.text, + publishedText: video.published.text !== 'N/A' ? video.published.text : null, lengthSeconds: isNaN(video.duration.seconds) ? '' : video.duration.seconds, liveNow: video.is_live, isUpcoming: video.is_upcoming || video.is_premiere, @@ -250,15 +251,21 @@ function parseListItem(item) { // according to https://github.com/iv-org/invidious/issues/3514#issuecomment-1368080392 // the response can be the new or old one, so we currently need to handle both here - let subscribers + let subscribers = null let videos = null let handle = null if (channel.subscribers.text.startsWith('@')) { - subscribers = channel.videos.text handle = channel.subscribers.text + + if (channel.videos.text !== 'N/A') { + subscribers = channel.videos.text + } } else { - subscribers = channel.subscribers.text - videos = channel.videos.text + videos = extractNumberFromString(channel.videos.text) + + if (channel.subscribers.text !== 'N/A') { + subscribers = channel.subscribers.text + } } return { @@ -276,13 +283,24 @@ function parseListItem(item) { case 'Playlist': { /** @type {Playlist} */ const playlist = item + + let channelName + let channelId = null + + if (playlist.author instanceof Text) { + channelName = playlist.author.text + } else { + channelName = playlist.author.name + channelId = playlist.author.id + } + return { type: 'playlist', dataSource: 'local', title: playlist.title, thumbnail: playlist.thumbnails[0].url, - channelName: playlist.author.name, - channelId: playlist.author.id, + channelName, + channelId, playlistId: playlist.id, videoCount: extractNumberFromString(playlist.video_count.text) }