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

edit_playlist: add playlist image #711

Open
srajangarg opened this issue Jan 3, 2025 · 5 comments
Open

edit_playlist: add playlist image #711

srajangarg opened this issue Jan 3, 2025 · 5 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@srajangarg
Copy link

Seems like youtube music recently added the ability to add custom images to playlists! Can we extend create_playlist() and edit_playlist to take an optional argument (an image file) so that we can programmatically set it?

@srajangarg srajangarg changed the title ability to add a playlist image via create_playlist() feature request: ability to add a playlist image via create_playlist() / edit_playlist() Jan 3, 2025
@srajangarg
Copy link
Author

{
  "actions": [
    {
      "action": "ACTION_SET_CUSTOM_THUMBNAIL",
      "addedCustomThumbnail": {
        "imageKey": {
          "type": "PLAYLIST_IMAGE_TYPE_CUSTOM_THUMBNAIL",
          "name": "studio_square_thumbnail"
        },
        "playlistScottyEncryptedBlobId": "65jVDxiw9NQXhgph-9IlssToi-FoBdg68actYIIMK-vjU2o5Gq8QvK5H9PkpmMVZvtP7jQspWqJhprOnmyp1aQ=="
      }
    }
  ]
}

this is the request payload to https://music.youtube.com/youtubei/v1/browse/edit_playlist

@srajangarg
Copy link
Author

srajangarg commented Jan 3, 2025

before that call^ there was a call to

https://music.youtube.com/playlist_image_upload/playlist_custom_thumbnail?upload_id=AFiumC58THIgewkszL0aq8xbBLW1PSC-notrwUIrOnWDEkxSt0PDPf52HNC8x3xv7XIe1zwBXqOfCA6Ox9mW4dOF_KeC_YCzYro5hbDqGPe9UA&upload_protocol=resumable

with the payload containing the image data (my guess). and the response was

{
  "encryptedBlobId":"65jVDxiw9NQXhgph-9IlssToi-FoBdg68actYIIMK-vjU2o5Gq8QvK5H9PkpmMVZvtP7jQspWqJhprOnmyp1aQ=="
}

the same blobid passed to edit_playlist

@srajangarg
Copy link
Author

and before that call^ was an empty request call to https://music.youtube.com/playlist_image_upload/playlist_custom_thumbnail

that returned

x-goog-upload-url:
https://music.youtube.com/playlist_image_upload/playlist_custom_thumbnail?upload_id=AFiumC58THIgewkszL0aq8xbBLW1PSC-notrwUIrOnWDEkxSt0PDPf52HNC8x3xv7XIe1zwBXqOfCA6Ox9mW4dOF_KeC_YCzYro5hbDqGPe9UA&upload_protocol=resumable

in the reponse headers - which probably gives us the URL to call while uploading the image

@sigma67 sigma67 added enhancement New feature or request good first issue Good for newcomers labels Jan 4, 2025
@sigma67
Copy link
Owner

sigma67 commented Jan 4, 2025

Yeah sure, this should be possible. PR welcome

We already have similar upload code in upload_song

@sigma67 sigma67 changed the title feature request: ability to add a playlist image via create_playlist() / edit_playlist() feature request: edit_playlist: add playlist image Jan 4, 2025
@sigma67
Copy link
Owner

sigma67 commented Jan 4, 2025

This should be implemented in edit_playlist only. When an optional image Path is provided, the upload is performed via separate calls to

https://music.youtube.com/playlist_image_upload/playlist_custom_thumbnail

which returns an encrypted blob id, which is then wrapped in a corresponding action for the edit_playlist call.

@sigma67 sigma67 changed the title feature request: edit_playlist: add playlist image edit_playlist: add playlist image Jan 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants