Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YouTube Music Plugin Error: "Unable to fetch PO Token for web_music client" and "No audio was received" #3531

Open
1 task done
tibrezus opened this issue Feb 3, 2025 · 11 comments
Assignees
Labels
bug Something isn't working

Comments

@tibrezus
Copy link

tibrezus commented Feb 3, 2025

What version of Music Assistant has the issue?

2.4.0b23

Have you tried everything in the Troubleshooting FAQ and reviewed the Open and Closed Issues and Discussions to resolve this yourself?

  • Yes

The problem

After successfully registering with the YouTube Music plugin using my cookie and user ID, playback works as expected for about 30 minutes. However, after this period, I encounter the following errors:

  • "Unable to fetch PO Token for web_music client: Missing required Data Sync ID for account"
    This warning appears repeatedly in the logs, suggesting an issue with authentication or session management, what ID should I use? Right now I use my email address

The issue disrupts playback by looping the track playback start without any audio being heard, and requires manual intervention which implies restarting the music assistant service.

How to reproduce

  1. Register with the YouTube Music plugin using a valid cookie and user ID.
  2. Start playback of a track or queue.
  3. Allow playback to continue for approximately 30 minutes.
  4. Observe the errors in the logs and the failure of playback.

Music Providers

YouTube Music

Player Providers

Slimproto (Squeezebox Players)

Full log output

d5369777_music_assistant_beta_2025-02-03T12-01-31.342Z.log

Additional information

This happens with all the musicassistant versions, stable beta and dev, I'm fighting with it for months now.
I run the music assistant plugin on a raspberry pi 4 8GB RAM, While looping in the playback process with no audio the CPU goes to 100% on one thread, memory is also quite high reachine over 1GB based on the usage I make.
Other providers work just fine.

What version of Home Assistant Core are your running

2025.1.4

What type of installation are you running?

Home Assistant OS

On what type of hardware are you running?

Raspberry Pi

@tibrezus tibrezus added the triage label Feb 3, 2025
@OzGav
Copy link
Contributor

OzGav commented Feb 3, 2025

@MarvinSchenkel

@RobinR1
Copy link

RobinR1 commented Feb 7, 2025

I see the same on stable, except that restarting MA server disabled the YT provider with the above mentioned errors repeated evey two minutes:

WARNING: [youtube] Unable to fetch PO Token for web_music client: Missing required Data Sync ID for account. You may need to pass a Data Sync ID with --extractor-args "youtube:data_sync_id=XXX"

WARNING (MainThread) [music_assistant] Error loading provider(instance) YouTube Music: User does not have Youtube Music Premium (will be retried later)

I see in pytubefix project fixes related PO token and botdetection:
https://github.com/JuanBindez/pytubefix/tree/v8.12.0
https://github.com/JuanBindez/pytubefix/tree/v8.12.1

@MarvinSchenkel MarvinSchenkel self-assigned this Feb 8, 2025
@MarvinSchenkel MarvinSchenkel added bug Something isn't working and removed triage labels Feb 8, 2025
@MrHollowX
Copy link

WARNING: [youtube] Unable to fetch PO Token for web_music client: Missing required Data Sync ID for account. You may need to pass a Data Sync ID with --extractor-args "youtube:data_sync_id=XXX"
2025-02-15 19:15:34.484 INFO (MainThread) [music_assistant] Loaded music provider YouTube Music
WARNING: [youtube] Unable to fetch PO Token for web_music client: Missing required Data Sync ID for account. You may need to pass a Data Sync ID with --extractor-args "youtube:data_sync_id=XXX"
2025-02-15 19:16:51.233 INFO (MainThread) [music_assistant.streams] Start Queue Flow stream for Queue Kitchen - crossfade: False
WARNING: [youtube] Unable to fetch PO Token for web_music client: Missing required Data Sync ID for account. You may need to pass a Data Sync ID with --extractor-args "youtube:data_sync_id=XXX"
2025-02-15 19:16:54.529 ERROR (MainThread) [music_assistant] Error doing task: Task exception was never retrieved

Same issue, hope this gets fixed asap as it is unusable right now.

@MarvinSchenkel
Copy link
Contributor

Was not able to reproduce this issue, but got hit with this this morning. It seems this is a very misleading message that occurs when your cookie has expired. For me, obtaining and configuring a fresh cookie fixed it. Can you confirm this works for you, then we will add this to the FAQ.

@RobinR1
Copy link

RobinR1 commented Feb 24, 2025

Sorry, I ditched YT Music as they clearly don't want the money of people using opensource tools to use their platform. I switched to Deezer for it being a European company and having clear API docs, hoping for less problems with it in open source software. For now MA works great with it.
But I can no longer test YT music.

@tibrezus
Copy link
Author

Sorry to hear that, however, It happens much less when the CPU is below 20% constant usage. When even slightly congested the behaviour is much more obvious. I think using the latest versions of python with the efficiency/multi threading optimizations might help.

@OzGav
Copy link
Contributor

OzGav commented Feb 25, 2025

@tibrezus you did not answer @MarvinSchenkel ’s question. Does refreshing the cookie fix the problem?

@tibrezus
Copy link
Author

tibrezus commented Feb 26, 2025

Refreshing the cookie does not solve the issue, after refreshing the cookie and trying to play again the CPU will go 100% on one thread and remain there, the search and metadata works correctly but when trying to play a song it will visually start playing with the progression bar looping between 0 and about 10 seconds with no audio.

