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

New YTMusic Cookie Format? #195

Closed
jrlebbs opened this issue Sep 28, 2024 · 47 comments · Fixed by #203 or #236
Closed

New YTMusic Cookie Format? #195

jrlebbs opened this issue Sep 28, 2024 · 47 comments · Fixed by #203 or #236
Labels
bug Something isn't working fix waiting for release Fix has been committed and waiting for a release to be cut
Milestone

Comments

@jrlebbs
Copy link

jrlebbs commented Sep 28, 2024

Please check the FAQ before submitting a bug report.

Describe the bug
YouTube Music stopped authenticating as a source about 3 days ago. Logged in following the guide and the cookie now starts with "HSID" instead of "SID"

To Reproduce
Steps to reproduce the behavior:

  1. Follow the steps on the config guide: https://foxxmd.github.io/multi-scrobbler/docs/configuration/#youtube-music

Expected behavior
The cookie should auth YTMusic.

Logs
If possible reproduce the issue with debug logging ON

2024-09-27T23:27:29-06:00 debug : [Notifiers] [Ntfy - Multi-Scrobbler] Pushed notification.
2024-09-27T23:27:28-06:00 error : [Sources] [Ytmusic - YTMusic] Cannot start polling because source is not authenticated correctly.
2024-09-27T23:27:28-06:00 info : [App] Server started at http://localhost:9078
2024-09-27T23:27:27-06:00 warn : [Sources] ytmusic (YTMusic) source auth failed.
2024-09-27T23:27:26-06:00 debug : [Sources] Checking ytmusic (YTMusic) source auth...
2024-09-27T23:27:26-06:00 info : [Sources] ytmusic (YTMusic) source initialized
2024-09-27T23:27:26-06:00 debug : [Sources] Attempting ytmusic (YTMusic) initialization...
2024-09-27T23:27:26-06:00 debug : [Sources] (YTMusic) Constructing ytmusic source
2024-09-27T23:27:26-06:00 debug : [Sources] listenbrainz has 'configureAs: client' so will skip adding as a source
2024-09-27T23:27:26-06:00 debug : [Sources] lastfm has 'configureAs: client' so will skip adding as a source
2024-09-27T23:27:26-06:00 info : [Scrobblers] listenbrainz (brainz) client auth OK
2024-09-27T23:27:25-06:00 debug : [Scrobblers] Checking listenbrainz (brainz) client auth...
2024-09-27T23:27:25-06:00 info : [Scrobblers] listenbrainz (brainz) client initialized
2024-09-27T23:27:25-06:00 debug : [Scrobblers] Attempting listenbrainz (brainz) initialization...
2024-09-27T23:27:25-06:00 debug : [Scrobblers] Constructing listenbrainz (brainz) client...
2024-09-27T23:27:25-06:00 info : [Scrobblers] lastfm (myLastFm) client auth OK
2024-09-27T23:27:25-06:00 info : [API - Lastfm - myLastFm] Client authorized for user jrlebbs
2024-09-27T23:27:25-06:00 debug : [Scrobblers] Checking lastfm (myLastFm) client auth...
2024-09-27T23:27:25-06:00 info : [Scrobblers] lastfm (myLastFm) client initialized
2024-09-27T23:27:25-06:00 debug : [Scrobblers] Attempting lastfm (myLastFm) initialization...
2024-09-27T23:27:25-06:00 debug : [Scrobblers] Constructing lastfm (myLastFm) client...
2024-09-27T23:27:25-06:00 info : [Notifiers] [Ntfy - Multi-Scrobbler] Initialized. Found Ntfy server
.

Versions (please complete the following information):
Provide version information for any related sources/clients.

  • multi-scrobbler: unsure, installed about a year ago and not upgraded since. request help on how to find, if required
    -- running on windows

Additional context
I have tried several ways, reboots, etc. to get this to work. I suspect the cookie format has changed and I'm happy to provide more cookie details, just unsure of what's secure or not to be careful with.

Happy to help in any way!

@FoxxMD
Copy link
Owner

FoxxMD commented Sep 30, 2024

You should update your instance of Multi-Scrobbler...the last year of updates has really improved MS's stability and added a ton of features including knowing what version you are on.

However I am able to reproduce on current MS versions as well.

[2024-09-30 12:19:45.718 -0400] ERROR  : [App] [Sources] [Ytmusic - MyYTM] Authentication test failed!
Error: Authentication test failed!
    at YTMusicSource.testAuth (CWD/src/backend/common/AbstractComponent.ts:235:31)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at YTMusicSource.initialize (CWD/src/backend/common/AbstractComponent.ts:56:13)
    at ScrobbleSources.addSource (CWD/src/backend/sources/ScrobbleSources.ts:596:18)
    at ScrobbleSources.buildSourcesFromConfig (CWD/src/backend/sources/ScrobbleSources.ts:497:25)
    at <anonymous> (CWD/src/backend/index.ts:115:9)
caused by: Error: Could not send the specified request to browse. Status code: 404
    at m.<anonymous> (CWD/node_modules/youtube-music-ts-api/build/exports.js:3:55514)
    at p (CWD/node_modules/youtube-music-ts-api/build/exports.js:3:46814)
    at Generator.<anonymous> (CWD/node_modules/youtube-music-ts-api/build/exports.js:3:48160)
    at Generator.next (CWD/node_modules/youtube-music-ts-api/build/exports.js:3:47243)
    at a (CWD/node_modules/youtube-music-ts-api/build/exports.js:3:53888)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

The endpoint is for music.youtube.com/youtubei/v1 with post data to the playlist id FEmusic_history. It's unclear if it's this specific endpoint of the playlist ID that is causing the 404.

MS uses another library to facilitate this communication so it's not something I can immediately fix or investigate but it looks like other projects relying on the endpoint are having issues as well. It may be that Youtube Music hanged their undocumented API endpoints or there is an internal issue that could be resolved.

@bockbilbo
Copy link

Coming from #199. Here are my logs, exactly the same as @FoxxMD:

[2024-10-08 22:25:03.884 -0700] DEBUG  : [App] [Sources] (Youtube Music) Constructing ytmusic source
[2024-10-08 22:25:03.885 -0700] DEBUG  : [App] [Sources] [Ytmusic - Youtube Music] Attempting to initialize...
[2024-10-08 22:25:03.885 -0700] VERBOSE: [App] [Sources] [Ytmusic - Youtube Music] Building required data init succeeded => Read initial credentials from config
[2024-10-08 22:25:03.886 -0700] DEBUG  : [App] [Sources] [Ytmusic - Youtube Music] Connection check was not required.
[2024-10-08 22:25:03.948 -0700] ERROR  : [App] [Sources] [Ytmusic - Youtube Music] Authentication test failed!
Error: Authentication test failed!
    at YTMusicSource.testAuth (CWD/src/backend/common/AbstractComponent.ts:235:31)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at YTMusicSource.initialize (CWD/src/backend/common/AbstractComponent.ts:56:13)
    at ScrobbleSources.addSource (CWD/src/backend/sources/ScrobbleSources.ts:596:18)
    at ScrobbleSources.buildSourcesFromConfig (CWD/src/backend/sources/ScrobbleSources.ts:497:25)
    at <anonymous> (CWD/src/backend/index.ts:115:9)
