mirror of
https://github.com/sigma67/ytmusicapi.git
synced 2026-04-25 23:36:00 +03:00
[GH-ISSUE #143] Persistent Playlist Error #107
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#107
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 @k-a-r-g on GitHub (Jan 5, 2021).
Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/143
Hello,
I know this has been covered in the forum already, but non of the suggested solutions seems to work for me. A.so the log file asks me to open an issue :)
I have just installed the integration for the first time, followed all instructions, updated to the latest version in HACS, but get the following error:
2021-01-05 07:48:57 ERROR (SyncWorker_12) [custom_components.ytube_music_player.media_player] Traceback (most recent call last): File "/config/custom_components/ytube_music_player/media_player.py", line 995, in play_media self._tracks = self._api.get_playlist(playlistId=media_id,limit=999)['tracks'] File "/usr/local/lib/python3.8/site-packages/ytmusicapi/mixins/playlists.py", line 100, in get_playlist playlist['tracks'].extend(parse_playlist_items(results['contents'])) KeyError: 'contents'After reading several posts on the forum, I made sure that:
However, none of the tried solutions solved the issue.
Thanks a lot in advance.
Best,
Timm
@sigma67 commented on GitHub (Jan 5, 2021):
How many items does the playlist have that you're trying to view? Does this error happen every time you access it? Is it a private playlist or could you make it public for us to test it?
@k-a-r-g commented on GitHub (Jan 6, 2021):
Hi, thanks for the quick reply.
It is the "Your Likes" Playlist with currently two entries. I have increased the item count to five songs, but behavior is unchanged. Zes, it happens everytime. Unfortunately, I believe YouTube does not allow to make that one public.
I enabled a more detailed error logging and get the following information in addition to what ahs been posted above:
2021-01-06 09:31:31 DEBUG (SyncWorker_2) [custom_components.ytube_music_player.media_player] _update_playlists 2021-01-06 09:31:32 DEBUG (SyncWorker_2) [custom_components.ytube_music_player.media_player] - 1 Playlists loaded 2021-01-06 09:31:32 DEBUG (SyncWorker_2) [custom_components.ytube_music_player.media_player] - Failed to get_playlist count for playlist ID 'LM' setting it to 25@sigma67 commented on GitHub (Jan 6, 2021):
@KoljaWindeler any idea what is causing this?
@KoljaWindeler commented on GitHub (Jan 6, 2021):
Are you using a Mini-Media-Player link to start this playlist or how to you start the playlist.
Looks like you are calling the service with "LM" as Id. This changed with the last version (my code) and isn't supported anymore. Please use the corresponding playlist_id ...
Edit: please read https://github.com/KoljaWindeler/ytube_music_player#shortcuts and the service chapter below
@k-a-r-g commented on GitHub (Jan 7, 2021):
So far I was not actively starting a playlist at all, and I guess that boils down to be the problem.
The loading of the integration during startup already prompted the error. Similarly, restarting the integration through Mini-Media-Player interface throws the error.
However, after your questions, I triggered a specific playlist through manually calling a service - and that worked well without any errors.
Is there a way to avoid loading LM playlist by default?
@KoljaWindeler commented on GitHub (Jan 7, 2021):
Ah .. ok .. my bad .. I was a bit in a rush yesterday and only read it completely now ..
The added debug information is the key here ... you are right: this is during the init_phase.
During that phase my code requests all playlists from your account with
self._api.get_library_playlists(limit = 99)the LM (liked music) is autogenerated and a somewhat special .. it will not tell you how many tracks are in the list (['count']) .. but my understanding was, that @sigma67 fixed that already. Didn't you?
My workaround was to request the playlist extra information with:
self._api.get_playlist(playlistId=playlist['playlistId'])and that triggers the error .. which should total work ... so the ticket feels justified :)
Could you check witch version of the api you are using? it should be somewhere in the log further up and be 0.12.2 just to be sure. Also: Are you using the somewhat latest version? At least something from 202101**?
Kolja
@k-a-r-g commented on GitHub (Jan 7, 2021):
Hi,
glad I did not waste your time with a config error :)
Yes, it is using API version 0.12.2
2021-01-06 19:40:02 DEBUG (SyncWorker_4) [custom_components.ytube_music_player.media_player] - YouTube Api version: 0.12.2As for the ytube media player, I struggle to find the version number. Installation was through HACS and no available updates are displayed. Does that help?
@sigma67 commented on GitHub (Jan 7, 2021):
The way the exception handler is implemented we can't be sure that it was caused by the count, since the original exception is not printed.
github.com/KoljaWindeler/ytube_music_player@f4219bd5c2/custom_components/ytube_music_player/media_player.py (L694-L706)Assuming that the original error at the very top also relates to the same issue, it seems the 'contents' key is missing again. This is the same problem we are facing in several other issues, likely related to a 403 error.
@KoljaWindeler commented on GitHub (Jan 7, 2021):
dang it .. the longer I read about it, the stranger it gets.
The error at the very top points to this line, right:
github.com/KoljaWindeler/ytube_music_player@ef9ebb8550/custom_components/ytube_music_player/media_player.py (L995)"- Failed to get_playlist count for playlist ID 'LM' setting it to 25" is in a total different place:
github.com/KoljaWindeler/ytube_music_player@ef9ebb8550/custom_components/ytube_music_player/media_player.py (L660)So after all you might be right .. bad cookie problem?
I've just updated my integration to try a login and grab a lib_playlist right after creating the header file .. maybe that will help in the future to avoid problems like this ..
So @k-a-r-g could you try to grab the cookie again? Maybe in a incognito session
@k-a-r-g commented on GitHub (Jan 8, 2021):
Hello,
unfortunately, the error persists after the update.
Grabbing and posting the cookie again failed, due to the following message by the gui frontend of the integration:
2021-01-08 07:39:36 ERROR (MainThread) [custom_components.ytube_music_player.const] Field 'X-Goog-AuthUser' not found!
Checking the cookie, the X-Goog-AuthUSer field was present. Similarly, copy/pasting cookie information from the existing ytube_header.json file threw the same frontend error.
Unfortunatelz I have to go to work now, but I can trz to manually create the cookie file in the evening...
@KoljaWindeler commented on GitHub (Jan 8, 2021):
Jep, that's indeed a bug. I've seen it yesterday and fixed it already. Will take a few days as that release will contain a boatload of new features.
You can change the string to lower in
github.com/KoljaWindeler/ytube_music_player@a9d729b906/custom_components/ytube_music_player/const.py (L236)elif(c.find('X-Goog-AuthUser')
To
elif(c.find('x-goog-authuser')
@sigma67 commented on GitHub (Jan 10, 2021):
Is there still a potential error within ytmusicapi or can we close this as well?
@KoljaWindeler commented on GitHub (Jan 11, 2021):
hmm not sure
the new version of my code should fix the bug with the caps written x-goog-auth