Skip to content

Unable to Fetch Items from YouTube Playlist #102

Description

@quochuywdm

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!

Activity

changed the title [-]Can not fetch items in playlist[/-] [+]Unable to Fetch Items from YouTube Playlist[/+] on Jan 17, 2025

danperks commented on Apr 15, 2025

@danperks
Contributor

Fixed in #103 (although may not be up to @rinov standards, did the bare minimum to get it working)

Tibimac commented on Aug 15, 2025

@Tibimac
Collaborator

@quochuywdm Can you please update to the latest version and test again. As the PR #103 from @danperks have been merged, it should be good now.
Try it and keep us updated with your results.
Thanks in advance.

rinov commented on Oct 5, 2026

@rinov
Owner

Fixed by #103 and included in 0.12.0 and later. Please update and let us know if this decoding error persists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions