From aed102f57a1478cf9485b5246058465d59ad4c0e Mon Sep 17 00:00:00 2001 From: Brahim Hadriche Date: Mon, 19 May 2025 17:50:50 -0400 Subject: [PATCH] Fix a bug where watch history videos repeat indefinitely --- CHANGELOG.md | 1 + .../Middleware/PlayletInvidiousBackendRouter.bs | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index facff970..a1a6b62f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - An error when Invidious doesn't return valid video metadata - A bug where playlists with small number of videos has duplicates - A bug where DASH manifest was not generated correctly for proxied Invidious videos +- A bug where watch history videos repeat indefinitely ## [0.37.0] - 2025-05-16 diff --git a/playlet-lib/src/components/Web/PlayletWebServer/Middleware/PlayletInvidiousBackendRouter.bs b/playlet-lib/src/components/Web/PlayletWebServer/Middleware/PlayletInvidiousBackendRouter.bs index 5ef22a80..0192aa91 100644 --- a/playlet-lib/src/components/Web/PlayletWebServer/Middleware/PlayletInvidiousBackendRouter.bs +++ b/playlet-lib/src/components/Web/PlayletWebServer/Middleware/PlayletInvidiousBackendRouter.bs @@ -184,11 +184,24 @@ namespace Http options = { "accessToken": accessToken.Mid("Bearer ".Len()) } + continuation = request.query.continuation - if not StringUtils.IsNullOrEmpty(continuation) + hasContinuation = not StringUtils.IsNullOrEmpty(continuation) + if hasContinuation options.continuation = continuation end if + if not hasContinuation + page = ValidString(request.query.page).ToInt() + if page > 1 + LogError("Playlet backend does not use history pagination (use continuation instead)") + response.Json({ + "items": [] + }) + return true + end if + end if + result = InnertubeService.GetWatchHistory(options) if result.error <> invalid response.Json(result)