DrKain / scrape-youtube

A lightning fast package to scrape YouTube search results
MIT License
112 stars 30 forks source link

Unable to fetch results client-side #5

Closed thuonghd3 closed 4 years ago

thuonghd3 commented 4 years ago

Describe the bug I am having problems on the client side. Access to fetch at 'https://www.youtube.com/results?search_query=aaaaaa&page=0&sp=EgIQAQ%253D%253D' from origin 'http://localhost:3001' 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.

DrKain commented 4 years ago

This is because YouTube doesn't allow CORS requests. If you want to use this client side you will need to make the search back-end and serve the response to the client.

thuonghd3 commented 4 years ago

Ok. Thanks