diff --git a/CHANGELOG.md b/CHANGELOG.md index c4ea2928..a80e7d05 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Sort options for channel shorts +### Fixed + +- Bug where deleted channels cannot be removed from bookmarks + ## [0.29.2] - 2024-11-07 ### Changed diff --git a/playlet-lib/src/components/Services/Invidious/InvidiousService.bs b/playlet-lib/src/components/Services/Invidious/InvidiousService.bs index 6778325c..f3796aab 100644 --- a/playlet-lib/src/components/Services/Invidious/InvidiousService.bs +++ b/playlet-lib/src/components/Services/Invidious/InvidiousService.bs @@ -356,6 +356,8 @@ namespace Invidious statusCode = response.StatusCode() if statusCode = 404 + ' Similar to VideoInfoHandler, we can return a valid response + ' in case of a deleted playlist. response.OverrideStatusCode(200) return { isLastPage: true @@ -379,6 +381,21 @@ namespace Invidious function ChannelVideosHandler(context as object) as object response = context.response + statusCode = response.StatusCode() + if statusCode = 404 + ' Similar to VideoInfoHandler, we can return a valid response + ' in case of a deleted channel. + response.OverrideStatusCode(200) + return { + isLastPage: true + items: [{ + "type": "video" + "videoId": "-----------" + "title": "[Channel videos not found]" + }] + } + end if + if response.StatusCode() = 200 json = response.Json() return { @@ -406,7 +423,7 @@ namespace Invidious response = context.response statusCode = response.StatusCode() - if statusCode >= 500 + if statusCode >= 500 or statusCode = 404 ' In some cases, such as a video became private, or a live stream ended, ' Invidious returns a 500 error. We can in this case return a valid response ' with just a video id, which will allow us to show a valid thumbnail if possible. @@ -438,6 +455,8 @@ namespace Invidious statusCode = response.StatusCode() if statusCode = 404 + ' Similar to VideoInfoHandler, we can return a valid response + ' in case of a deleted playlist. response.OverrideStatusCode(200) return { items: [{ @@ -461,7 +480,21 @@ namespace Invidious function ChannelInfoHandler(context as object) as object response = context.response - if response.StatusCode() = 200 + statusCode = response.StatusCode() + if statusCode = 404 + ' Similar to VideoInfoHandler, we can return a valid response + ' in case of a deleted channel. + response.OverrideStatusCode(200) + return { + items: [{ + "type": "channel" + "authorId": context.feedSource.pathParams.ucid + "author": "[Channel not found]" + }] + } + end if + + if statusCode = 200 json = response.Json() json.type = "channel" return { diff --git a/playlet-lib/src/components/Services/Invidious/InvidiousToContentNode.bs b/playlet-lib/src/components/Services/Invidious/InvidiousToContentNode.bs index 4c9aad7f..87454213 100644 --- a/playlet-lib/src/components/Services/Invidious/InvidiousToContentNode.bs +++ b/playlet-lib/src/components/Services/Invidious/InvidiousToContentNode.bs @@ -261,7 +261,7 @@ namespace InvidiousContent function GetChannelThumbnail(authorThumbnails as object) as string if authorThumbnails = invalid or authorThumbnails.Count() = 0 - return "" + return "pkg:/images/icons/user-200.png" end if url = authorThumbnails[authorThumbnails.Count() - 1].url if url.startsWith("//")