Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix video fetch when using invidious API and sorting by popular. #3126

Merged
merged 3 commits into from
Jan 30, 2023
Merged
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
19 changes: 8 additions & 11 deletions src/renderer/views/Channel/Channel.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ export default defineComponent({
bannerUrl: '',
thumbnailUrl: '',
subCount: 0,
latestVideosPage: 2,
searchPage: 2,
videoContinuationString: '',
playlistContinuationString: '',
Expand Down Expand Up @@ -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 = []
Expand Down Expand Up @@ -209,8 +207,7 @@ export default defineComponent({
this.getChannelVideosLocal()
break
case 'invidious':
this.latestVideosPage = 1
this.channelInvidiousNextPage()
this.channelInvidiousVideos()
break
default:
this.getChannelVideosLocal()
Expand All @@ -226,7 +223,7 @@ export default defineComponent({
this.getPlaylistsLocal()
break
case 'invidious':
this.channelInvidiousNextPage()
this.getPlaylistsInvidious()
break
default:
this.getPlaylistsLocal()
Expand Down Expand Up @@ -416,23 +413,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
absidue marked this conversation as resolved.
Show resolved Hide resolved
}
}
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)
})
Expand Down Expand Up @@ -629,7 +626,7 @@ export default defineComponent({
this.channelLocalNextPage()
break
case 'invidious':
this.channelInvidiousNextPage()
this.channelInvidiousVideos(true)
break
}
break
Expand Down