channel fix (banner, playlist) (#2215)

* channel fix (banner, playlist)

* remove console.log(response)
This commit is contained in:
bob1520 2022-05-12 18:37:25 +09:00 committed by GitHub
parent 252f85c49f
commit 8b50045e78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 38 additions and 2 deletions

View File

@ -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,40 @@ export default Vue.extend({
},
getPlaylistsInvidious: function () {
const payload = {
resource: 'channels/playlists',
id: this.id,
params: {
sort_by: this.playlistSortBy
}
}
this.invidiousAPICall(payload).then((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
@ -600,7 +636,7 @@ export default Vue.extend({
this.getPlaylistsLocalMore()
break
case 'invidious':
this.getPlaylistsInvidious()
this.getPlaylistsInvidiousMore()
break
}
break