consumet / consumet.ts

Nodejs library that provides high-level APIs for obtaining information on various entertainment media such as books, movies, comic books, anime, manga, and so on.
https://consumet.org/extensions/list/
GNU General Public License v3.0
393 stars 222 forks source link

Unable to create a request to the movies because of lack of "Access-Control-Allow-Origin" header #562

Open dwnppoalt opened 1 month ago

dwnppoalt commented 1 month ago

Describe the bug

Whenever I try to create a request from the movie providers, the error occurs.

Steps to reproduce

Here is the code I tried

const movies = new MOVIES.FlixHQ()
    var data = movies.search(search.value).then(data => {
        console.log(data);
    })

Expected behavior

Something like the documentation should what've occured

Actual behavior

I got this issue at the browser's console tab

Access to XMLHttpRequest at 'https://flixhq.to/search/five-nights-at-freddy?page=1' from origin 'https://motorola-scholarships-past-regime.trycloudflare.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource

Additional context

I'm new at JavaScript, TypeScript, and other languages this is involved in. So it might just be me. Either way, how do I fix it? Thank you! :D

shamar-morrison commented 1 month ago

Its not just you, I'm having the same issue.

dwnppoalt commented 1 month ago

Hello, I tried using the API and host it on Vercel, and it now works for me. However, due to the fact that I'm using the API for a Discord App, I no longer use it. If you want, I'll give you a link to the API that I deploy, but it might not be up for long.

shamar-morrison commented 1 month ago

Hello, I tried using the API and host it on Vercel, and it now works for me. However, due to the fact that I'm using the API for a Discord App, I no longer use it. If you want, I'll give you a link to the API that I deploy, but it might not be up for long.

So I have to host my own version of the API then? Ok, I can do that.

I was initially using the typescript library and that's where I was getting the error like yourself.

dwnppoalt commented 1 month ago

Hello, I tried using the API and host it on Vercel, and it now works for me. However, due to the fact that I'm using the API for a Discord App, I no longer use it. If you want, I'll give you a link to the API that I deploy, but it might not be up for long.

So I have to host my own version of the API then? Ok, I can do that.

I was initially using the typescript library and that's where I was getting the error like yourself.

That worked for me. You can use what the documentation says.