caused by: Error: Could not send the specified request to browse. Status code: 404
    at m.<anonymous> (CWD/node_modules/youtube-music-ts-api/build/exports.js:3:55514)
    at p (CWD/node_modules/youtube-music-ts-api/build/exports.js:3:46814)
    at Generator.<anonymous> (CWD/node_modules/youtube-music-ts-api/build/exports.js:3:48160)
    at Generator.next (CWD/node_modules/youtube-music-ts-api/build/exports.js:3:47243)
    at a (CWD/node_modules/youtube-music-ts-api/build/exports.js:3:53888)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[2024-10-08 22:25:03.953 -0700] INFO   : [App] [Sources] [Ytmusic - Youtube Music] Fully Initialized!

@FoxxMD
Copy link
Owner

FoxxMD commented Oct 9, 2024

Mostly talking to myself here but I've confirmed that the liked music endpoint still works when using oauth authentication with the original ytmusicapi python library. Using browser authentication, which is what yt-music-ts-api (MS) uses, is what is failing when trying to hit the endpoint.

FoxxMD added a commit that referenced this issue Oct 9, 2024
* Fixes #195 missing (404) history endpoint which only appear when using cookies
* Might fix #158 due to using a different authentication method
FoxxMD added a commit that referenced this issue Oct 9, 2024
* Fixes #195 missing (404) history endpoint which only appear when using cookies
* Might fix #158 due to using a different authentication method
@FoxxMD
Copy link
Owner

FoxxMD commented Oct 9, 2024

@jrlebbs @bockbilbo please try out the new YTM auth in #203 and let me know if this fixes things for you -- foxxmd/multi-scrobbler:pr-203 and check out the Usage section in the PR comment.

@bockbilbo
Copy link

@FoxxMD the new pr is not working, I am getting an exception for a missing package:

