From b4c5d336d3a7f2f1e681c499bb77a2b79cda15b7 Mon Sep 17 00:00:00 2001 From: Brahim Hadriche Date: Sun, 7 Jan 2024 14:55:08 -0500 Subject: [PATCH 1/3] Fix for bookmarked invalid videos --- CHANGELOG.md | 1 + .../Services/Invidious/InvidiousService.bs | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d7da66c..307a00bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - `HTTP/0.9 when not allowed` errors by adding a retry to web requests +- Issue where a bookmarked video is no longer valid (such as a video made private, or a live stream that ended) ## [0.18.1] - 2024-01-02 diff --git a/playlet-lib/src/components/Services/Invidious/InvidiousService.bs b/playlet-lib/src/components/Services/Invidious/InvidiousService.bs index f85e43a6..d5040147 100644 --- a/playlet-lib/src/components/Services/Invidious/InvidiousService.bs +++ b/playlet-lib/src/components/Services/Invidious/InvidiousService.bs @@ -363,13 +363,28 @@ namespace Invidious end function function VideoInfoHandler(m as object, feedSource as object, response as object) as object - if response.StatusCode() = 200 + statusCode = response.StatusCode() + if statusCode >= 500 + ' 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, + ' and makes it possible to load the bookmark and delete it. + return { + items: [{ + "videoId": feedSource.pathParams.id + "type": "video" + }] + } + end if + + if statusCode = 200 json = response.Json() json.type = "video" return { items: [json] } end if + return invalid end function From a02226a13e2d08a11ce75614a4d2e989da9a4e66 Mon Sep 17 00:00:00 2001 From: Brahim Hadriche Date: Sun, 7 Jan 2024 14:57:46 -0500 Subject: [PATCH 2/3] Update InvidiousService.bs --- .../src/components/Services/Invidious/InvidiousService.bs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/playlet-lib/src/components/Services/Invidious/InvidiousService.bs b/playlet-lib/src/components/Services/Invidious/InvidiousService.bs index d5040147..49752a3d 100644 --- a/playlet-lib/src/components/Services/Invidious/InvidiousService.bs +++ b/playlet-lib/src/components/Services/Invidious/InvidiousService.bs @@ -367,8 +367,9 @@ namespace Invidious if statusCode >= 500 ' 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, - ' and makes it possible to load the bookmark and delete it. + ' with just a video id, which will allow us to show a valid thumbnail if possible. + ' This is to makes it possible to load a bookmarked video and delete it even if + ' is is no longer valid. return { items: [{ "videoId": feedSource.pathParams.id From 8230d199b4850de2f7a4459095649c92e95a4971 Mon Sep 17 00:00:00 2001 From: Brahim Hadriche Date: Sun, 7 Jan 2024 16:45:57 -0500 Subject: [PATCH 3/3] Change status code --- .../src/components/Services/Invidious/InvidiousService.bs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/playlet-lib/src/components/Services/Invidious/InvidiousService.bs b/playlet-lib/src/components/Services/Invidious/InvidiousService.bs index 49752a3d..5dc0206d 100644 --- a/playlet-lib/src/components/Services/Invidious/InvidiousService.bs +++ b/playlet-lib/src/components/Services/Invidious/InvidiousService.bs @@ -44,7 +44,7 @@ namespace Invidious m.endpoints = node.apiDefinitions - m.responseHanlders = { + m.responseHandlers = { DefaultHandler: m.DefaultHandler AuthFeedHandler: m.AuthFeedHandler PlaylistHandler: m.PlaylistHandler @@ -292,7 +292,7 @@ namespace Invidious response = request.Await() - responseHandler = endpoint.responseHandler <> invalid ? m.responseHanlders[endpoint.responseHandler] : m.responseHanlders["DefaultHandler"] + responseHandler = endpoint.responseHandler <> invalid ? m.responseHandlers[endpoint.responseHandler] : m.responseHandlers["DefaultHandler"] result = responseHandler(m, feedSource, response) @@ -369,7 +369,9 @@ namespace Invidious ' 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. ' This is to makes it possible to load a bookmarked video and delete it even if - ' is is no longer valid. + ' it is no longer valid. + ' TODO:P2 access to private property + response._statusCode = 200 return { items: [{ "videoId": feedSource.pathParams.id