mirror of
https://github.com/FreeTubeApp/FreeTube
synced 2025-01-08 10:37:21 +01:00
Fix video fetch when using invidious API and sorting by popular. (#3126)
* Fix video fetch when using invidious API and also sorting by popular. * Remove redundant latestVideosPage variable
This commit is contained in:
parent
7640a93ec9
commit
5fd236d963
@ -43,7 +43,6 @@ export default defineComponent({
|
|||||||
bannerUrl: '',
|
bannerUrl: '',
|
||||||
thumbnailUrl: '',
|
thumbnailUrl: '',
|
||||||
subCount: 0,
|
subCount: 0,
|
||||||
latestVideosPage: 2,
|
|
||||||
searchPage: 2,
|
searchPage: 2,
|
||||||
videoContinuationString: '',
|
videoContinuationString: '',
|
||||||
playlistContinuationString: '',
|
playlistContinuationString: '',
|
||||||
@ -181,7 +180,6 @@ export default defineComponent({
|
|||||||
this.id = this.$route.params.id
|
this.id = this.$route.params.id
|
||||||
this.idType = this.$route.query.idType ? Number(this.$route.query.idType) : 0
|
this.idType = this.$route.query.idType ? Number(this.$route.query.idType) : 0
|
||||||
this.currentTab = this.$route.params.currentTab ?? 'videos'
|
this.currentTab = this.$route.params.currentTab ?? 'videos'
|
||||||
this.latestVideosPage = 2
|
|
||||||
this.searchPage = 2
|
this.searchPage = 2
|
||||||
this.relatedChannels = []
|
this.relatedChannels = []
|
||||||
this.latestVideos = []
|
this.latestVideos = []
|
||||||
@ -209,8 +207,7 @@ export default defineComponent({
|
|||||||
this.getChannelVideosLocal()
|
this.getChannelVideosLocal()
|
||||||
break
|
break
|
||||||
case 'invidious':
|
case 'invidious':
|
||||||
this.latestVideosPage = 1
|
this.channelInvidiousVideos()
|
||||||
this.channelInvidiousNextPage()
|
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
this.getChannelVideosLocal()
|
this.getChannelVideosLocal()
|
||||||
@ -226,7 +223,7 @@ export default defineComponent({
|
|||||||
this.getPlaylistsLocal()
|
this.getPlaylistsLocal()
|
||||||
break
|
break
|
||||||
case 'invidious':
|
case 'invidious':
|
||||||
this.channelInvidiousNextPage()
|
this.getPlaylistsInvidious()
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
this.getPlaylistsLocal()
|
this.getPlaylistsLocal()
|
||||||
@ -416,23 +413,23 @@ export default defineComponent({
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
channelInvidiousNextPage: function () {
|
channelInvidiousVideos: function (fetchMore) {
|
||||||
const payload = {
|
const payload = {
|
||||||
resource: 'channels/videos',
|
resource: 'channels/videos',
|
||||||
id: this.id,
|
id: this.id,
|
||||||
params: {
|
params: {
|
||||||
sort_by: this.videoSortBy,
|
sort_by: this.videoSortBy,
|
||||||
page: this.latestVideosPage
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (fetchMore) payload.params.continuation = this.videoContinuationString
|
||||||
|
|
||||||
invidiousAPICall(payload).then((response) => {
|
invidiousAPICall(payload).then((response) => {
|
||||||
this.latestVideos = this.latestVideos.concat(response)
|
this.latestVideos = this.latestVideos.concat(response.videos)
|
||||||
this.latestVideosPage++
|
this.videoContinuationString = response.continuation
|
||||||
this.isElementListLoading = false
|
this.isElementListLoading = false
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
console.error(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, () => {
|
showToast(`${errorMessage}: ${err}`, 10000, () => {
|
||||||
copyToClipboard(err)
|
copyToClipboard(err)
|
||||||
})
|
})
|
||||||
@ -629,7 +626,7 @@ export default defineComponent({
|
|||||||
this.channelLocalNextPage()
|
this.channelLocalNextPage()
|
||||||
break
|
break
|
||||||
case 'invidious':
|
case 'invidious':
|
||||||
this.channelInvidiousNextPage()
|
this.channelInvidiousVideos(true)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
|
Loading…
Reference in New Issue
Block a user