Skip to content

Commit

Permalink
Fixed PlaylistInfosResponse's extraction and improved tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
b5i committed Sep 20, 2024
1 parent d2a2220 commit e16b297
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public struct PlaylistInfosResponse: ContinuableResponse {
for videoTab in videoTabsArray {
guard videoTab["tabRenderer"]["selected"].bool == true else { continue }

guard let secondVideoArray = videoTab["tabRenderer"]["content"]["sectionListRenderer"]["contents"].array else { continue }
guard let secondVideoArray = videoTab["tabRenderer"]["content"]["sectionListRenderer"]["contents"].array ?? videoTab["tabRenderer"]["content"]["playlistVideoListRenderer"]["contents"].array else { continue }
for secondVideoArrayPart in secondVideoArray {
guard let thirdVideoArray = secondVideoArrayPart["itemSectionRenderer"]["contents"].array else { continue }

Expand Down
4 changes: 4 additions & 0 deletions Tests/YouTubeKitTests/YouTubeKitTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,11 @@ final class YouTubeKitTests: XCTestCase {

var playlistInfosResult = try await playlist.fetchVideosThrowing(youtubeModel: YTM)

XCTAssertFalse(playlistInfosResult.results.isEmpty)

let playlistContinuation = try await playlistInfosResult.fetchContinuationThrowing(youtubeModel: YTM)

XCTAssertFalse(playlistContinuation.results.isEmpty)

let videoCount = playlistInfosResult.results.count + playlistContinuation.results.count
playlistInfosResult.mergeWithContinuation(playlistContinuation)
Expand Down

0 comments on commit e16b297

Please sign in to comment.