Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to Fetch Items from YouTube Playlist #102

Open
quochuywdm opened this issue Jan 17, 2025 · 0 comments
Open

Unable to Fetch Items from YouTube Playlist #102

quochuywdm opened this issue Jan 17, 2025 · 0 comments

Comments

@quochuywdm
Copy link

Thank you for this awesome library!

Other requests work fine, but this playlist request is not working: I'm trying to fetch items from the following YouTube playlist: https://www.youtube.com/playlist?list=PLq3UZa7STrbpX13PljcNH6hmyrSbcMYK8
When I run the following code, I encounter an error:

result: failure(Swift.DecodingError.keyNotFound(CodingKeys(stringValue: "status", 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: "status", intValue: nil) ("status").", underlyingError: nil)))

Failed to fetch videos: The data couldn’t be read because it is missing.

private func fetchPlaylistVideos() {
    let playlistID = "PLq3UZa7STrbpX13PljcNH6hmyrSbcMYK8"
    let request = PlaylistItemsListRequest.init(part: [.snippet, .contentDetails], filter: .playlistID(playlistID), maxResults: 10)
    
    YoutubeAPI.shared.send(request) { [weak self] result in
        print("result:", result)
        switch result {
        case .success(let response):
            print("response: ", response)
        case .failure(let error):
            print("Failed to fetch videos:", error.localizedDescription)
        }
    }
}

Any guidance would be greatly appreciated.

Thanks!

@quochuywdm quochuywdm changed the title Can not fetch items in playlist Unable to Fetch Items from YouTube Playlist Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant