b5i/YouTubeKit

How do I re-order playlist videos?

Closed this issue · 4 comments

I have looked at Atwy, and I cannot figure out this feature. How do I re-arrange the videos?

Here is my current code and it always responds disconnected:

func moveVideoInPlaylist(for playlistId: String, moving sourceVideoId: String, toBefore destinationVideoId: String?) async throws {
    var data: [HeadersList.AddQueryInfo.ContentTypes : String] = [.movingVideoId: sourceVideoId, .browseId: playlistId]
        
    if let destinationVideoId {
        data[.videoBeforeId] = destinationVideoId
    }
        
    let (response, error) = await MoveVideoInPlaylistResponse.sendRequest(youtubeModel: entryPoint, data: data)
    if let error {
        print(error)
        throw error
    }
        
    guard let response else {
        throw APIError.networkError(NSError(domain: "", code: -2, userInfo: nil))
    }
        
    print(response)
}

I think there is an issue where AuthenticatedResponse isn't working, because like/dislike is also not working

b5i commented

I have looked at Atwy, and I cannot figure out this feature. How do I re-arrange the videos?

Here is my current code and it always responds disconnected:

func moveVideoInPlaylist(for playlistId: String, moving sourceVideoId: String, toBefore destinationVideoId: String?) async throws {
    var data: [HeadersList.AddQueryInfo.ContentTypes : String] = [.movingVideoId: sourceVideoId, .browseId: playlistId]
        
    if let destinationVideoId {
        data[.videoBeforeId] = destinationVideoId
    }
        
    let (response, error) = await MoveVideoInPlaylistResponse.sendRequest(youtubeModel: entryPoint, data: data)
    if let error {
        print(error)
        throw error
    }
        
    guard let response else {
        throw APIError.networkError(NSError(domain: "", code: -2, userInfo: nil))
    }
        
    print(response)
}

Hello, could you check if your playlistID has "VL" as a prefix? If it has you should remove it from the playlistId that you give to the MoveVideoInPlaylistResponse. Let me know once you tested that. I also edited the documentation because you might not have taken the right video id's, please refer to what is said here.

b5i commented

I think there is an issue where AuthenticatedResponse isn't working, because like/dislike is also not working

That's probably because you haven't updated your fork, I made a fix a few days ago. Let me know it is still doesn't work.

figured it out, ty