From b48d04700f1db90125c8e5a9e9a304c3aefa8a8c Mon Sep 17 00:00:00 2001 From: absidue <48293849+absidue@users.noreply.github.com> Date: Sat, 5 Aug 2023 02:33:03 +0200 Subject: [PATCH] Fix empty channels showing up as errored with RSS (#3824) --- .../subscriptions-live/subscriptions-live.js | 11 +++++++++++ .../subscriptions-shorts/subscriptions-shorts.js | 11 +++++++++++ .../subscriptions-tab-ui/subscriptions-tab-ui.css | 4 ---- .../subscriptions-tab-ui/subscriptions-tab-ui.vue | 1 - .../subscriptions-videos/subscriptions-videos.js | 12 +++++++++++- 5 files changed, 33 insertions(+), 6 deletions(-) diff --git a/src/renderer/components/subscriptions-live/subscriptions-live.js b/src/renderer/components/subscriptions-live/subscriptions-live.js index 8eca04d56..bc5f105fe 100644 --- a/src/renderer/components/subscriptions-live/subscriptions-live.js +++ b/src/renderer/components/subscriptions-live/subscriptions-live.js @@ -216,6 +216,17 @@ export default defineComponent({ const response = await fetch(feedUrl) 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(`https://www.youtube.com/feeds/videos.xml?channel_id=${channel.id}`, { + method: 'HEAD' + }) + + if (response2.status === 404) { + this.errorChannels.push(channel) + } + return [] } diff --git a/src/renderer/components/subscriptions-shorts/subscriptions-shorts.js b/src/renderer/components/subscriptions-shorts/subscriptions-shorts.js index 2893b0493..793734a9a 100644 --- a/src/renderer/components/subscriptions-shorts/subscriptions-shorts.js +++ b/src/renderer/components/subscriptions-shorts/subscriptions-shorts.js @@ -157,6 +157,17 @@ export default defineComponent({ const response = await fetch(feedUrl) 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(`https://www.youtube.com/feeds/videos.xml?channel_id=${channel.id}`, { + method: 'HEAD' + }) + + if (response2.status === 404) { + this.errorChannels.push(channel) + } + return [] } diff --git a/src/renderer/components/subscriptions-tab-ui/subscriptions-tab-ui.css b/src/renderer/components/subscriptions-tab-ui/subscriptions-tab-ui.css index 452a03b7f..8c2f61968 100644 --- a/src/renderer/components/subscriptions-tab-ui/subscriptions-tab-ui.css +++ b/src/renderer/components/subscriptions-tab-ui/subscriptions-tab-ui.css @@ -14,10 +14,6 @@ right: 10px; } -.channelBubble { - display: inline-block; -} - @media only screen and (max-width: 350px) { .floatingTopButton { position: absolute diff --git a/src/renderer/components/subscriptions-tab-ui/subscriptions-tab-ui.vue b/src/renderer/components/subscriptions-tab-ui/subscriptions-tab-ui.vue index 26b884387..96ed3ea30 100644 --- a/src/renderer/components/subscriptions-tab-ui/subscriptions-tab-ui.vue +++ b/src/renderer/components/subscriptions-tab-ui/subscriptions-tab-ui.vue @@ -14,7 +14,6 @@ :channel-name="channel.name" :channel-id="channel.id" :channel-thumbnail="channel.thumbnail" - class="channelBubble" @click="goToChannel(channel.id)" /> diff --git a/src/renderer/components/subscriptions-videos/subscriptions-videos.js b/src/renderer/components/subscriptions-videos/subscriptions-videos.js index 366351b6c..a535a30dc 100644 --- a/src/renderer/components/subscriptions-videos/subscriptions-videos.js +++ b/src/renderer/components/subscriptions-videos/subscriptions-videos.js @@ -216,7 +216,17 @@ export default defineComponent({ const response = await fetch(feedUrl) if (response.status === 404) { - this.errorChannels.push(channel) + // 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(`https://www.youtube.com/feeds/videos.xml?channel_id=${channel.id}`, { + method: 'HEAD' + }) + + if (response2.status === 404) { + this.errorChannels.push(channel) + } + return [] }