Skip to content
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: 4 additions & 0 deletions src/renderer/components/ft-list-playlist/ft-list-playlist.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions src/renderer/components/ft-list-playlist/ft-list-playlist.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,18 @@
</router-link>
<div class="infoLine">
<router-link
v-if="channelId"
class="channelName"
:to="`/channel/${channelId}`"
>
{{ channelName }}
</router-link>
<span
v-else
class="channelName"
>
{{ channelName }}
</span>
</div>
</div>
</div>
Expand Down
32 changes: 25 additions & 7 deletions src/renderer/helpers/api/local.js
Original file line number Diff line number Diff line change
@@ -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'

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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 {
Expand All @@ -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)
}
Expand Down