detect error channels properly

This commit is contained in:
ChunkyProgrammer 2023-11-29 22:41:20 -05:00
parent 71addd2a47
commit ea0579257c
3 changed files with 48 additions and 1 deletions

View File

@ -305,10 +305,26 @@ export default defineComponent({
try {
const response = await fetch(feedUrl)
// remove once IV returns 404 for non-existent playlists
if (response.status === 500) {
return []
}
if (response.status === 404) {
// playlists don't exist if the channel was terminated but also if it doesn't have the tab,
// so we need to check the channel feed too before deciding it errored, as that only 404s if the channel was terminated
const response2 = await fetch(`${this.currentInvidiousInstance}/feed/channel/${channel.id}`, {
method: 'HEAD'
})
if (response2.status === 404) {
this.errorChannels.push(channel)
}
return []
}
return await parseYouTubeRSSFeed(await response.text(), channel.id)
} catch (error) {
console.error(error)

View File

@ -199,10 +199,26 @@ export default defineComponent({
try {
const response = await fetch(feedUrl)
// remove once IV returns 404 for non-existent playlists
if (response.status === 500) {
return []
}
if (response.status === 404) {
// playlists don't exist if the channel was terminated but also if it doesn't have the tab,
// so we need to check the channel feed too before deciding it errored, as that only 404s if the channel was terminated
const response2 = await fetch(`${this.currentInvidiousInstance}/feed/channel/${channel.id}`, {
method: 'HEAD'
})
if (response2.status === 404) {
this.errorChannels.push(channel)
}
return []
}
return await parseYouTubeRSSFeed(await response.text(), channel.id)
} catch (error) {
console.error(error)

View File

@ -302,8 +302,23 @@ export default defineComponent({
try {
const response = await fetch(feedUrl)
// remove once IV returns 404 for non-existent playlists
if (response.status === 500) {
this.errorChannels.push(channel)
return []
}
if (response.status === 404) {
// playlists don't exist if the channel was terminated but also if it doesn't have the tab,
// so we need to check the channel feed too before deciding it errored, as that only 404s if the channel was terminated
const response2 = await fetch(`${this.currentInvidiousInstance}/feed/channel/${channel.id}`, {
method: 'HEAD'
})
if (response2.status === 404) {
this.errorChannels.push(channel)
}
return []
}