HermanFassett / youtube-scrape

Scrape YouTube searches (API)
MIT License
192 stars 96 forks source link

Using the API inside other websites has CORS errors #69

Open Crilum opened 2 years ago

Crilum commented 2 years ago

So I'm making a website (a terminal/shell emulator), and I wanted to use your API to get youtube search results, but when using a XMLHttpRequest, I get in console:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://youtube-scrape.herokuapp.com/api/search?q=search. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).

It looks like you need to add the Access-Control-Allow-Origin: * header to your server, to fix the problem.

But, I understand as well if you don't want me using the API inside my website, because of lots of potential API usage...