[PR #866] Fix for #711: Implement custom playlist thumbnail uploads #777

Open
opened 2026-02-27 23:02:21 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/sigma67/ytmusicapi/pull/866
Author: @Daveson217
Created: 2/1/2026
Status: 🔄 Open

Base: mainHead: fix-edit_playlist-711


📝 Commits (10+)

  • 4ee4acd feat: Add support for uploading custom playlist thumbnails(#711)
  • 3d746eb feat: Add support for uploading custom playlist thumbnails(#711)
  • 6e3ee2c feat: Add support for uploading custom playlist thumbnails(#711)
  • 2dd72d6 feat: Add support for uploading custom playlist thumbnails(#711)
  • 6e34e26 Merge branch 'main' into fix-edit_playlist-711
  • ea36cd4 refactor: Address review comments and add integration test
  • a50f9e5 fix: Remove Content-Type header during thumbnail binary upload
  • 9541834 fix(#711): Set correct image Content-Type for thumbnail upload
  • ffae0cb fix: Set appropriate Content-Type for binary upload
  • de84b57 fix(#711): fixed mypy and ruff errors; fixed content-type and integration fails

📊 Changes

4 files changed (+101 additions, -0 deletions)

View changed files

tests/data/mock_playlist_image.jpg (+0 -0)
📝 tests/mixins/test_playlists.py (+6 -0)
📝 ytmusicapi/mixins/_protocol.py (+2 -0)
📝 ytmusicapi/mixins/playlists.py (+93 -0)

📄 Description

Closes #711

This PR adds the ability to upload custom thumbnails to playlists via edit_playlist.

Changes:

  1. Implemented a new helper method _upload_playlist_thumbnail in PlaylistsMixin. This replicates the resumable upload protocol (handshake + binary upload) used elsewhere in the codebase for song uploads, but adapted for the playlist image endpoint.
  2. Updated edit_playlist to accept a thumbnail argument (file path).
  3. Added logic to upload the image first, retrieve the encryptedBlobId, and append the ACTION_SET_CUSTOM_THUMBNAIL action to the request body.

Testing:

  1. Verified locally by uploading a JPG image to a personal playlist.
  2. Confirmed the thumbnail updated successfully on the YouTube Music web interface.

Test used:
yt.edit_playlist(playlistId="...", thumbnail="cover.jpg")

P.S.: I am happy to add a unit test for _upload_playlist_thumbnail if you could point me to an example of how you prefer to mock upload requests.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/sigma67/ytmusicapi/pull/866 **Author:** [@Daveson217](https://github.com/Daveson217) **Created:** 2/1/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix-edit_playlist-711` --- ### 📝 Commits (10+) - [`4ee4acd`](https://github.com/sigma67/ytmusicapi/commit/4ee4acd9715e37ccdd8c3a5db5a03082436b5652) feat: Add support for uploading custom playlist thumbnails(#711) - [`3d746eb`](https://github.com/sigma67/ytmusicapi/commit/3d746eb4cd55552b2b3d043242f2d4a87e7aab98) feat: Add support for uploading custom playlist thumbnails(#711) - [`6e3ee2c`](https://github.com/sigma67/ytmusicapi/commit/6e3ee2c33ff31e132933025d310deba9c5a6ecac) feat: Add support for uploading custom playlist thumbnails(#711) - [`2dd72d6`](https://github.com/sigma67/ytmusicapi/commit/2dd72d6f4d4cde41385514673bfdfc5accfa419e) feat: Add support for uploading custom playlist thumbnails(#711) - [`6e34e26`](https://github.com/sigma67/ytmusicapi/commit/6e34e2658947dafc67f7e52367f05122c96cd4d2) Merge branch 'main' into fix-edit_playlist-711 - [`ea36cd4`](https://github.com/sigma67/ytmusicapi/commit/ea36cd4e7699bc757a1bb05d910ef1cda89a256e) refactor: Address review comments and add integration test - [`a50f9e5`](https://github.com/sigma67/ytmusicapi/commit/a50f9e568600e4330a8e2bc43676361e5bf304c6) fix: Remove Content-Type header during thumbnail binary upload - [`9541834`](https://github.com/sigma67/ytmusicapi/commit/9541834491838b200c707d36b83c70dd3134442a) fix(#711): Set correct image Content-Type for thumbnail upload - [`ffae0cb`](https://github.com/sigma67/ytmusicapi/commit/ffae0cb23ad3800b93d7d6c8cefa22016e6553b0) fix: Set appropriate Content-Type for binary upload - [`de84b57`](https://github.com/sigma67/ytmusicapi/commit/de84b57aed509daf51bc45e6812ebee807b227f1) fix(#711): fixed mypy and ruff errors; fixed content-type and integration fails ### 📊 Changes **4 files changed** (+101 additions, -0 deletions) <details> <summary>View changed files</summary> ➕ `tests/data/mock_playlist_image.jpg` (+0 -0) 📝 `tests/mixins/test_playlists.py` (+6 -0) 📝 `ytmusicapi/mixins/_protocol.py` (+2 -0) 📝 `ytmusicapi/mixins/playlists.py` (+93 -0) </details> ### 📄 Description ### Closes #711 This PR adds the ability to upload custom thumbnails to playlists via edit_playlist. _**Changes:**_ 1. Implemented a new helper method _upload_playlist_thumbnail in PlaylistsMixin. This replicates the resumable upload protocol (handshake + binary upload) used elsewhere in the codebase for song uploads, but adapted for the playlist image endpoint. 2. Updated edit_playlist to accept a thumbnail argument (file path). 3. Added logic to upload the image first, retrieve the encryptedBlobId, and append the ACTION_SET_CUSTOM_THUMBNAIL action to the request body. _**Testing:**_ 1. Verified locally by uploading a JPG image to a personal playlist. 2. Confirmed the thumbnail updated successfully on the YouTube Music web interface. _**Test used:**_ `yt.edit_playlist(playlistId="...", thumbnail="cover.jpg")` P.S.: I am happy to add a unit test for `_upload_playlist_thumbnail` if you could point me to an example of how you prefer to mock upload requests. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ytmusicapi#777
No description provided.