This however did not happen on all versions, in the versions between 2.4.0RC0 and RC7 the player worked fine, RC8 broke it again. The 2.5.0RC0 seems to work fine again.

Yet I am not sure if this is due to YouTube messing up the backend or due to changes in Music Assistant.

When the issue happen logs will output this:

WARNING: [youtube] Unable to fetch PO Token for web_music client: Missing required Data Sync ID for account. You may need to pass a Data Sync ID with --extractor-args "youtube:data_sync_id=XXX"
2025-02-26 10:33:58.655 ERROR (MainThread) [music_assistant.audio.media_stream] Error while streaming ytmusic://track/sNaQBEcUqsI: No audio was received
2025-02-26 10:33:58.680 ERROR (MainThread) [music_assistant.streams] Error streaming QueueItem French 79 & Sarah Rebecca - Diamond Veins (ytmusic://track/sNaQBEcUqsI) to piCorePlayer
2025-02-26 10:33:59.515 INFO (MainThread) [music_assistant.streams] Start serving audio stream for QueueItem Monolink - Reflections (ytmusic://track/kKYYydqWHz4) to piCorePlayer
WARNING: [youtube] Unable to fetch PO Token for web_music client: Missing required Data Sync ID for account. You may need to pass a Data Sync ID with --extractor-args "youtube:data_sync_id=XXX"
2025-02-26 10:34:25.850 ERROR (MainThread) [music_assistant.audio.media_stream] Error while streaming ytmusic://track/kKYYydqWHz4: No audio was received
2025-02-26 10:34:25.875 ERROR (MainThread) [music_assistant.streams] Error streaming QueueItem Monolink - Reflections (ytmusic://track/kKYYydqWHz4) to piCorePlayer
2025-02-26 10:34:26.822 INFO (MainThread) [music_assistant.streams] Start serving audio stream for QueueItem Mason - Exceeder (ytmusic://track/kl-x-D882XQ) to piCorePlayer
WARNING: [youtube] Unable to fetch PO Token for web_music client: Missing required Data Sync ID for account. You may need to pass a Data Sync ID with --extractor-args "youtube:data_sync_id=XXX"
2025-02-26 10:34:44.900 INFO (MainThread) [music_assistant.player_queues] Fetching tracks to play for artist Vitalic
WARNING: [youtube] Unable to fetch PO Token for web_music client: Missing required Data Sync ID for account. You may need to pass a Data Sync ID with --extractor-args "youtube:data_sync_id=XXX"
2025-02-26 10:34:53.577 ERROR (MainThread) [music_assistant.audio.media_stream] Error while streaming ytmusic://track/kl-x-D882XQ: No audio was received
2025-02-26 10:34:53.718 ERROR (MainThread) [music_assistant.streams] Error streaming QueueItem Mason - Exceeder (ytmusic://track/kl-x-D882XQ) to piCorePlayer
2025-02-26 10:34:54.872 ERROR (MainThread) [aioslimproto.client.piCorePlayer] Server responds with status 404 Unknown Queue item: 929b4048fef14a80b53b9005c1a78dd7
2025-02-26 10:34:57.273 INFO (MainThread) [music_assistant.streams] Start serving audio stream for QueueItem NTO/Vitalic - Cœur Noir (library://track/955) to piCorePlayer
WARNING: [youtube] Unable to fetch PO Token for web_music client: Missing required Data Sync ID for account. You may need to pass a Data Sync ID with --extractor-args "youtube:data_sync_id=XXX"
2025-02-26 10:35:23.598 ERROR (MainThread) [music_assistant.audio.media_stream] Error while streaming ytmusic://track/dOLEf-MhdgU: No audio was received
2025-02-26 10:35:23.627 ERROR (MainThread) [music_assistant.streams] Error streaming QueueItem NTO/Vitalic - Cœur Noir (library://track/955) to piCorePlayer
2025-02-26 10:35:24.575 INFO (MainThread) [music_assistant.streams] Start serving audio stream for QueueItem Vitalic - Poison Lips (ytmusic://track/JCJtCeDmTlI) to piCorePlayer
WARNING: [youtube] Unable to fetch PO Token for web_music client: Missing required Data Sync ID for account. You may need to pass a Data Sync ID with --extractor-args "youtube:data_sync_id=XXX"

@MarvinSchenkel
Copy link
Contributor

MarvinSchenkel commented Feb 26, 2025

So to summarize: Refreshing a cookie solves this issue on the latest version of MA (2.4.0 stable or 2.5.0B0)? Please note that cookies will expire faster when you are using the same account as the one on the YTM web app / mobile app.

@tibrezus
Copy link
Author

It is not the cookie refresh that solves the issue, when the issue happens cookie refresh makes no difference.

When the cookies expires on a working version I know it because the search funcionality does not work, and as soon as I add a new one everything works as expected.

@OzGav OzGav removed the More info label Mar 2, 2025
@tibrezus
Copy link
Author

tibrezus commented Mar 2, 2025

@MarvinSchenkel I have an update, it happened a few times that when the issue above happens and I restart the the music_assistant process without updating the cookie, this results expired. Updating it solves the issue.
So as a recap.

The issue is, after a while music_assitant will stop playing songs from the youtube provider, and changing the cookie itself will not solve the issue; the player will loop on the first seconds of a song with no audio output.

On the current version (2.5.0b5) when the same issue happens, if I restart the process, the cookie will result as expired, and changing it will fix the issue.

I think a good fix for this would be to know if the cookie is expired and replacement should work without the need of the process restart.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants