Kakulukian / youtube-transcript

Fetch transcript from a youtube video
290 stars 58 forks source link

CORS from origin localhost:3000 has been blocked #33

Closed albirrkarim closed 3 weeks ago

albirrkarim commented 3 months ago

How can i solve cors problem ?

Access to fetch at 'https://www.youtube.com/watch?v=cqUJ7oGPbfc' from origin 'http://localhost: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 know this is node js library. but how it can used directly on browser ? it posible ?

JDLegaspi commented 2 months ago

@albirrkarim I would suggest trying to call this from a server environment if possible. For NextJS projects, you can make this call from a Server Component or the BFF.

aljasser commented 4 weeks ago

@JDLegaspi this solution work only for localhost and not after deployment, it seems that using a paid residential proxy is the ultimate solution but it's expensive ...

JDLegaspi commented 4 weeks ago

@aljasser The CORS issue should only happen if you're making the request via a browser. This would usually happen for any common React vite project or non-SSR framework, unfortunately.

However, after deployment, you would indeed have to pay for somewhere to host your server (outside of free tiers).