ts-npm-ytmusic-api
ts-npm-ytmusic-api copied to clipboard
[BUG]: Cookie not in this host's domain. Cookie: www.youtube.com Request: music.youtube.com
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
same issue. 🙂🥲
I found a simple solution, but I not sure if it the best idea.
cookiejar.setCookieSync(cookie, url, { ignoreError: true })
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