Skip to content

Commit

Permalink
Fixed HistoryResponse returning empty HistoryBlock.
Browse files Browse the repository at this point in the history
  • Loading branch information
b5i committed Nov 12, 2024
1 parent 0974be2 commit 598adea
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ public struct HistoryResponse: AuthenticatedContinuableResponse {
if contentGroup["itemSectionRenderer"].exists() {
let videoGroup = contentGroup["itemSectionRenderer"]

toReturn.results.append(self.decodeHistoryBlock(historyBlockJSON: videoGroup))
let historyBlock = self.decodeHistoryBlock(historyBlockJSON: videoGroup)

if !historyBlock.contentsArray.isEmpty {
toReturn.results.append(historyBlock)
}
} else if contentGroup["continuationItemRenderer"].exists() {
toReturn.continuationToken = contentGroup["continuationItemRenderer"]["continuationEndpoint"]["continuationCommand"]["token"].string
}
Expand Down Expand Up @@ -115,7 +119,11 @@ public struct HistoryResponse: AuthenticatedContinuableResponse {
if contentGroup["itemSectionRenderer"].exists() {
let videoGroup = contentGroup["itemSectionRenderer"]

toReturn.results.append(HistoryResponse.decodeHistoryBlock(historyBlockJSON: videoGroup))
let historyBlock = HistoryResponse.decodeHistoryBlock(historyBlockJSON: videoGroup)

if !historyBlock.contentsArray.isEmpty {
toReturn.results.append(historyBlock)
}
} else if contentGroup["continuationItemRenderer"].exists() {
toReturn.continuationToken = contentGroup["continuationItemRenderer"]["continuationEndpoint"]["continuationCommand"]["token"].string
}
Expand Down

0 comments on commit 598adea

Please sign in to comment.