mirror of
https://github.com/sigma67/ytmusicapi.git
synced 2026-04-25 23:36:00 +03:00
[GH-ISSUE #141] Seems like the API is not returning any of my playlists #104
Labels
No labels
a/b
bug
documentation
enhancement
good first issue
help wanted
invalid
pull-request
question
wontfix
yt-error
yt-update
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/ytmusicapi#104
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @bobvmierlo on GitHub (Jan 3, 2021).
Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/141
It seems like this API is not returning any of my playlists while being used within KoljaWindeler's custom integration for Home Assistant.
See issue here
Any chance you can figure out the problem?
@KoljaWindeler commented on GitHub (Jan 3, 2021):
FYI this is here
github.com/KoljaWindeler/ytube_music_player@03f515d3d9/custom_components/ytube_music_player/media_player.py (L634)Straight call with limit=99
@sigma67 commented on GitHub (Jan 3, 2021):
Have you double checked that your credentials are correct? Can you interact with other library functionality, like liking songs, getting library artists etc.)?
@bobvmierlo commented on GitHub (Jan 4, 2021):
When I hardcode the playlist ID in homeassistant it starts the playlist and also retrieves songtitle, artist and artwork.
It just seems like the API is not returning my list of playlists, but it does work when hardcoding the playlist ID.
Also to answer your first question, i've checked my credentials multiple times to rule this issue out.
Does this answer your question?
@sigma67 commented on GitHub (Jan 4, 2021):
That does not require authenticated credentials, unless the playlist is private.
Assuming the issue is not with the credentials, could you follow the instructions here and report back?
@KoljaWindeler commented on GitHub (Jan 4, 2021):
Hmm maybe. Is there a way to test if a "login" worked out?
My code runs a lib function call right after login (self._api.get_library_songs()) that usually throws a exception if something isn't correct with the cookie . That didn't happen here.
Kolja
@sigma67 commented on GitHub (Jan 4, 2021):
Ah that's good to know. But then the playlists should be returned as well, unless he has a brand account with no playlists or an error is thrown.
@bobvmierlo commented on GitHub (Jan 4, 2021):
I retried configuring with the instructions you linked above:
Still no playlist titles though.
My playlists are all public, and I'm not sure what you mean by a brand account. My account is a old personal gmail account from way back when youtube started.
@sigma67 commented on GitHub (Jan 4, 2021):
Sorry if I wasn't clear, could you upload the response that you copied in the instructions to Pastebin or post it here? Just so I can see what is being returned and why it isn't being processed. The assumption is that there is an error parsing your playlists due to some special playlists you might have.
@KoljaWindeler commented on GitHub (Jan 4, 2021):
And just to make sure: you do have a youtube music premium subscription, right?
@bobvmierlo commented on GitHub (Jan 4, 2021):
I can paste the request header response, though I would like to leave some info out. Are there any fielda you specifically need for troubleshooting?
Also @KoljaWindeler: Yes I do have premium, it does not say anywhere in your repository that this is mandatory though..
@KoljaWindeler commented on GitHub (Jan 4, 2021):
True, added to readme just now .. i've never assumed that this would be the root-cause, just wanted to make sure
@sigma67 commented on GitHub (Jan 5, 2021):
All that's needed is the response, containing the playlists themselves (playlist titles, song counts). Feel free to redact playlist titles, I don't think that should be the cause (unless they're empty titles or something odd like that).
@bobvmierlo commented on GitHub (Jan 5, 2021):
This is what you're looking for probably: link
@bobvmierlo commented on GitHub (Jan 5, 2021):
And this is the reponse when opening a playlist: link
@sigma67 commented on GitHub (Jan 5, 2021):
Nothing unusual about those playlists, it parses just fine for me. It must be an issue with your credential setup. Sorry.
@KoljaWindeler commented on GitHub (Jan 5, 2021):
Actually the most common problem the user are facing. Only strange that the unit didn't threw an exception right?
Is there something like a check_login() method? That returns a bool ?
@sigma67 commented on GitHub (Jan 5, 2021):
That is actually performed every time you create an instance of YTMusic, by sending a request to
/guide. I'm not sure what the root of the issue is here, unfortunately. It must be something common to these users' accounts or how they set up the credentials. Obviously it works fine for us and most others using the project.@KoljaWindeler commented on GitHub (Jan 5, 2021):
Right.
So just to make sure: once an object ist created and can't login .. will it throw an exception or return false silently?
I'm trying to improve the login check
Currently this Is what I'm doing
github.com/KoljaWindeler/ytube_music_player@ef9ebb8550/custom_components/ytube_music_player/media_player.py (L120)@sigma67 commented on GitHub (Jan 5, 2021):
For me, if I provide invalid credentials, it raises an Exception. If you could demonstrate a case with invalid credentials where that doesn't happen that would be very helpful.
github.com/sigma67/ytmusicapi@af6aed7314/ytmusicapi/ytmusic.py (L95-L101)@KoljaWindeler commented on GitHub (Jan 5, 2021):
Just tried multiple versions, always get the exception.
But the super ultra strange case is the reason for this ticket. No error but still no valid data ;)
Not sure if @bobvmierlo wants to share his cookie data with you ;P
@sigma67 commented on GitHub (Jan 5, 2021):
I would like to avoid that if possible. I also think this is the same issue as #136, I just haven't been able to reproduce it. harrytouche mentioned that the response contains a 403 error code. If I could get my hands on a response object with this error I could implement a proper exception.
Perhaps we can provide a modified version of ytmusicapi to the user that dumps the response to some place where the user can easily access it and post it here. The relevant code would go here:
github.com/sigma67/ytmusicapi@a8ac347100/ytmusicapi/mixins/library.py (L27-L29)@KoljaWindeler commented on GitHub (Jan 6, 2021):
Alright, so I guess you need the repose printed out?
@bobvmierlo I've created a modified version of my code that includes the lib from @sigma67
could you download the zip from https://drive.google.com/file/d/1-qZ84oKzJuVI6vm---zeUdrCBbjeHA1A/view?usp=sharing
and replace your ytube_music_player folder in custom_components with this one?
That should return an error entry into the homeassistant log that contains the response @sigma67 is looking for.
For me it starts like:
021-01-06T10:51:33.364133940Z 2021-01-06 11:51:33 ERROR (SyncWorker_11) [custom_components.ytube_music_player.ytmusicapi.ytmusic] {'responseContext': {'visitorData': 'CgtW_________FUYyi0rNb_BQ%3D%3D', 'maxAgeSeconds': 0, 'serviceTrackingParams': [{'service': 'GFEEDB
@sigma67 could you advice which of those field should be removed/masked before posting it here?
@sigma67 commented on GitHub (Jan 6, 2021):
Thanks for your support. I'm mainly looking for an 'error' key in the JSON. Although the response shouldn't contain anything confidential that hasn't already been posted further up in this issue.
@bobvmierlo commented on GitHub (Jan 6, 2021):
The error response below:
@sigma67 commented on GitHub (Jan 6, 2021):
Thanks for helping, again. Unfortunately I forgot that only the response text is returned to the callee of _send_request. So the status code is not contained in the response above. I created a new branch 4xx where an exception is raised on 4xx errors. That should result in a proper error message.
Unfortunately if we find that indeed 403 is returned, this still doesn't solve the root of the issue: Why are the credentials not working?
@sigma67 commented on GitHub (Jan 8, 2021):
Perhaps you could try again with the 4xx branch of ytmusicapi? I would go ahead and merge that if it correctly raises the exception for you.
@KoljaWindeler commented on GitHub (Jan 8, 2021):
I can create another package for @bobvmierlo .. if you @bobvmierlo haven't reached your frustration level ;)
Alternative approach: since the cookie data aren't working anyway: would it be an option that @bobvmierlo shares his cookie data with @sigma67 ?
@bobvmierlo commented on GitHub (Jan 8, 2021):
I'd like to get this working, so i'm happy to help you guys out anyway I can.
Also I can share my cookie info with @sigma67 if that helps him. I'd like to do it privately though.
@KoljaWindeler commented on GitHub (Jan 8, 2021):
To be honest: I'd bet that you could simply create a new cookie by opening youtube music via incognito mode. But your current cookie is quite valuable. You don't get an exception during login but still no playlist. I guess there is something special going on.
@sigma67 commented on GitHub (Jan 9, 2021):
That would be quite helpful. You can send me an email with the info to ytmusicapi@gmail.com
@bobvmierlo commented on GitHub (Jan 10, 2021):
I emailed @sigma67 my cookie yesterday, let's hope he can figure something out with my info.
@bobvmierlo commented on GitHub (Jan 10, 2021):
@KoljaWindeler: I just noticed this error in the debug logs. Not sure if it means anything regarding this issue?
@KoljaWindeler commented on GitHub (Jan 10, 2021):
Hmm I think we're still facing the same error. You shouldn't see the 12.2 version string if your cookie is bad, but if the cookie is good you should get your playlists ...
@sigma67 commented on GitHub (Jan 10, 2021):
The cookie is alright, no errors found. I can even like songs on his behalf. But the associated library is empty. No playlists, no liked songs. Except the one that I just liked, which is now showing up.
So the sign-in credentials are valid and no issue with ytmusicapi so far. I'm fairly certain @bobvmierlo is signed in with multiple accounts/brand accounts, else I can't really explain this
@bobvmierlo commented on GitHub (Jan 10, 2021):
Okay, so after your last email I did some more digging. Eventually I found that I have some strange linked account to my main account that was marked as a brand account.
Apparently Google marked your account as a brand account if you've claimed a bussiness on Google Maps before 2007. Which apparently I did, after I'd deleted that weird account the playlists popped up.
Problem solved!
@sigma67 commented on GitHub (Jan 10, 2021):
Glad to hear! Don't forget to sign out and back in again to invalidate the credentials you sent me
@KoljaWindeler commented on GitHub (Jan 11, 2021):
thanks for your great support @sigma67 !!