algolia / youtube-captions-scraper

Fetch youtube user submitted or fallback to auto-generated captions
249 stars 67 forks source link

CORS issue #14

Open ak34504 opened 2 years ago

ak34504 commented 2 years ago

I'm facing CORS issue while trying to implement this solution in my react app

Access to XMLHttpRequest at 'https://youtube.com/watch?v=video_id' from origin 'http://localhost:3001' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

daronspence commented 2 years ago

Seems like you'll need to use it serverside. If using a framework like Next.js, you can create an API only route that essentially acts as a proxy to run this script.

ak34504 commented 2 years ago

Thanks, Now it's working for me.i have tried on serverside.