From ea0579257c8aebe986f4d743c1a6e73517635579 Mon Sep 17 00:00:00 2001 From: ChunkyProgrammer <78101139+ChunkyProgrammer@users.noreply.github.com> Date: Wed, 29 Nov 2023 22:41:20 -0500 Subject: [PATCH 1/3] detect error channels properly --- .../subscriptions-live/subscriptions-live.js | 16 ++++++++++++++++ .../subscriptions-shorts.js | 16 ++++++++++++++++ .../subscriptions-videos.js | 17 ++++++++++++++++- 3 files changed, 48 insertions(+), 1 deletion(-) diff --git a/src/renderer/components/subscriptions-live/subscriptions-live.js b/src/renderer/components/subscriptions-live/subscriptions-live.js index bc5f105fe..a4c221957 100644 --- a/src/renderer/components/subscriptions-live/subscriptions-live.js +++ b/src/renderer/components/subscriptions-live/subscriptions-live.js @@ -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) diff --git a/src/renderer/components/subscriptions-shorts/subscriptions-shorts.js b/src/renderer/components/subscriptions-shorts/subscriptions-shorts.js index 793734a9a..f2e39c508 100644 --- a/src/renderer/components/subscriptions-shorts/subscriptions-shorts.js +++ b/src/renderer/components/subscriptions-shorts/subscriptions-shorts.js @@ -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) diff --git a/src/renderer/components/subscriptions-videos/subscriptions-videos.js b/src/renderer/components/subscriptions-videos/subscriptions-videos.js index a535a30dc..c3a938a20 100644 --- a/src/renderer/components/subscriptions-videos/subscriptions-videos.js +++ b/src/renderer/components/subscriptions-videos/subscriptions-videos.js @@ -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 [] } From bcebc5f2187c76e02aa8f2de63cf98c19d736a9e Mon Sep 17 00:00:00 2001 From: ChunkyProgrammer <78101139+ChunkyProgrammer@users.noreply.github.com> Date: Wed, 29 Nov 2023 22:55:47 -0500 Subject: [PATCH 2/3] use get instead of head request --- .../components/subscriptions-live/subscriptions-live.js | 2 +- .../components/subscriptions-shorts/subscriptions-shorts.js | 2 +- .../components/subscriptions-videos/subscriptions-videos.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/renderer/components/subscriptions-live/subscriptions-live.js b/src/renderer/components/subscriptions-live/subscriptions-live.js index a4c221957..7cd6a2b4d 100644 --- a/src/renderer/components/subscriptions-live/subscriptions-live.js +++ b/src/renderer/components/subscriptions-live/subscriptions-live.js @@ -315,7 +315,7 @@ export default defineComponent({ // 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' + method: 'GET' }) if (response2.status === 404) { diff --git a/src/renderer/components/subscriptions-shorts/subscriptions-shorts.js b/src/renderer/components/subscriptions-shorts/subscriptions-shorts.js index f2e39c508..f12818b04 100644 --- a/src/renderer/components/subscriptions-shorts/subscriptions-shorts.js +++ b/src/renderer/components/subscriptions-shorts/subscriptions-shorts.js @@ -209,7 +209,7 @@ export default defineComponent({ // 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' + method: 'GET' }) if (response2.status === 404) { diff --git a/src/renderer/components/subscriptions-videos/subscriptions-videos.js b/src/renderer/components/subscriptions-videos/subscriptions-videos.js index c3a938a20..5bdc624c4 100644 --- a/src/renderer/components/subscriptions-videos/subscriptions-videos.js +++ b/src/renderer/components/subscriptions-videos/subscriptions-videos.js @@ -312,7 +312,7 @@ export default defineComponent({ // 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' + method: 'GET' }) if (response2.status === 404) { From 07d8ae09dbc16a116f9ea8bfe6ca950867dbcad5 Mon Sep 17 00:00:00 2001 From: ChunkyProgrammer <78101139+ChunkyProgrammer@users.noreply.github.com> Date: Fri, 1 Dec 2023 10:06:25 -0500 Subject: [PATCH 3/3] remove 500 status check --- .../components/subscriptions-live/subscriptions-live.js | 5 ----- .../components/subscriptions-shorts/subscriptions-shorts.js | 5 ----- .../components/subscriptions-videos/subscriptions-videos.js | 5 ----- 3 files changed, 15 deletions(-) diff --git a/src/renderer/components/subscriptions-live/subscriptions-live.js b/src/renderer/components/subscriptions-live/subscriptions-live.js index 7cd6a2b4d..2105798c3 100644 --- a/src/renderer/components/subscriptions-live/subscriptions-live.js +++ b/src/renderer/components/subscriptions-live/subscriptions-live.js @@ -305,11 +305,6 @@ 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 diff --git a/src/renderer/components/subscriptions-shorts/subscriptions-shorts.js b/src/renderer/components/subscriptions-shorts/subscriptions-shorts.js index f12818b04..cd6d911d2 100644 --- a/src/renderer/components/subscriptions-shorts/subscriptions-shorts.js +++ b/src/renderer/components/subscriptions-shorts/subscriptions-shorts.js @@ -199,11 +199,6 @@ 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 diff --git a/src/renderer/components/subscriptions-videos/subscriptions-videos.js b/src/renderer/components/subscriptions-videos/subscriptions-videos.js index 5bdc624c4..0a108e9cb 100644 --- a/src/renderer/components/subscriptions-videos/subscriptions-videos.js +++ b/src/renderer/components/subscriptions-videos/subscriptions-videos.js @@ -302,11 +302,6 @@ 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