[GH-ISSUE #444] Ability to add playlist item to start of playlist #333

Closed
opened 2026-02-27 23:00:14 +03:00 by kerem · 6 comments
Owner

Originally created by @zeitmeister on GitHub (Sep 26, 2023).
Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/444

Is your feature request related to a problem? Please describe.

  • Once a day i add an album to a playlist and i would like the most recent album to be at the top of the playlist. At the moment it is appended to the end of the playlist.

Describe the solution you'd like

  • An option in the add_playlist_item that allows the item to be added start of the playlist (push) instead of the end (append).

Describe alternatives you've considered

  • I have considered using the moveItem parameters on the edit_playlist function but then i guess i would have to get the playlist programatically and retrieve the setvideoId of the top most track for every track that i would like to move which would result in a god awful amount of requests.

Additional context

  • I tried adding a track to the start of the playlist in Youtube Music and i couln't do it so this is perhaps simply not possible.
Originally created by @zeitmeister on GitHub (Sep 26, 2023). Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/444 **Is your feature request related to a problem? Please describe.** - Once a day i add an album to a playlist and i would like the most recent album to be at the top of the playlist. At the moment it is appended to the end of the playlist. **Describe the solution you'd like** - An option in the `add_playlist_item` that allows the item to be added start of the playlist (push) instead of the end (append). **Describe alternatives you've considered** - I have considered using the `moveItem` parameters on the `edit_playlist` function but then i guess i would have to get the playlist programatically and retrieve the setvideoId of the top most track for every track that i would like to move which would result in a god awful amount of requests. **Additional context** - I tried adding a track to the start of the playlist in Youtube Music and i couln't do it so this is perhaps simply not possible.
kerem 2026-02-27 23:00:14 +03:00
Author
Owner

@sigma67 commented on GitHub (Sep 26, 2023):

I don't think it's possible. There is no way to do this on the web either. You can create a new playlist with the old one as the source playlist and the new videoId in front, but I doubt that's what you want.

And yeah, as you noted correctly, the only way to do this with the existing playlist would be with edit_playlist and moveItem.

<!-- gh-comment-id:1736329702 --> @sigma67 commented on GitHub (Sep 26, 2023): I don't think it's possible. There is no way to do this on the web either. You can create a new playlist with the old one as the source playlist and the new videoId in front, but I doubt that's what you want. And yeah, as you noted correctly, the only way to do this with the existing playlist would be with `edit_playlist` and `moveItem`.
Author
Owner

@zeitmeister commented on GitHub (Sep 27, 2023):

Yeah I understand. I did however find a way to make it the way I want. You can go to your playlist in YouTube interface (not YouTube music) and there you can edit your playlist settings to add videos to top of playlist!

So I'm closing this ticket.

<!-- gh-comment-id:1736852953 --> @zeitmeister commented on GitHub (Sep 27, 2023): Yeah I understand. I did however find a way to make it the way I want. You can go to your playlist in YouTube interface (not YouTube music) and there you can edit your playlist settings to add videos to top of playlist! So I'm closing this ticket.
Author
Owner

@sigma67 commented on GitHub (Sep 27, 2023):

Can you add more detail on how you do that for others that might find this issue?

Depending on how the API interaction works it might then be possible to do this via the API. Afaik the playlist API is mostly equivalent between YTM and YT.

<!-- gh-comment-id:1736923516 --> @sigma67 commented on GitHub (Sep 27, 2023): Can you add more detail on how you do that for others that might find this issue? Depending on how the API interaction works it might then be possible to do this via the API. Afaik the playlist API is mostly equivalent between YTM and YT.
Author
Owner

@zeitmeister commented on GitHub (Sep 27, 2023):

  • Go to youtube.com and log in as same user that you use with ytmusicapi.
  • Find and click on your playlist on the left hand side of the page.
  • Click the three dots on the playlist info box, select Playlist Settings.
  • Check the Add new vidoes to top of playlist.

The payload of the request that youtube makes when i check the settings is:

{
   "context : {...}
    "actions": [
        {
            "action": "ACTION_SET_ADD_TO_TOP",
            "addToTop": true
        }
    ],
    "params": "CAE%3D",
    "playlistId": "PL6UiYPIiWO0CSFJgSAMBHpEN5dH2Yd1Ij"
}

So perhaps this could be implemented?

<!-- gh-comment-id:1737283396 --> @zeitmeister commented on GitHub (Sep 27, 2023): - Go to youtube.com and log in as same user that you use with ytmusicapi. - Find and click on your playlist on the left hand side of the page. - Click the three dots on the playlist info box, select Playlist Settings. - Check the Add new vidoes to top of playlist. The payload of the request that youtube makes when i check the settings is: ``` { "context : {...} "actions": [ { "action": "ACTION_SET_ADD_TO_TOP", "addToTop": true } ], "params": "CAE%3D", "playlistId": "PL6UiYPIiWO0CSFJgSAMBHpEN5dH2Yd1Ij" } ``` So perhaps this could be implemented?
Author
Owner

@sigma67 commented on GitHub (Sep 27, 2023):

Ah, it's a setting toggle. Interesting. Will have to experiment, but behind the scenes it's the same Innertube API, so it might be possible.

I'm just not sure how that would integrate with the existing API, we'd probably modify edit_playlist with a new parameter.

<!-- gh-comment-id:1737459487 --> @sigma67 commented on GitHub (Sep 27, 2023): Ah, it's a setting toggle. Interesting. Will have to experiment, but behind the scenes it's the same Innertube API, so it might be possible. I'm just not sure how that would integrate with the existing API, we'd probably modify `edit_playlist` with a new parameter.
Author
Owner

@sigma67 commented on GitHub (Sep 27, 2023):

Thanks for the report. Last time I really touched this function was more than 3 years ago, so I barely remembered ^^

<!-- gh-comment-id:1737977990 --> @sigma67 commented on GitHub (Sep 27, 2023): Thanks for the report. Last time I really touched this function was more than 3 years ago, so I barely remembered ^^
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#333
No description provided.