[GH-ISSUE #454] feedbackTokens add and remove are swapped #337

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

Originally created by @adamhl8 on GitHub (Oct 9, 2023).
Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/454

It seems like the add and remove keys are swapped in feedbackTokens.

yt = YTMusic("oauth.json")
tracks = yt.get_library_songs(500)
remove_token = tracks[0].get("feedbackTokens").get("remove")
response = yt.edit_song_library_status([remove_token])
print(response)
...
{'responseText': {'runs': [{'text': 'Added to library'}]}

As you can see I get Added to library. I also checked YTM and the track is still there.

If I instead get the add token:

yt = YTMusic("oauth.json")
tracks = yt.get_library_songs(500)
add_token = tracks[0].get("feedbackTokens").get("add")
response = yt.edit_song_library_status([add_token])
print(response)
...
{'responseText': {'runs': [{'text': 'Removed from library'}]}

Which does actually remove the track from YTM.

Originally created by @adamhl8 on GitHub (Oct 9, 2023). Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/454 It seems like the `add` and `remove` keys are swapped in `feedbackTokens`. ```python yt = YTMusic("oauth.json") tracks = yt.get_library_songs(500) remove_token = tracks[0].get("feedbackTokens").get("remove") response = yt.edit_song_library_status([remove_token]) print(response) ``` ``` ... {'responseText': {'runs': [{'text': 'Added to library'}]} ``` As you can see I get `Added to library`. I also checked YTM and the track is still there. If I instead get the `add` token: ```python yt = YTMusic("oauth.json") tracks = yt.get_library_songs(500) add_token = tracks[0].get("feedbackTokens").get("add") response = yt.edit_song_library_status([add_token]) print(response) ``` ``` ... {'responseText': {'runs': [{'text': 'Removed from library'}]} ``` Which does actually remove the track from YTM.
kerem 2026-02-27 23:00:16 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@sigma67 commented on GitHub (Oct 9, 2023):

That must be a bug. Are you sure that's what's happening and not some problem with your code?

For reference, this function has been unchanged for two years.

github.com/sigma67/ytmusicapi@05a5fb8153/ytmusicapi/parsers/songs.py (L65-L79)

<!-- gh-comment-id:1753377961 --> @sigma67 commented on GitHub (Oct 9, 2023): That must be a bug. Are you sure that's what's happening and not some problem with your code? For reference, this function has been unchanged for two years. https://github.com/sigma67/ytmusicapi/blob/05a5fb81533089716ce38516dafcdda50c606917/ytmusicapi/parsers/songs.py#L65-L79
Author
Owner

@adamhl8 commented on GitHub (Oct 9, 2023):

I posted my code verbatim. What's the purpose of swapping the tokens on 71? I assume that's what's causing the behavior I'm seeing.

<!-- gh-comment-id:1753383887 --> @adamhl8 commented on GitHub (Oct 9, 2023): I posted my code verbatim. What's the purpose of swapping the tokens on `71`? I assume that's what's causing the behavior I'm seeing.
Author
Owner

@sigma67 commented on GitHub (Oct 24, 2023):

Yeah sorry this was buggy. I also added a inLibrary flag now to indicate the current status

<!-- gh-comment-id:1777962408 --> @sigma67 commented on GitHub (Oct 24, 2023): Yeah sorry this was buggy. I also added a `inLibrary` flag now to indicate the current status
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#337
No description provided.