From 83c4d1c3df2ba6f65ab8d971b987fe8870cbf068 Mon Sep 17 00:00:00 2001 From: MC Date: Sat, 28 Jan 2023 22:59:16 +0100 Subject: [PATCH 1/2] Fix video fetch when using invidious API and also sorting by popular. --- src/renderer/views/Channel/Channel.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/renderer/views/Channel/Channel.js b/src/renderer/views/Channel/Channel.js index 27e8e780b8bcd..af87fe487c3a0 100644 --- a/src/renderer/views/Channel/Channel.js +++ b/src/renderer/views/Channel/Channel.js @@ -210,7 +210,7 @@ export default defineComponent({ break case 'invidious': this.latestVideosPage = 1 - this.channelInvidiousNextPage() + this.channelInvidiousVideos() break default: this.getChannelVideosLocal() @@ -226,7 +226,7 @@ export default defineComponent({ this.getPlaylistsLocal() break case 'invidious': - this.channelInvidiousNextPage() + this.getPlaylistsInvidious() break default: this.getPlaylistsLocal() @@ -416,23 +416,23 @@ export default defineComponent({ }) }, - channelInvidiousNextPage: function () { + channelInvidiousVideos: function (fetchMore) { const payload = { resource: 'channels/videos', id: this.id, params: { sort_by: this.videoSortBy, - page: this.latestVideosPage } } + if (fetchMore) payload.params.continuation = this.videoContinuationString invidiousAPICall(payload).then((response) => { - this.latestVideos = this.latestVideos.concat(response) - this.latestVideosPage++ + this.latestVideos = this.latestVideos.concat(response.videos) + this.videoContinuationString = response.continuation this.isElementListLoading = false }).catch((err) => { console.error(err) - const errorMessage = this.$t('Local API Error (Click to copy)') + const errorMessage = this.$t('Invidious API Error (Click to copy)') showToast(`${errorMessage}: ${err}`, 10000, () => { copyToClipboard(err) }) @@ -629,7 +629,7 @@ export default defineComponent({ this.channelLocalNextPage() break case 'invidious': - this.channelInvidiousNextPage() + this.channelInvidiousVideos(true) break } break From 688af153c13e9e88f3679216ed959ca5a6edf7ac Mon Sep 17 00:00:00 2001 From: MC Date: Sun, 29 Jan 2023 00:59:45 +0100 Subject: [PATCH 2/2] Remove redundant latestVideosPage variable --- src/renderer/views/Channel/Channel.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/renderer/views/Channel/Channel.js b/src/renderer/views/Channel/Channel.js index af87fe487c3a0..778b83bfb1025 100644 --- a/src/renderer/views/Channel/Channel.js +++ b/src/renderer/views/Channel/Channel.js @@ -43,7 +43,6 @@ export default defineComponent({ bannerUrl: '', thumbnailUrl: '', subCount: 0, - latestVideosPage: 2, searchPage: 2, videoContinuationString: '', playlistContinuationString: '', @@ -181,7 +180,6 @@ export default defineComponent({ this.id = this.$route.params.id this.idType = this.$route.query.idType ? Number(this.$route.query.idType) : 0 this.currentTab = this.$route.params.currentTab ?? 'videos' - this.latestVideosPage = 2 this.searchPage = 2 this.relatedChannels = [] this.latestVideos = [] @@ -209,7 +207,6 @@ export default defineComponent({ this.getChannelVideosLocal() break case 'invidious': - this.latestVideosPage = 1 this.channelInvidiousVideos() break default: