Fix a bug where playlists with small number of videos has duplicates

This commit is contained in:
Brahim Hadriche committed 2025-05-17 15:17:43 -04:00
1 parent 30ea007502
commit 7c1aa80819
3 files changed
+30 -8

No files matched your search

@@ -54,18 +54,19 @@ function PlaylistContentTask(input as object) as object
}
end if
beforeChildCount = contentNode.getChildCount()
InvidiousContent.ToPlaylistContentNode(contentNode, metadata, instance)
childCount = contentNode.getChildCount()
afterChildCount = contentNode.getChildCount()
videoCount = ValidInt(metadata.videoCount)
hasContinuation = not StringUtils.IsNullOrEmpty(metadata.continuation)
noMoreContinuation = hadContinuation and not hasContinuation
noVideosReturned = metadata.videos.Count() = 0
reachedVideoCount = videoCount <> -1 and childCount >= videoCount
noVideosAdded = afterChildCount = beforeChildCount
reachedVideoCount = videoCount <> -1 and afterChildCount >= videoCount
if noMoreContinuation or noVideosReturned or reachedVideoCount
if noMoreContinuation or noVideosAdded or reachedVideoCount
contentNode.loadState = FeedLoadState.Loaded
return {
success: true