[GH-ISSUE #107] Enhancement - Add an option to remove duplicate songs from a playlist #81

Closed
opened 2026-02-27 22:07:54 +03:00 by kerem · 6 comments
Owner

Originally created by @sheenwins on GitHub (Nov 18, 2020).
Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/107

I like copying Spotify playlists over to YoutubeMusic and then adding that playlist to my main playlist in YoutubeMusic. However, doing this causes songs to duplicate when they already exist. I would love an option to automatically remove duplicate songs in any given playlist. Seem doable?

Originally created by @sheenwins on GitHub (Nov 18, 2020). Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/107 I like copying Spotify playlists over to YoutubeMusic and then adding that playlist to my main playlist in YoutubeMusic. However, doing this causes songs to duplicate when they already exist. I would love an option to automatically remove duplicate songs in any given playlist. Seem doable?
kerem closed this issue 2026-02-27 22:07:55 +03:00
Author
Owner

@sigma67 commented on GitHub (Nov 18, 2020):

See here: https://ytmusicapi.readthedocs.io/en/latest/reference.html#ytmusicapi.YTMusic.add_playlist_items

You can choose to not add duplicates when using add_playlist_items.

I would love an option to automatically remove duplicate songs in any given playlist. Seem doable?

You can implement this yourself using get_playlist and remove_playlist_items.

<!-- gh-comment-id:729673422 --> @sigma67 commented on GitHub (Nov 18, 2020): See here: https://ytmusicapi.readthedocs.io/en/latest/reference.html#ytmusicapi.YTMusic.add_playlist_items You can choose to not add duplicates when using add_playlist_items. > I would love an option to automatically remove duplicate songs in any given playlist. Seem doable? You can implement this yourself using get_playlist and remove_playlist_items.
Author
Owner

@sheenwins commented on GitHub (Nov 19, 2020):

Hi and thanks for the reply!
looking at spotifyplaylist_to_gmusic, it seems to be exactly what I want.
great job!
however, I'm still struggling with figuring out how to supply a destination
YTMusic playlist name/id.
what would the command line be to copy a spotify playlist to an already
existing YTMusic playlist?
im working on my python skills and I was able to successfully run the
ytmusicapi functions, but it's gonna take me a while to get a working
project together...so hoping you can help me out!

Thanks!
Jeff

On Wed, Nov 18, 2020 at 8:22 AM sigmatics notifications@github.com wrote:

See here:
https://ytmusicapi.readthedocs.io/en/latest/reference.html#ytmusicapi.YTMusic.add_playlist_items

You can choose to not add duplicates when using add_playlist_items.

I would love an option to automatically remove duplicate songs in any
given playlist. Seem doable?

You can implement this yourself using get_playlist and
remove_playlist_items.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/sigma67/ytmusicapi/issues/107#issuecomment-729673422,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AILSY7M27BNEK76RH323E2LSQPC7ZANCNFSM4TZJR4IQ
.

<!-- gh-comment-id:730410510 --> @sheenwins commented on GitHub (Nov 19, 2020): Hi and thanks for the reply! looking at spotifyplaylist_to_gmusic, it seems to be exactly what I want. great job! however, I'm still struggling with figuring out how to supply a destination YTMusic playlist name/id. what would the command line be to copy a spotify playlist to an already existing YTMusic playlist? im working on my python skills and I was able to successfully run the ytmusicapi functions, but it's gonna take me a while to get a working project together...so hoping you can help me out! Thanks! Jeff On Wed, Nov 18, 2020 at 8:22 AM sigmatics <notifications@github.com> wrote: > See here: > https://ytmusicapi.readthedocs.io/en/latest/reference.html#ytmusicapi.YTMusic.add_playlist_items > > You can choose to not add duplicates when using add_playlist_items. > > I would love an option to automatically remove duplicate songs in any > given playlist. Seem doable? > > You can implement this yourself using get_playlist and > remove_playlist_items. > > — > You are receiving this because you authored the thread. > Reply to this email directly, view it on GitHub > <https://github.com/sigma67/ytmusicapi/issues/107#issuecomment-729673422>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/AILSY7M27BNEK76RH323E2LSQPC7ZANCNFSM4TZJR4IQ> > . >
Author
Owner

@sigma67 commented on GitHub (Nov 19, 2020):

what would the command line be to copy a spotify playlist to an already existing YTMusic playlist?

You can use the command line switch --update. You need to provide the correct name of the playlist you want to update. From the project description:

--update PLAYLIST_NAME
  Delete all entries in the provided Google Play Music playlist and update the playlist with entries from the Spotify playlist.

Despite the description, this switch also works with YouTube Music.

Hope that helps!

<!-- gh-comment-id:730422098 --> @sigma67 commented on GitHub (Nov 19, 2020): > what would the command line be to copy a spotify playlist to an already existing YTMusic playlist? You can use the command line switch `--update`. You need to provide the correct name of the playlist you want to update. From the project description: ``` --update PLAYLIST_NAME Delete all entries in the provided Google Play Music playlist and update the playlist with entries from the Spotify playlist. ``` Despite the description, this switch also works with YouTube Music. Hope that helps!
Author
Owner

@sheenwins commented on GitHub (Nov 19, 2020):

thank you, that worked!

I was confused with the arguments documentation:

-u UPDATE, --update UPDATE

might be better as:

-u <PLAYLIST_NAME>
or
-u PLAYLIST

Thanks!!

On Thu, Nov 19, 2020 at 9:45 AM sigmatics notifications@github.com wrote:

what would the command line be to copy a spotify playlist to an already
existing YTMusic playlist?

You can use the command line switch --update. You need to provide the
correct name of the playlist you want to update. From the project
description:

--update PLAYLIST_NAME
Delete all entries in the provided Google Play Music playlist and update the playlist with entries from the Spotify playlist.

Despite the description, this switch also works with YouTube Music.

Hope that helps!


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/sigma67/ytmusicapi/issues/107#issuecomment-730422098,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AILSY7LQBW62DG4Q4FCSOB3SQUVRTANCNFSM4TZJR4IQ
.

<!-- gh-comment-id:730437534 --> @sheenwins commented on GitHub (Nov 19, 2020): thank you, that worked! I was confused with the arguments documentation: -u UPDATE, --update UPDATE might be better as: -u <PLAYLIST_NAME> or -u *PLAYLIST* Thanks!! On Thu, Nov 19, 2020 at 9:45 AM sigmatics <notifications@github.com> wrote: > what would the command line be to copy a spotify playlist to an already > existing YTMusic playlist? > > You can use the command line switch --update. You need to provide the > correct name of the playlist you want to update. From the project > description: > > --update PLAYLIST_NAME > Delete all entries in the provided Google Play Music playlist and update the playlist with entries from the Spotify playlist. > > Despite the description, this switch also works with YouTube Music. > > Hope that helps! > > — > You are receiving this because you authored the thread. > Reply to this email directly, view it on GitHub > <https://github.com/sigma67/ytmusicapi/issues/107#issuecomment-730422098>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/AILSY7LQBW62DG4Q4FCSOB3SQUVRTANCNFSM4TZJR4IQ> > . >
Author
Owner

@sheenwins commented on GitHub (Nov 20, 2020):

ok, I'm making some progress. I'm able to copy a spotify playlist to a
youtubemusic playlist with it deleting all the songs in the destination
playlist first. and im also able to use remove_playlist_items to remove
some songs from that playlist after. however...

is there a way to use YouTube.py to copy a playlist from spotify to an
existing youttubemusic playlist without deleting all the tracks in that
destination playlist? that way, i can manually add to that playlist and
not worry abt it getting deleted when it gets 'refreshed' from spotify.
and if so, also have it not add duplicates?

thank you for your help!
Jeff

On Wed, Nov 18, 2020 at 8:22 AM sigmatics notifications@github.com wrote:

See here:
https://ytmusicapi.readthedocs.io/en/latest/reference.html#ytmusicapi.YTMusic.add_playlist_items

You can choose to not add duplicates when using add_playlist_items.

I would love an option to automatically remove duplicate songs in any
given playlist. Seem doable?

You can implement this yourself using get_playlist and
remove_playlist_items.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/sigma67/ytmusicapi/issues/107#issuecomment-729673422,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AILSY7M27BNEK76RH323E2LSQPC7ZANCNFSM4TZJR4IQ
.

<!-- gh-comment-id:730719804 --> @sheenwins commented on GitHub (Nov 20, 2020): ok, I'm making some progress. I'm able to copy a spotify playlist to a youtubemusic playlist with it deleting all the songs in the destination playlist first. and im also able to use remove_playlist_items to remove some songs from that playlist after. however... is there a way to use YouTube.py to copy a playlist from spotify to an existing youttubemusic playlist without deleting all the tracks in that destination playlist? that way, i can manually add to that playlist and not worry abt it getting deleted when it gets 'refreshed' from spotify. and if so, also have it not add duplicates? thank you for your help! Jeff On Wed, Nov 18, 2020 at 8:22 AM sigmatics <notifications@github.com> wrote: > See here: > https://ytmusicapi.readthedocs.io/en/latest/reference.html#ytmusicapi.YTMusic.add_playlist_items > > You can choose to not add duplicates when using add_playlist_items. > > I would love an option to automatically remove duplicate songs in any > given playlist. Seem doable? > > You can implement this yourself using get_playlist and > remove_playlist_items. > > — > You are receiving this because you authored the thread. > Reply to this email directly, view it on GitHub > <https://github.com/sigma67/ytmusicapi/issues/107#issuecomment-729673422>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/AILSY7M27BNEK76RH323E2LSQPC7ZANCNFSM4TZJR4IQ> > . >
Author
Owner

@sigma67 commented on GitHub (Nov 20, 2020):

Not yet, but feel free to fork and modify the code in spotifyplaylist_to_gmusic to your liking

<!-- gh-comment-id:731018975 --> @sigma67 commented on GitHub (Nov 20, 2020): Not yet, but feel free to fork and modify the code in spotifyplaylist_to_gmusic to your liking
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#81
No description provided.