ts-npm-ytmusic-api icon indicating copy to clipboard operation
ts-npm-ytmusic-api copied to clipboard

[BUG]: Cookie not in this host's domain. Cookie: www.youtube.com Request: music.youtube.com

Open SAROND-DEV opened this issue 1 year ago • 2 comments

Please describe the current behaviour of the code.

When running the method setCookieSync, i getting an error

error: Cookie not in this host's domain. Cookie:www.youtube.com Request:music.youtube.com
      at setCookie (/mnt/c/Users/PC/Desktop/projects/ts-npm-ytmusic-api/node_modules/tough-cookie/lib/cookie.js:1194:15)
      at /mnt/c/Users/PC/Desktop/projects/ts-npm-ytmusic-api/node_modules/universalify/index.js:5:64
      at /mnt/c/Users/PC/Desktop/projects/ts-npm-ytmusic-api/node_modules/tough-cookie/lib/cookie.js:1726:5
      at /mnt/c/Users/PC/Desktop/projects/ts-npm-ytmusic-api/src/YTMusic.ts:73:6
      at processTicksAndRejections (:61:77)

Please describe the expected behaviour of the code.

Successful run methods

What are the steps to reproduce the error?

Try

const ytm = new YTMusic();
await ytm.initialize();

Additional Information

No response

SAROND-DEV avatar Jan 18 '24 13:01 SAROND-DEV

same issue. 🙂🥲

prabhatm8000 avatar Jan 18 '24 13:01 prabhatm8000

I found a simple solution, but I not sure if it the best idea.

cookiejar.setCookieSync(cookie, url, { ignoreError: true })

SAROND-DEV avatar Jan 18 '24 14:01 SAROND-DEV

Version v5.2.2 has been released with this bug fixed. I set the cookie url to www.youtube.com instead of music.youtube.com and it worked

zS1L3NT avatar Jul 07 '24 21:07 zS1L3NT