Node.js v20.11.1
multi-scrobbler is starting!
node:internal/process/esm_loader:34
      internalBinding('errors').triggerUncaughtException(
                                ^
Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'typescript-json-schema' imported from /app/src/backend/utils/SchemaUtils.ts
    at packageResolve (node:internal/modules/esm/resolve:853:9)
    at moduleResolve (node:internal/modules/esm/resolve:910:20)
    at defaultResolve (node:internal/modules/esm/resolve:1130:11)
    at nextResolve (node:internal/modules/esm/hooks:865:28)
    at resolveBase (file:///app/node_modules/tsx/dist/esm/index.mjs?1728527467923:2:3212)
    at resolveDirectory (file:///app/node_modules/tsx/dist/esm/index.mjs?1728527467923:2:3584)
    at resolveTsPaths (file:///app/node_modules/tsx/dist/esm/index.mjs?1728527467923:2:4073)
    at resolve (file:///app/node_modules/tsx/dist/esm/index.mjs?1728527467923:2:4447)
    at nextResolve (node:internal/modules/esm/hooks:865:28)
    at Hooks.resolve (node:internal/modules/esm/hooks:303:30) {
  code: 'ERR_MODULE_NOT_FOUND'
}
Node.js v20.11.1

FoxxMD added a commit that referenced this issue Oct 10, 2024
* Fixes #195 missing (404) history endpoint which only appear when using cookies
* Might fix #158 due to using a different authentication method
FoxxMD added a commit that referenced this issue Oct 10, 2024
* Fixes #195 missing (404) history endpoint which only appear when using cookies
* Might fix #158 due to using a different authentication method
@FoxxMD
Copy link
Owner

FoxxMD commented Oct 10, 2024

Please pull the latest PR image and see if that works, thanks

@bockbilbo
Copy link

I have tried pr-203 and pr-205. The logs from my previous message are for pr-203. pr-205 was not even booting. What latest PR image do you refer to?

FoxxMD added a commit that referenced this issue Oct 11, 2024
* Fixes #195 missing (404) history endpoint which only appear when using cookies
* Might fix #158 due to using a different authentication method
@FoxxMD
Copy link
Owner

FoxxMD commented Oct 11, 2024

Please try re-pulling foxxmd/multi-scrobbler:pr-203 as it has new fixes/code from today, thanks. After starting MS please confirm it shows version as pr203-72d79fcafa497b0fdbabcffbfb164b1f012457fd

@bockbilbo
Copy link

Thanks @FoxxMD . I have tried again, and have confirmed the version. The tool is prompting me a code to Re-authenticate into Youtube Music, but redirects to an internal website "/api/source/auth?name=Youtube%20Music&type=ytmusic" that returns "Internal Server Error".

Here are the logs from the app in Docker:

[2024-10-11 17:54:13.499 -0700] WARN   : [App] [Sources] [Ytmusic - Youtube Music] Polling is already stopped!
Error: You must be signed in to perform this operation.
    at Session.signOut (file:///app/node_modules/youtubei.js/dist/src/core/Session.js:157:19)
    at YTMusicSource.clearCredentials (/app/src/backend/sources/YTMusicSource.ts:128:32)
    at YTMusicSource.reauthenticate (/app/src/backend/sources/YTMusicSource.ts:122:20)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at <anonymous> (/app/src/backend/server/auth.ts:54:17)
    at async wrappedMiddleware (/app/node_modules/@awaitjs/express/index.js:116:7)

My guess is that i should have been redirected to a youtube page to enter the code to authenticate myself. Do i need to enter some kind of Youtube developer API token in the multi-scrobbler configs?

@bockbilbo
Copy link

bockbilbo commented Oct 12, 2024

Actually.. I was able to connect to youtube music and scrobble music played from their website! Scrobbling is not working though when I play music from the Youtube Music app. Is that behavior expected?

I found this log on the tool:

[2024-10-11 17:49:51.317 -0700] ERROR  : [App] [Sources] [Ytmusic - Youtube Music] Authentication test failed!
Error: Authentication test failed!
    at YTMusicSource.testAuth (CWD/src/backend/common/AbstractComponent.ts:235:31)
    at YTMusicSource.initialize (CWD/src/backend/common/AbstractComponent.ts:56:13)
    at <anonymous> (CWD/src/backend/index.ts:124:17)
caused by: Error: Sign in with the code 'XXX-XXX-XXXX' using the authentication link on the dashboard or https://www.google.com/device
    at YTMusicSource.doAuthentication (CWD/src/backend/sources/YTMusicSource.ts:139:27)
    at YTMusicSource.testAuth (CWD/src/backend/common/AbstractComponent.ts:229:27)
    at YTMusicSource.initialize (CWD/src/backend/common/AbstractComponent.ts:56:13)
    at <anonymous> (CWD/src/backend/index.ts:124:17)

I used the google.com/device url to make it work! I guess that the redirect url link in the app needs review?

@jrlebbs
Copy link
Author

jrlebbs commented Oct 13, 2024

Ok, I've got 0.8.5 installed. When I run npm start (before I get 203 merged), this happens:

MINGW64 ~/multi-scrobbler-0.8.5
$ npm start

[email protected] start
NODE_ENV=production tsx src/backend/index.ts

'NODE_ENV' is not recognized as an internal or external command,
operable program or batch file.

@MyNameHand
Copy link

MyNameHand commented Oct 13, 2024

Actually.. I was able to connect to youtube music and scrobble music played from their website! Scrobbling is not working though when I play music from the Youtube Music app. Is that behavior expected?

I found this log on the tool:

[2024-10-11 17:49:51.317 -0700] ERROR  : [App] [Sources] [Ytmusic - Youtube Music] Authentication test failed!
Error: Authentication test failed!
    at YTMusicSource.testAuth (CWD/src/backend/common/AbstractComponent.ts:235:31)
    at YTMusicSource.initialize (CWD/src/backend/common/AbstractComponent.ts:56:13)
    at <anonymous> (CWD/src/backend/index.ts:124:17)
caused by: Error: Sign in with the code 'XXX-XXX-XXXX' using the authentication link on the dashboard or https://www.google.com/device
    at YTMusicSource.doAuthentication (CWD/src/backend/sources/YTMusicSource.ts:139:27)
    at YTMusicSource.testAuth (CWD/src/backend/common/AbstractComponent.ts:229:27)
    at YTMusicSource.initialize (CWD/src/backend/common/AbstractComponent.ts:56:13)
    at <anonymous> (CWD/src/backend/index.ts:124:17)

I used the google.com/device url to make it work! I guess that the redirect url link in the app needs review?

Yea so I was able to do the same, and it does work with mobile app for me. But I noticed that it "discovered" 20 tracks, which were the last ones I had played before setting up the scrobbler. If I try to play those, it doesn't scrobble, but anything not on that list scrobbles. However, they get added to that list and don't scrobble anymore if I replay the song. Is this intended an behavior?

firefox_vSWnLWinBB

@bockbilbo
Copy link

@MyNameHand I have experienced the same behavior. After my first run, multi-scrobbler got the 20 Youtube Music plays before setting up the scrobbler, but then did not update despite refreshing every 10 seconds. A day later, it refreshed some 10 songs I played from my google speaker, but then stopped detecting more after that.

@FoxxMD I wonder if there is a problem with the code part that retrieves and refreshes the cache from Youtube Music. Or could it be a problem with the google url used to get the data?

@FoxxMD
Copy link
Owner

FoxxMD commented Oct 14, 2024

Yeah I need to do some more due diligence on how the data returned looks compared to the previous cookie method. The current changes in #203 were just to see if oauth would work (At all). Will look into the behavior ya'll have described this week.

@FoxxMD
Copy link
Owner

FoxxMD commented Oct 15, 2024

Looks like YTM made other changes other than blocking cookie-based retrival of the history endpoint. The way it returned data it used to include all instances of played songs (without a timestamp) but they were at least ordered based on when they were played IE:

* Song B (today) <--- last played song
* Song C (today)
* Song A (today)
* Song D (yesterday)
* ...

We play Song A again...

* Song A (today) <--- last played song
* Song B (today)
* Song C (today)
* Song A (today) <--- same song but played earlier in the day
* Song D (yesterday)
* ...

Now, it's removing the earlier play and putting it at the front of the list:

* Song B (today) <--- last played song
* Song C (today)
* Song A (today)
* Song D (yesterday)
* ...

We play Song A again...

* Song A (today) <--- last played song
* Song B (today)
* Song C (today) <--- song A is completely removed
* Song D (yesterday)
* ...

Since YTM doesn't provide timestamp and the api doesn't allow tracking the player in realtime the logic used to determine new plays is dependent on the history order being "valid" with some heuristics. The new behavior is causing it to throw away the remove-and-bump differences which only affects tracks that are played again within YTM's history window.

FoxxMD added a commit that referenced this issue Oct 15, 2024
Should fix new way YTM orders recent history #195
@FoxxMD
Copy link
Owner

FoxxMD commented Oct 15, 2024

Please update to the latest image of foxxmd/multi-scrobbler:pr-203. This should fix the ordering issue, I hope.

@bockbilbo
Copy link

It works!!! I have just played song A, then song B, then song A again from the browser, and the three were recorded! :) I will continue to test in the next few days and get back if there is any problem. Thanks a lot @FoxxMD

@bockbilbo
Copy link

Alright... so.. after the test above, i tried using Youtube Music on my phone, and the song I played was scrobbled. However, a song I played a few days when testing was also scrobbled with the current timestamp.

@jrlebbs
Copy link
Author

jrlebbs commented Oct 16, 2024

@FoxxMD, I've got pr-203 pulled into docker, but when I try to run, I get the error below. Any thoughts on what I can do to fix?

docker run -v "$(pwd)/config:/config" -p 9078:9078 foxxmd/multi-scrobbler:pr-203
exec /init: exec format error

@FoxxMD
Copy link
Owner

FoxxMD commented Oct 16, 2024

I cannot reproduce that error and nothing has changed about the docker image with this PR. Are you using portainer for container management? If so make sure command and Entrypoint are set to default

image

@jrlebbs
Copy link
Author

jrlebbs commented Oct 16, 2024

No, I'm not using portainer. Just pulled the image and ran it with the commands.

@jrlebbs
Copy link
Author

jrlebbs commented Oct 17, 2024

I'm also fine just to wait until 203 is merged with main and pull the new main version, since it seems like other people's testing is working.

@FoxxMD FoxxMD closed this as completed in e62e04d Oct 31, 2024
FoxxMD added a commit that referenced this issue Oct 31, 2024
feat(youtube)!: Use oauth-based api library for better stability
@FoxxMD FoxxMD reopened this Oct 31, 2024
@FoxxMD
Copy link
Owner

FoxxMD commented Oct 31, 2024

This is available on the edge docker image and master branch now. I'll cut a release for it next week, probably.

@bockbilbo
Copy link

bockbilbo commented Oct 31, 2024

@FoxxMD I am sorry for the late reply, I have been out for the last couple of weeks. Thanks for continuing working on the request.

I have tested the latest foxxmd/multi-scrobbler:edge docker image (master-eb26ee0) and have noticed that I am being asked to re-authenticate into YoutubeMusic every time I restart the container. Is this an expected behavior?

Also, I want to verify if the problems I reported a few weeks back are still happening. I will reply back with findings.

For reference, below are my YTM settings in the config.json file. I don't think the cookie is needed anymore, right?

{
        "name": "Youtube Music",
        "enable": true,
        "clients": [],
        "data": {
            "cookie": "<MY-COOKIE>",
            "authUser": "0"
        },
        "options": {
            "logDiff": true
        },
        "type": "ytmusic"
    }

@bockbilbo
Copy link

I was not able to reproduce the problem I reported 2 weeks ago about songs being re-scrobbled. If I see it happening again, I will open a new issue to address it, but I am guessing that the changes made by @FoxxMD might have fixed it.

Also, I just made a test of playing some music on my browser, phone and nest hub, and everything worked as expected. The debug logs are also nice to see, the history diff is useful to see how MS is working in the backend.


<<Played song from the browser>>
[2024-10-31 15:46:41.999 -0700] DEBUG  : [App] [Sources] [Ytmusic - Youtube Music] Refreshing recently played
[2024-10-31 15:46:42.629 -0700] DEBUG  : [App] [Sources] [Ytmusic - Youtube Music] Changes from last seen list:
    1. (QfW_zUql9KI) Inhaler - Your House --- Your House => Added
2. (F0Wx2Tm11wY) Blind Pilot - Just A Bird --- In the Shadow of the Holy Mountain => Moved -  Originally at 1
3. (c4wENnds1FM) Blind Pilot - Don't You Know --- In the Shadow of the Holy Mountain => Moved -  Originally at 2
4. (k3pSBAPqhmA) The Head And The Heart - Lost in My Mind --- The Head And The Heart => Moved -  Originally at 3
5. (C_U3MyV413o) Mumford & Sons - Guiding Light --- Delta => Moved -  Originally at 4
[...]
[2024-10-31 15:46:42.630 -0700] INFO   : [App] [Sources] [Ytmusic - Youtube Music] Discovered => Inhaler - Your House @ 2024-10-31T15:46:01-07:00 (S)
[2024-10-31 15:46:42.631 -0700] DEBUG  : [App] [Sources] [Ytmusic - Youtube Music] Last activity was at 2024-10-31T15:46:01-07:00 | Next check interval: 10.00s
[...]
[2024-10-31 15:49:36.200 -0700] DEBUG  : [App] [Sources] [Ytmusic - Youtube Music] Changes from last seen list:
    1. (bo-I3_npnYE) Bastille - Blue Sky & The Painter --- “&” (Ampersand) => Added
2. (QfW_zUql9KI) Inhaler - Your House --- Your House => Moved -  Originally at 1
3. (F0Wx2Tm11wY) Blind Pilot - Just A Bird --- In the Shadow of the Holy Mountain => Moved -  Originally at 2
4. (c4wENnds1FM) Blind Pilot - Don't You Know --- In the Shadow of the Holy Mountain => Moved -  Originally at 3
5. (k3pSBAPqhmA) The Head And The Heart - Lost in My Mind --- The Head And The Heart => Moved -  Originally at 4
[...]
<<Played song from the browser>>
[2024-10-31 15:49:36.202 -0700] INFO   : [App] [Sources] [Ytmusic - Youtube Music] Discovered => Bastille - Blue Sky & The Painter @ 2024-10-31T15:49:01-07:00 (S)
[2024-10-31 15:49:36.203 -0700] DEBUG  : [App] [Sources] [Ytmusic - Youtube Music] Last activity was at 2024-10-31T15:49:01-07:00 | Next check interval: 10.00s
[...]
<<Played song from the browser>>
[2024-10-31 15:53:30.917 -0700] DEBUG  : [App] [Sources] [Ytmusic - Youtube Music] Refreshing recently played
[2024-10-31 15:53:31.697 -0700] DEBUG  : [App] [Sources] [Ytmusic - Youtube Music] Changes from last seen list:
    1. (GJAt8bqW00E) Chappell Roan - HOT TO GO! --- The Rise and Fall of a Midwest Princess => Added
2. (bo-I3_npnYE) Bastille - Blue Sky & The Painter --- “&” (Ampersand) => Moved -  Originally at 1
3. (QfW_zUql9KI) Inhaler - Your House --- Your House => Moved -  Originally at 2
4. (F0Wx2Tm11wY) Blind Pilot - Just A Bird --- In the Shadow of the Holy Mountain => Moved -  Originally at 3
5. (c4wENnds1FM) Blind Pilot - Don't You Know --- In the Shadow of the Holy Mountain => Moved -  Originally at 4
[...]
[2024-10-31 15:53:31.698 -0700] INFO   : [App] [Sources] [Ytmusic - Youtube Music] Discovered => Chappell Roan - HOT TO GO! @ 2024-10-31T15:53:01-07:00 (S)
[2024-10-31 15:53:31.699 -0700] DEBUG  : [App] [Sources] [Ytmusic - Youtube Music] Last activity was at 2024-10-31T15:53:01-07:00 | Next check interval: 10.00s
[...]
<<Played song from mobile app>>
[2024-10-31 15:57:37.359 -0700] DEBUG  : [App] [Sources] [Ytmusic - Youtube Music] Refreshing recently played
[2024-10-31 15:57:37.985 -0700] DEBUG  : [App] [Sources] [Ytmusic - Youtube Music] Changes from last seen list:
    1. (VRtu2Ew61qc) David Gray - After The Harvest --- After The Harvest => Added
2. (GJAt8bqW00E) Chappell Roan - HOT TO GO! --- The Rise and Fall of a Midwest Princess => Moved -  Originally at 1
3. (bo-I3_npnYE) Bastille - Blue Sky & The Painter --- “&” (Ampersand) => Moved -  Originally at 2
4. (QfW_zUql9KI) Inhaler - Your House --- Your House => Moved -  Originally at 3
5. (F0Wx2Tm11wY) Blind Pilot - Just A Bird --- In the Shadow of the Holy Mountain => Moved -  Originally at 4
[...]
[2024-10-31 15:57:17.658 -0700] INFO   : [App] [Sources] [Ytmusic - Youtube Music] Discovered => David Gray - After The Harvest @ 2024-10-31T15:57:01-07:00 (S)
[2024-10-31 15:57:17.659 -0700] DEBUG  : [App] [Sources] [Ytmusic - Youtube Music] Last activity was at 2024-10-31T15:57:01-07:00 | Next check interval: 10.00s
[...]
<<Played song from google nest hub speaker>>
[2024-10-31 16:01:32.368 -0700] DEBUG  : [App] [Sources] [Ytmusic - Youtube Music] Refreshing recently played
[2024-10-31 16:01:33.083 -0700] DEBUG  : [App] [Sources] [Ytmusic - Youtube Music] Changes from last seen list:
    1. (MARPEvw2Prw) Sierra Ferrell - American Dreaming --- American Dreaming (Single Edit) => Added
2. (VRtu2Ew61qc) David Gray - After The Harvest --- After The Harvest => Moved -  Originally at 1
3. (GJAt8bqW00E) Chappell Roan - HOT TO GO! --- The Rise and Fall of a Midwest Princess => Moved -  Originally at 2
4. (bo-I3_npnYE) Bastille - Blue Sky & The Painter --- “&” (Ampersand) => Moved -  Originally at 3
5. (QfW_zUql9KI) Inhaler - Your House --- Your House => Moved -  Originally at 4
[...]
[2024-10-31 16:01:33.084 -0700] INFO   : [App] [Sources] [Ytmusic - Youtube Music] Discovered => Sierra Ferrell - American Dreaming @ 2024-10-31T16:01:01-07:00 (S)
[2024-10-31 16:01:33.085 -0700] DEBUG  : [App] [Sources] [Ytmusic - Youtube Music] Last activity was at 2024-10-31T16:01:01-07:00 | Next check interval: 10.00s

@bockbilbo
Copy link

I have tested the latest foxxmd/multi-scrobbler:edge docker image (master-eb26ee0) and have noticed that I am being asked to re-authenticate into YoutubeMusic every time I restart the container. Is this an expected behavior?

This is the last pending question I have. I wonder if other's have the same problem. I have verified that the youtubei_oauth_credentials directory containing the oauth credentials has the right permissions. Is there anything else I should check?

@FoxxMD
Copy link
Owner

FoxxMD commented Nov 1, 2024

It should not be asking you to reauthenticate everytime. Can you post startup logs?

@bockbilbo
Copy link

Here you go, there is a 400 error triggering the reauthentication request:


[2024-10-31 18:43:26.408 -0700] DEBUG  : [App] [Sources] [Ytmusic - Youtube Music] Attempting to initialize...
[2024-10-31 18:43:26.553 -0700] VERBOSE: [App] [Sources] [Ytmusic - Youtube Music] Building required data init succeeded
[2024-10-31 18:43:26.554 -0700] DEBUG  : [App] [Sources] [Ytmusic - Youtube Music] Connection check was not required.
[2024-10-31 18:43:26.559 -0700] DEBUG  : [App] [Sources] [Ytmusic - Youtube Music] Auth success
[2024-10-31 18:43:26.603 -0700] ERROR  : [App] [Sources] [Ytmusic - Youtube Music] Additional API response details
�
    error: {
      "code": 400,
      "message": "Request contains an invalid argument.",
      "status": "INVALID_ARGUMENT"
    }
[2024-10-31 18:43:26.604 -0700] ERROR  : [App] [Sources] [Ytmusic - Youtube Music] Authentication test failed!
Error: Authentication test failed!
    at YTMusicSource.testAuth (CWD/src/backend/common/AbstractComponent.ts:235:31)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at YTMusicSource.initialize (CWD/src/backend/common/AbstractComponent.ts:56:13)
    at <anonymous> (CWD/src/backend/index.ts:124:17)
caused by: Error: Credentials exist but API calls are failing. Try re-authenticating?
    at YTMusicSource.doAuthentication (CWD/src/backend/sources/YTMusicSource.ts:155:23)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at YTMusicSource.testAuth (CWD/src/backend/common/AbstractComponent.ts:229:27)
    at YTMusicSource.initialize (CWD/src/backend/common/AbstractComponent.ts:56:13)
    at <anonymous> (CWD/src/backend/index.ts:124:17)
caused by: Error: Request to https://www.youtube.com/youtubei/v1/account/accounts_list?prettyPrint=false&alt=json failed with status 400
    at HTTPClient.fetch (file://CWD/node_modules/youtubei.js/dist/src/utils/HTTPClient.js:117:15)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Actions.execute (file://CWD/node_modules/youtubei.js/dist/src/core/Actions.js:66:26)
    at async AccountManager.getInfo (file://CWD/node_modules/youtubei.js/dist/src/core/managers/AccountManager.js:49:26)
    at YTMusicSource.doAuthentication (CWD/src/backend/sources/YTMusicSource.ts:149:17)
    at YTMusicSource.testAuth (CWD/src/backend/common/AbstractComponent.ts:229:27)
    at YTMusicSource.initialize (CWD/src/backend/common/AbstractComponent.ts:56:13)
    at <anonymous> (CWD/src/backend/index.ts:124:17)
[2024-10-31 18:43:26.610 -0700] INFO   : [App] [Sources] [Ytmusic - Youtube Music] Fully Initialized!

@FoxxMD
Copy link
Owner

FoxxMD commented Nov 1, 2024

Do you have a config folder setup or are you using only ENVs? In the config folder do you have a folder that looks similar to this

image

it would probably say yti-Youtube Music

@bockbilbo
Copy link

I use a combination of ENVs and config setup.

ENV Settings:

    environment:
      - TZ=America/Los_Angeles
      - LOG_LEVEL=debug
      - PUID=1000
      - PGID=1000
      - BASE_URL=https://MS-DOMAIN

Config setup:

{
  "debugMode": true,
  "disableWeb": false,
  "sourceDefaults": {
      "logPayload": false,
      "logFilterFailure": "warn",
      "logPlayerState": false,
      "scrobbleThresholds": {
          "duration": 30,
          "percent": 50
      },
      "maxPollRetries": 1,
      "maxRequestRetries": 1,
      "retryMultiplier": 1.5
  },
  "clientDefaults": {
      "maxRequestRetries": 1,
      "retryMultiplier": 1.5
  },
  "sources": [
    {
        "name": "Plex",
        "enable": true,
        "clients": [],
        "data": {
          "user": [
            "PLEX-USER"
          ],
          "libraries": [
            "PLEX-LIBRARY-1",
            "PLEX-LIBRARY-2"
          ],
          "servers": [
            "PLEX-SERVER-1",
            "PLEX-SERVER-2"
          ],
          "options": {
            "logFilterFailure": "warn"
          }
        },
        "type": "plex"
      },
      {
        "name": "Youtube Music",
        "enable": true,
        "clients": [],
        "data": {
        },
        "options": {
            "logDiff": true
        },
        "type": "ytmusic"
    }
  ],
  "clients": [
     {
        "name": "Maloja",
        "enable": true,
        "data": {
          "url": "http://MALOJA-URL",
          "apiKey": "MALOJA-API-KEY"
        },
        "type": "maloja"
      },
      {
          "name": "Last.fm",
          "enable": true,
          "configureAs": "client",
          "data": {
              "apiKey": "LASTFM-API-KEY",
              "secret": "LASTFM-SECRET",
              "redirectUri": "https://MS-URL/lastfm/callback"
          },
          "type": "lastfm"
      }
  ],
  "webhooks": [
    {
        "type": "ntfy",
        "name": "Ntfy",
        "url": "https://NTFY-URL",
        "topic": "NTFY-TOPIC",
        "username": "NTFY-USER",
        "password": "NTFY-PASSWD",
        "priorities": {
          "info": 3,
          "warn": 4,
          "error": 5
        }
      }
  ]
}

And, yes, I do have the yti-Youtube Music folder:

Screenshot 2024-11-01 at 09 09 05

@FoxxMD
Copy link
Owner

FoxxMD commented Nov 1, 2024

Thanks for the details, I'll see if i I can reproduce this

@jrlebbs
Copy link
Author

jrlebbs commented Nov 15, 2024

@FoxxMD, potentially new problem. I was having the same issue as @bockbilbo with my creds not saving between sessions. Not a big deal.

But now, something keeps crashing when trying to auth with the new approach. I can reproduce every time I try to auth YTM running the pr-203 image.

Please let me know how I can help troubleshoot this

@bockbilbo
Copy link

@FoxxMD I have the same problem as @jrlebbs. I cannot longer re-auth after the server restarts when using master-eb26ee0. Looking at the logs, an exception is happening.

First, I restart the service:

multi-scrobbler is starting!
[ls.io-init] done.
[2024-11-25 08:36:31.065 -0800] VERBOSE: [Init] Config Dir ENV: /config -> Resolved: /config
[2024-11-25 08:36:31.083 -0800] INFO   : [Init] Version: master-eb26ee0
[2024-11-25 08:36:31.084 -0800] INFO   : [Init] Generating schema definitions...
[2024-11-25 08:36:32.221 -0800] INFO   : [Init] Schema definitions generated
Warning: connect.session() MemoryStore is not
designed for a production environment, as it will leak
memory, and will not scale past a single process.
8:36:32 AM [vite-express] Running in production mode
8:36:32 AM [vite-express] Inline config detected, ignoring Vite config file
8:36:32 AM [vite-express] Serving static files from /app/dist
[2024-11-25 08:36:32.278 -0800] INFO   : [App] [API] Server started:
---> Local          http://localhost:9078
---> Network        http://172.26.0.3:9078
---> Network (IPv6) http://[::1]:9078
�
--- HINT ---
MS is likely being run in a container with BRIDGE networking which means the above addresses are not accessible from outside this container.
To ensure the container is accessible make sure you have mapped the *container* port 9078 to a *host* port. https://foxxmd.github.io/multi-scrobbler/docs/installation#networking
The container will then be accessible at http://HOST_MACHINE_IP:HOST_PORT (or https://ms.mydomain.tld/ since you defined this!)
�
--- HINT ---
[2024-11-25 08:36:32.279 -0800] INFO   : [App] [API] User-defined base URL for UI and redirect URLs (spotify, deezer, lastfm): https://ms.mydomain.tld/
[2024-11-25 08:36:32.396 -0800] INFO   : [App] [Notifiers] [Ntfy - Ntfy Seattle] Initialized. Found Ntfy server
[2024-11-25 08:36:32.530 -0800] DEBUG  : [App] [Scrobblers] Constructing maloja (Maloja) client...
[2024-11-25 08:36:32.531 -0800] INFO   : [App] [Scrobblers] [Maloja - Maloja] Client Added
[2024-11-25 08:36:32.531 -0800] DEBUG  : [App] [Scrobblers] Constructing lastfm (Last.fm) client...
[2024-11-25 08:36:32.532 -0800] INFO   : [App] [Scrobblers] [Lastfm - Last.fm] Client Added
[2024-11-25 08:36:32.532 -0800] INFO   : [App] Starting scrobble clients...
[2024-11-25 08:36:32.533 -0800] DEBUG  : [App] [Scrobblers] [Maloja - Maloja] Attempting to initialize...
[2024-11-25 08:36:32.534 -0800] VERBOSE: [App] [Scrobblers] [Maloja - Maloja] Building required data init succeeded
[2024-11-25 08:36:32.537 -0800] INFO   : [App] [Scrobblers] [Maloja - Maloja] Communication test succeeded.
[2024-11-25 08:36:32.537 -0800] INFO   : [App] [Scrobblers] [Maloja - Maloja] Maloja Server Version: 3.2.2
[2024-11-25 08:36:32.540 -0800] VERBOSE: [App] [Scrobblers] [Maloja - Maloja] Connection check succeeded
[2024-11-25 08:36:32.542 -0800] INFO   : [App] [Scrobblers] [Maloja - Maloja] Auth test passed!
[2024-11-25 08:36:32.543 -0800] INFO   : [App] [Scrobblers] [Maloja - Maloja] Fully Initialized!
[2024-11-25 08:36:32.543 -0800] VERBOSE: [App] [Scrobblers] [Maloja - Maloja] Fetching up to 100 initial scrobbles...
[2024-11-25 08:36:32.543 -0800] DEBUG  : [App] [Scrobblers] [Maloja - Maloja] Refreshing recent scrobbles
[2024-11-25 08:36:32.549 -0800] DEBUG  : [App] [Scrobblers] [Maloja - Maloja] Found 100 recent scrobbles
[2024-11-25 08:36:32.551 -0800] INFO   : [App] [Scrobblers] [Maloja - Maloja] Scrobble processing started
[2024-11-25 08:36:32.551 -0800] DEBUG  : [App] [Scrobblers] [Lastfm - Last.fm] Attempting to initialize...
[2024-11-25 08:36:32.552 -0800] VERBOSE: [App] [Scrobblers] [Lastfm - Last.fm] Building required data init succeeded
[2024-11-25 08:36:32.553 -0800] DEBUG  : [App] [Scrobblers] [Lastfm - Last.fm] Connection check was not required.
[2024-11-25 08:36:32.808 -0800] INFO   : [App] [Scrobblers] [API - Lastfm - Last.fm] Client authorized for user Unai
[2024-11-25 08:36:32.809 -0800] INFO   : [App] [Scrobblers] [Lastfm - Last.fm] Fully Initialized!
[2024-11-25 08:36:32.810 -0800] VERBOSE: [App] [Scrobblers] [Lastfm - Last.fm] Fetching up to 200 initial scrobbles...
[2024-11-25 08:36:32.811 -0800] DEBUG  : [App] [Scrobblers] [Lastfm - Last.fm] Refreshing recent scrobbles
[2024-11-25 08:36:33.964 -0800] DEBUG  : [App] [Scrobblers] [Lastfm - Last.fm] Found 200 recent scrobbles
[2024-11-25 08:36:33.968 -0800] INFO   : [App] [Scrobblers] [Lastfm - Last.fm] Scrobble processing started
[2024-11-25 08:36:34.070 -0800] DEBUG  : [App] [Sources] (Plex) Constructing plex source
[2024-11-25 08:36:34.071 -0800] INFO   : [App] [Sources] [Plex - Plex] Initializing with the following filters => Users: bockbilbo | Libraries: music, música | Servers: snowy, tintin
[2024-11-25 08:36:34.072 -0800] WARN   : [App] [Sources] [Plex - Plex] Plex WEBHOOK source is DEPRECATED! Please switch to Plex API Source as soon as possible.
[2024-11-25 08:36:34.072 -0800] DEBUG  : [App] [Sources] (Youtube Music) Constructing ytmusic source
[2024-11-25 08:36:34.072 -0800] DEBUG  : [App] [Sources] [Plex - Plex] Attempting to initialize...
[2024-11-25 08:36:34.073 -0800] DEBUG  : [App] [Sources] [Plex - Plex] No required data to build.
[2024-11-25 08:36:34.073 -0800] DEBUG  : [App] [Sources] [Plex - Plex] Connection check was not required.
[2024-11-25 08:36:34.073 -0800] INFO   : [App] [Sources] [Plex - Plex] Fully Initialized!
[2024-11-25 08:36:34.073 -0800] DEBUG  : [App] [Sources] [Ytmusic - Youtube Music] Attempting to initialize...
[2024-11-25 08:36:34.195 -0800] VERBOSE: [App] [Sources] [Ytmusic - Youtube Music] Building required data init succeeded
[2024-11-25 08:36:34.196 -0800] DEBUG  : [App] [Sources] [Ytmusic - Youtube Music] Connection check was not required.
[2024-11-25 08:36:34.198 -0800] DEBUG  : [App] [Sources] [Ytmusic - Youtube Music] Auth success
[2024-11-25 08:36:34.231 -0800] ERROR  : [App] [Sources] [Ytmusic - Youtube Music] Additional API response details
�
    error: {
      "code": 400,
      "message": "Request contains an invalid argument.",
      "status": "INVALID_ARGUMENT"
    }
[2024-11-25 08:36:34.233 -0800] ERROR  : [App] [Sources] [Ytmusic - Youtube Music] Authentication test failed!
Error: Authentication test failed!
    at YTMusicSource.testAuth (CWD/src/backend/common/AbstractComponent.ts:235:31)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at YTMusicSource.initialize (CWD/src/backend/common/AbstractComponent.ts:56:13)
    at <anonymous> (CWD/src/backend/index.ts:124:17)
caused by: Error: Credentials exist but API calls are failing. Try re-authenticating?
    at YTMusicSource.doAuthentication (CWD/src/backend/sources/YTMusicSource.ts:155:23)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at YTMusicSource.testAuth (CWD/src/backend/common/AbstractComponent.ts:229:27)
    at YTMusicSource.initialize (CWD/src/backend/common/AbstractComponent.ts:56:13)
    at <anonymous> (CWD/src/backend/index.ts:124:17)
caused by: Error: Request to https://www.youtube.com/youtubei/v1/account/accounts_list?prettyPrint=false&alt=json failed with status 400
    at HTTPClient.fetch (file://CWD/node_modules/youtubei.js/dist/src/utils/HTTPClient.js:117:15)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Actions.execute (file://CWD/node_modules/youtubei.js/dist/src/core/Actions.js:66:26)
    at async AccountManager.getInfo (file://CWD/node_modules/youtubei.js/dist/src/core/managers/AccountManager.js:49:26)
    at YTMusicSource.doAuthentication (CWD/src/backend/sources/YTMusicSource.ts:149:17)
    at YTMusicSource.testAuth (CWD/src/backend/common/AbstractComponent.ts:229:27)
    at YTMusicSource.initialize (CWD/src/backend/common/AbstractComponent.ts:56:13)
    at <anonymous> (CWD/src/backend/index.ts:124:17)
[2024-11-25 08:36:34.237 -0800] INFO   : [App] [Sources] [Ytmusic - Youtube Music] Fully Initialized!
[2024-11-25 08:36:34.237 -0800] INFO   : [App] [Sources] Finished initializing sources
[2024-11-25 08:36:35.737 -0800] INFO   : [App] Some sources are not ready, open the dashboard to continue
[2024-11-25 08:36:35.741 -0800] INFO   : [App] Scheduler started.

Youtube Music is not working, the source needs action on the dashboard. I open the dashboard and click on (Re)authenticate

[2024-11-25 08:36:54.870 -0800] WARN   : [App] [Sources] [Ytmusic - Youtube Music] Polling is already stopped!
[2024-11-25 08:36:55.343 -0800] ERROR  : [App] [Sources] [Ytmusic - Youtube Music] Authentication test failed!
Error: Authentication test failed!
    at YTMusicSource.testAuth (CWD/src/backend/common/AbstractComponent.ts:235:31)
    at YTMusicSource.reauthenticate (CWD/src/backend/sources/YTMusicSource.ts:126:9)
    at <anonymous> (CWD/src/backend/server/auth.ts:54:17)
    at async wrappedMiddleware (CWD/node_modules/@awaitjs/express/index.js:116:7)
caused by: Error: Sign in with the code 'QQQQ-QQQQ' using the authentication link on the dashboard or https://www.google.com/device
    at YTMusicSource.doAuthentication (CWD/src/backend/sources/YTMusicSource.ts:143:27)
    at YTMusicSource.testAuth (CWD/src/backend/common/AbstractComponent.ts:229:27)
    at YTMusicSource.reauthenticate (CWD/src/backend/sources/YTMusicSource.ts:126:9)
    at <anonymous> (CWD/src/backend/server/auth.ts:54:17)
    at async wrappedMiddleware (CWD/node_modules/@awaitjs/express/index.js:116:7)

Next, since the Google auth code is not showing up in the dashboard, I have to refresh the website to see it. Once it's displayed, I click on the (Re)authenticate link.

[2024-11-25 08:38:31.335 -0800] WARN   : [App] [Sources] [Ytmusic - Youtube Music] Polling is already stopped!
[2024-11-25 08:38:31.639 -0800] ERROR  : [App] [Sources] [Ytmusic - Youtube Music] Authentication test failed!
Error: Authentication test failed!
    at YTMusicSource.testAuth (CWD/src/backend/common/AbstractComponent.ts:235:31)
    at YTMusicSource.reauthenticate (CWD/src/backend/sources/YTMusicSource.ts:126:9)
    at <anonymous> (CWD/src/backend/server/auth.ts:54:17)
    at async wrappedMiddleware (CWD/node_modules/@awaitjs/express/index.js:116:7)
caused by: Error: Sign in with the code 'QQQQ-QQQQ' using the authentication link on the dashboard or https://www.google.com/device
    at YTMusicSource.doAuthentication (CWD/src/backend/sources/YTMusicSource.ts:143:27)
    at YTMusicSource.testAuth (CWD/src/backend/common/AbstractComponent.ts:229:27)
    at YTMusicSource.reauthenticate (CWD/src/backend/sources/YTMusicSource.ts:126:9)
    at <anonymous> (CWD/src/backend/server/auth.ts:54:17)
    at async wrappedMiddleware (CWD/node_modules/@awaitjs/express/index.js:116:7)

Next, I authenticate on the Google device page.

[2024-11-25 08:40:00.971 -0800] DEBUG  : [App] [Sources] [Ytmusic - Youtube Music] Auth success

Next, I refresh the dashboard and click start on the dashboard to initiate the YTMusic source.

[2024-11-25 08:41:27.002 -0800] VERBOSE: [App] [Sources] [Ytmusic - Youtube Music] User requested (re)start via API call
[2024-11-25 08:41:27.007 -0800] VERBOSE: [App] [Sources] [Ytmusic - Youtube Music] Hydrating initial recently played tracks for reference.
[2024-11-25 08:41:27.051 -0800] ERROR  : [App] Uncaught exception is crashing the app! :( Type: unhandledRejection
Error: Uncaught exception is crashing the app! :( Type: unhandledRejection
    at process.<anonymous> (CWD/src/backend/index.ts:44:22)
    at process.emit (node:events:518:28)
    at process.emit (CWD/node_modules/tsx/dist/suppress-warnings.cjs:1:472)
    at process._fatalException (node:internal/process/execution:175:13)
    at processPromiseRejections (node:internal/process/promises:289:13)
    at process.processTicksAndRejections (node:internal/process/task_queues:96:32)
caused by: Error: Request to https://www.youtube.com/youtubei/v1/browse?prettyPrint=false&alt=json failed with status 400
    at HTTPClient.fetch (file://CWD/node_modules/youtubei.js/dist/src/utils/HTTPClient.js:117:15)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Actions.execute (file://CWD/node_modules/youtubei.js/dist/src/core/Actions.js:66:26)
    at YTMusicSource.getLibraryHistory (CWD/src/backend/sources/YTMusicSource.ts:224:25)
    at YTMusicSource.getRecentlyPlayed (CWD/src/backend/sources/YTMusicSource.ts:266:30)
    at YTMusicSource.onPollPostAuthCheck (CWD/src/backend/sources/YTMusicSource.ts:332:36)
    at YTMusicSource.poll (CWD/src/backend/sources/AbstractSource.ts:277:14)
file:///app/node_modules/youtubei.js/dist/src/utils/HTTPClient.js:117
        throw new InnertubeError(`Request to ${response.url} failed with status ${response.status}`, await response.text());
              ^
InnertubeError: Request to https://www.youtube.com/youtubei/v1/browse?prettyPrint=false&alt=json failed with status 400
    at HTTPClient.fetch (file:///app/node_modules/youtubei.js/dist/src/utils/HTTPClient.js:117:15)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Actions.execute (file:///app/node_modules/youtubei.js/dist/src/core/Actions.js:66:26)
    at YTMusicSource.getLibraryHistory (/app/src/backend/sources/YTMusicSource.ts:224:25)
    at YTMusicSource.getRecentlyPlayed (/app/src/backend/sources/YTMusicSource.ts:266:30)
    at YTMusicSource.onPollPostAuthCheck (/app/src/backend/sources/YTMusicSource.ts:332:36)
    at YTMusicSource.poll (/app/src/backend/sources/AbstractSource.ts:277:14) {
  info: '{\n' +
    '  "error": {\n' +
    '    "code": 400,\n' +
    '    "message": "Request contains an invalid argument.",\n' +
    '    "errors": [\n' +
    '      {\n' +
    '        "message": "Request contains an invalid argument.",\n' +
    '        "domain": "global",\n' +
    '        "reason": "badRequest"\n' +
    '      }\n' +
    '    ],\n' +
    '    "status": "INVALID_ARGUMENT"\n' +
    '  }\n' +
    '}\n',
  date: 2024-11-25T16:41:27.051Z,
  version: '10.5.0'
}
Node.js v20.11.1
multi-scrobbler is starting!

This causes MS to restart. As you can see, many exceptions are being thrown along the process.

@bockbilbo
Copy link

I have also tried with multi-scrobbler:pr-203 and I get the same behavior. The moment I click "Start" on the YTMusic dashboard section after having entered the auth code in Google, MS crashes and restarts.

@FoxxMD
Copy link
Owner

FoxxMD commented Dec 3, 2024

For everyone having auth and history fetching issues: please try out the new authentication methods detailed in #236 using the docker image foxxmd/multi-scrobbler:pr-236

If you try out the new docker image please post any issues you have with it in the issue for #236 instead of this one so I can better keep track of things, thanks.

@FoxxMD FoxxMD linked a pull request Dec 3, 2024 that will close this issue
7 tasks
@jrlebbs
Copy link
Author

jrlebbs commented Dec 4, 2024

Thanks @FoxxMD, I moved to the new requested thread.

@FoxxMD
Copy link
Owner

FoxxMD commented Dec 10, 2024

Accidentally closed, but this should be fixed in edge docker image with the merging of #236

The only person I haven't heard from is @MyNameHand and @UditDey

please try using foxxmd/multi-scrobbler:edge and let me know if auth is working for you.

You will probably need to get new cookies. After updating your image open Docs on your instance and read the new YT Music configuration section for cookies/oauth to get started. Also check out the FAQ for new YTM troubleshooting directions..

If this works but you are still having scrobbling issues let's open a new issue for it or use one of the existing, open issue.

@FoxxMD FoxxMD reopened this Dec 10, 2024
@UditDey
Copy link

UditDey commented Dec 12, 2024

Hi, ill give edge a try and get back to you in a bit, thanks

@UditDey
Copy link

UditDey commented Dec 12, 2024

no luck, I opened another issue a while back and I'm getting the same error message as what i posted in that issue

@FoxxMD
Copy link
Owner

FoxxMD commented Dec 12, 2024

Did you get new cookies? Or try the oauth approach? Can you please post logs as well as a log/screenshot showing the version of MS that is running?

@FoxxMD FoxxMD added bug Something isn't working fix waiting for release Fix has been committed and waiting for a release to be cut labels Dec 17, 2024
@FoxxMD FoxxMD added this to the 0.9.0 milestone Jan 14, 2025
@FoxxMD
Copy link
Owner

FoxxMD commented Jan 15, 2025

Fixed in v0.9.0

@FoxxMD FoxxMD closed this as completed Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fix waiting for release Fix has been committed and waiting for a release to be cut
Projects
None yet
5 participants