From b401b7e5cb6ebc8e6ea1f4b0c512b36625878e92 Mon Sep 17 00:00:00 2001 From: bob Date: Fri, 22 Apr 2022 16:29:47 +0900 Subject: [PATCH 1/2] channel fix (banner, playlist) --- src/renderer/views/Channel/Channel.js | 42 +++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/src/renderer/views/Channel/Channel.js b/src/renderer/views/Channel/Channel.js index da284883a68a3..71ba0cd06cd31 100644 --- a/src/renderer/views/Channel/Channel.js +++ b/src/renderer/views/Channel/Channel.js @@ -373,8 +373,10 @@ export default Vue.extend({ }) this.latestVideos = response.latestVideos - if (typeof (response.authorBanners) !== 'undefined') { + if (response.authorBanners instanceof Array && response.authorBanners.length > 0) { this.bannerUrl = response.authorBanners[0].url.replace('https://yt3.ggpht.com', `${this.currentInvidiousInstance}/ggpht/`) + } else { + this.bannerUrl = null } this.isLoading = false @@ -468,6 +470,41 @@ export default Vue.extend({ }, getPlaylistsInvidious: function () { + const payload = { + resource: 'channels/playlists', + id: this.id, + params: { + sort_by: this.playlistSortBy + } + } + + this.invidiousAPICall(payload).then((response) => { + console.log(response) + this.playlistContinuationString = response.continuation + this.latestPlaylists = response.playlists + this.isElementListLoading = false + }).catch((err) => { + console.log(err) + const errorMessage = this.$t('Invidious API Error (Click to copy)') + this.showToast({ + message: `${errorMessage}: ${err.responseJSON.error}`, + time: 10000, + action: () => { + navigator.clipboard.writeText(err.responseJSON.error) + } + }) + if (this.backendPreference === 'invidious' && this.backendFallback) { + this.showToast({ + message: this.$t('Falling back to Local API') + }) + this.getPlaylistsLocal() + } else { + this.isLoading = false + } + }) + }, + + getPlaylistsInvidiousMore: function () { if (this.playlistContinuationString === null) { console.log('There are no more playlists available for this channel') return @@ -486,6 +523,7 @@ export default Vue.extend({ } this.invidiousAPICall(payload).then((response) => { + console.log(response) this.playlistContinuationString = response.continuation this.latestPlaylists = this.latestPlaylists.concat(response.playlists) this.isElementListLoading = false @@ -600,7 +638,7 @@ export default Vue.extend({ this.getPlaylistsLocalMore() break case 'invidious': - this.getPlaylistsInvidious() + this.getPlaylistsInvidiousMore() break } break From 117b62f9736dc7475ebb1665caec9ab8a60d5977 Mon Sep 17 00:00:00 2001 From: bob Date: Sun, 24 Apr 2022 01:00:30 +0900 Subject: [PATCH 2/2] remove console.log(response) --- src/renderer/views/Channel/Channel.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/renderer/views/Channel/Channel.js b/src/renderer/views/Channel/Channel.js index 71ba0cd06cd31..930f7030be48f 100644 --- a/src/renderer/views/Channel/Channel.js +++ b/src/renderer/views/Channel/Channel.js @@ -479,7 +479,6 @@ export default Vue.extend({ } this.invidiousAPICall(payload).then((response) => { - console.log(response) this.playlistContinuationString = response.continuation this.latestPlaylists = response.playlists this.isElementListLoading = false @@ -523,7 +522,6 @@ export default Vue.extend({ } this.invidiousAPICall(payload).then((response) => { - console.log(response) this.playlistContinuationString = response.continuation this.latestPlaylists = this.latestPlaylists.concat(response.playlists) this.isElementListLoading = false