mirror of https://github.com/FreeTubeApp/FreeTube
detect error channels properly
This commit is contained in:
parent
71addd2a47
commit
ea0579257c
|
@ -305,10 +305,26 @@ export default defineComponent({
|
||||||
try {
|
try {
|
||||||
const response = await fetch(feedUrl)
|
const response = await fetch(feedUrl)
|
||||||
|
|
||||||
|
// remove once IV returns 404 for non-existent playlists
|
||||||
if (response.status === 500) {
|
if (response.status === 500) {
|
||||||
return []
|
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)
|
return await parseYouTubeRSSFeed(await response.text(), channel.id)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
|
|
|
@ -199,10 +199,26 @@ export default defineComponent({
|
||||||
try {
|
try {
|
||||||
const response = await fetch(feedUrl)
|
const response = await fetch(feedUrl)
|
||||||
|
|
||||||
|
// remove once IV returns 404 for non-existent playlists
|
||||||
if (response.status === 500) {
|
if (response.status === 500) {
|
||||||
return []
|
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)
|
return await parseYouTubeRSSFeed(await response.text(), channel.id)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
|
|
|
@ -302,8 +302,23 @@ export default defineComponent({
|
||||||
try {
|
try {
|
||||||
const response = await fetch(feedUrl)
|
const response = await fetch(feedUrl)
|
||||||
|
|
||||||
|
// remove once IV returns 404 for non-existent playlists
|
||||||
if (response.status === 500) {
|
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 []
|
return []
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue