TimeForANinja / node-ytsr

Do anonymous YouTube search requests.
MIT License
285 stars 66 forks source link

No 'Access-Control-Allow-Origin' header is present on the requested resource. #82

Closed elkhayder closed 3 years ago

elkhayder commented 3 years ago

I wanted to use this libraryb in a React project, but when I make a request I get this error: Access to fetch at 'https://www.youtube.com/results?spf=navigate&gl=US&hl=en&search_query=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dq_BrLvbdgu0%26origin%3Dhttp%3A%2F%2Flocalhost%3A3000' from origin 'http://chat.test:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

I browsed some of the code, it is using MINIGET and I don't know if I can enable no-cors in it ?

TimeForANinja commented 3 years ago

actually, no idea since it's not the target scope 😅 ytsr & miniget should allow you to pass any header you want thou

johtso commented 3 years ago

@elkhayder did you find a solution? I'm also looking to use this in the browser..

TimeForANinja commented 3 years ago

@elkhayder did you find a solution? I'm also looking to use this in the browser..

there are browser plugins that enable modifications to cors or you can use a cors proxy but that's about it