YoutubeKit icon indicating copy to clipboard operation
YoutubeKit copied to clipboard

Change PlaylistItemsListRequest models

Open smapira opened this issue 5 years ago • 3 comments

Thanks for your work! I am not sure, have got the below error when use PlaylistItemsListRequest. Might be, thumbnails models will be nil using privete video etc...

When: Using youtubekit v0.3.0

Gienv:

let request = PlaylistItemsListRequest(part: [.id, .snippet, .contentDetails],
                                                  filter: .playlistID("xxxxxxxxxxxxxxxxx"),
                                                  maxResults: 20)

// Send a request.
ApiSession.shared.send(request) { result in
    switch result {
    case .success(let response):
        print(response)
    case .failed(let error):
        print(error)
    }
}

Then Got an error:

keyNotFound(CodingKeys(stringValue: "contentDetails", intValue: nil), Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "items", intValue: nil), _JSONKey(stringValue: "Index 0", intValue: 0)], debugDescription: "No value associated with key CodingKeys(stringValue: "contentDetails", intValue: nil) ("contentDetails").", underlyingError: nil))

smapira avatar Jan 20 '19 10:01 smapira

hello, I am not getting any playlists item.

    let request = PlaylistItemsListRequest(part: [.id, .snippet, .contentDetails, .status], filter: .id(playListID), maxResults: 20)

    // Send a request
    YoutubeAPI.shared.send(request) { result in
        switch result {
        case .success(let response):
            print(response.items)
        case .failed(let error):
            print(error)
        }
    }

Any help?

QaiserAbbas avatar Jul 26 '20 07:07 QaiserAbbas

@QaiserAbbas .id() is playlist item ID, so you should use .playlistID(). https://developers.google.com/youtube/v3/docs/playlistItems/list?hl=en

rinov avatar Sep 22 '22 16:09 rinov

thumbnails models will be nil using privete video etc...

@smapira i see. I tested on my private playlist and it'll return 404. Are you use limited access playlist? Anyway, id and publishedAt are returned correctly. Can you give me an example playlist id?

rinov avatar Sep 22 '22 16:09 rinov