Skip to content

Commit 44c7586

Browse files
committed
fix: fix AccountSubscriptionsFeedResponse returning only shorts
1 parent 378c685 commit 44c7586

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

Sources/YouTubeKit/YouTubeResponseTypes/AuthenticatedResponses/AccountResponses/AccountSubscriptionsFeedResponse.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ public struct AccountSubscriptionsFeedResponse: AuthenticatedContinuableResponse
102102
private static func getVideoFromItemRenderer(_ json: JSON) -> YTVideo? {
103103
if json["content", "videoRenderer"].exists() {
104104
return YTVideo.decodeJSON(json: json["content", "videoRenderer"])
105+
} else if json["content", "lockupViewModel"].exists() {
106+
return YTVideo.decodeLockupJSON(json: json["content", "lockupViewModel"])
105107
} else {
106108
return YTVideo.decodeShortFromJSON(json: json["content", "reelItemRenderer"]) ?? YTVideo.decodeShortFromLockupJSON(json: json["content", "shortsLockupViewModel"])
107109
}

Tests/YouTubeKitTests/YouTubeKitTests.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1256,6 +1256,7 @@ final class YouTubeKitTests: XCTestCase {
12561256
XCTAssertNil(accountSubscriptionsFeedResponse.visitorData, TEST_NAME + "visitorData is not nil (but should never be extracted).")
12571257

12581258
XCTAssertNotEqual(accountSubscriptionsFeedResponse.results.count, 0, TEST_NAME + "Checking if accountSubscriptionsFeedResponse.results is not empty.")
1259+
XCTAssertNotNil(accountSubscriptionsFeedResponse.results.first(where: {$0.channel != nil}), TEST_NAME + "Checking if at least one item has a channel.") // can fail if the user is not subscribed to channel with videos
12591260

12601261
if accountSubscriptionsFeedResponse.continuationToken != nil {
12611262
let continuationResponse = try await accountSubscriptionsFeedResponse.fetchContinuation(youtubeModel: YTM)

0 commit comments

Comments
 (0)