Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HLS Cors error #353

Open
dishant0406 opened this issue Mar 13, 2023 · 22 comments
Open

HLS Cors error #353

dishant0406 opened this issue Mar 13, 2023 · 22 comments
Labels
bug Something isn't working

Comments

@dishant0406
Copy link

Describe the bug

I am using the streaming link that is provided by the api in the format of .m3u8 on my frontend using hls.js but it gives cors error and I am unable to play the video is there any way to solve or bypass the cors issue

Steps to reproduce

  1. Fetch the steaming link of which anime you want to watch
  2. Using Plyr-React with hls.js to show the video

Expected behavior

The video should play

Actual behavior

Showing cors error

Additional context

No response

@dishant0406 dishant0406 added the bug Something isn't working label Mar 13, 2023
@SlideMovies
Copy link

You could use a CORS proxy

@dishant0406
Copy link
Author

Hi @SlideMovies If possible, can you please help me how to use or setup the proxy on the frontend or the backend or you can provide any documentation sort off.

@SlideMovies
Copy link

SlideMovies commented Mar 20, 2023

@dishant0406 Sure, you can email me at contact@slidemovies.org

@Anuragkumarsah
Copy link

I also came across this error while using React-player can anyone please help me out how to resolve this.

@vuasancoggo222
Copy link

I get this error too,I need help,thanks very much.

@Anuragkumarsah
Copy link

I get this error too,I need help,thanks very much.

I found a way around to handle this you can use this url and paste the video url directly after this as path parameter and it will work.
"https://corsanywhere.herokuapp.com/"

@vuasancoggo222
Copy link

@Anuragkumarsah It worked, thank you very much.

@Shuvadip-Ghosh
Copy link

I get this error too,I need help,thanks very much.

I found a way around to handle this you can use this url and paste the video url directly after this as path parameter and it will work. "https://corsanywhere.herokuapp.com/"

Arent there any rate limit

@Anuragkumarsah
Copy link

I get this error too,I need help,thanks very much.

I found a way around to handle this you can use this url and paste the video url directly after this as path parameter and it will work. "https://corsanywhere.herokuapp.com/"

Arent there any rate limit

Yeah there is a rate limit of 50 request per minute, as far as I remember.

@singh-jay
Copy link

I get this error too,I need help,thanks very much.

I found a way around to handle this you can use this url and paste the video url directly after this as path parameter and it will work. "https://corsanywhere.herokuapp.com/"

@Anuragkumarsah can you please share an example -
I tried -
fetch("https://api.consumet.org/anime/gogoanime/watch/spy-x-family-episode-1")
.then((response) => response.json())
.then((result) => console.log(result));

result = {
"headers": {
"Referer": "https://anihdplay.com/embedplus?id=MTg0MTQx&token=1ctpyL9t_G4C-tgO1FKYnA&expires=1680290342"
},
"sources": [
{
"url": "https://tc-002.adesicdn.com/1ab5d45273a9183bebb58eb74d5722d8ea6384f350caf008f08cf018f1f0566d0cb82a2a799830d1af97cd3f4b6a9a81ef3aed2fb783292b1abcf1b8560a1d1aa308008b88420298522a9f761e5aa1024fbe74e5aa853cfc933cd1219327d1232e91847a185021b184c027f97ae732b3708ee6beb80ba5db6628ced43f1196fe/0789fd4f049c3ca2a49b860ea5d1f456/ep.1.1677591537.360.m3u8",
"isM3U8": true,
"quality": "360p"
},
{
"url": "https://tc-002.adesicdn.com/1ab5d45273a9183bebb58eb74d5722d8ea6384f350caf008f08cf018f1f0566d0cb82a2a799830d1af97cd3f4b6a9a81ef3aed2fb783292b1abcf1b8560a1d1aa308008b88420298522a9f761e5aa1024fbe74e5aa853cfc933cd1219327d1232e91847a185021b184c027f97ae732b3708ee6beb80ba5db6628ced43f1196fe/0789fd4f049c3ca2a49b860ea5d1f456/ep.1.1677591537.480.m3u8",
"isM3U8": true,
"quality": "480p"
},
{
"url": "https://tc-002.adesicdn.com/1ab5d45273a9183bebb58eb74d5722d8ea6384f350caf008f08cf018f1f0566d0cb82a2a799830d1af97cd3f4b6a9a81ef3aed2fb783292b1abcf1b8560a1d1aa308008b88420298522a9f761e5aa1024fbe74e5aa853cfc933cd1219327d1232e91847a185021b184c027f97ae732b3708ee6beb80ba5db6628ced43f1196fe/0789fd4f049c3ca2a49b860ea5d1f456/ep.1.1677591537.720.m3u8",
"isM3U8": true,
"quality": "720p"
},
{
"url": "https://tc-002.adesicdn.com/1ab5d45273a9183bebb58eb74d5722d8ea6384f350caf008f08cf018f1f0566d0cb82a2a799830d1af97cd3f4b6a9a81ef3aed2fb783292b1abcf1b8560a1d1aa308008b88420298522a9f761e5aa1024fbe74e5aa853cfc933cd1219327d1232e91847a185021b184c027f97ae732b3708ee6beb80ba5db6628ced43f1196fe/0789fd4f049c3ca2a49b860ea5d1f456/ep.1.1677591537.1080.m3u8",
"isM3U8": true,
"quality": "1080p"
},
{
"url": "https://tc-002.adesicdn.com/1ab5d45273a9183bebb58eb74d5722d8ea6384f350caf008f08cf018f1f0566d0cb82a2a799830d1af97cd3f4b6a9a81ef3aed2fb783292b1abcf1b8560a1d1aa308008b88420298522a9f761e5aa1024fbe74e5aa853cfc933cd1219327d1232e91847a185021b184c027f97ae732b3708ee6beb80ba5db6628ced43f1196fe/0789fd4f049c3ca2a49b860ea5d1f456/ep.1.1677591537.m3u8",
"isM3U8": true,
"quality": "default"
},
{
"url": "https://www002.anifastcdn.info/videos/hls/_PK_JUqGrakYdO8LcdTdMg/1680297543/184141/0789fd4f049c3ca2a49b860ea5d1f456/ep.1.1677591537.m3u8",
"isM3U8": true,
"quality": "backup"
}
],
"download": "https://gogohd.net/download?id=MTg0MTQx&token=1ctpyL9t_G4C-tgO1FKYnA&expires=1680290342"
}

I'm making the url as https://corsanywhere.herokuapp.com/?path=https://tc-002.adesicdn.com/1ab5d45273a9183bebb58eb74d5722d8ea6384f350caf008f08cf018f1f0566d0cb82a2a799830d1af97cd3f4b6a9a81ef3aed2fb783292b1abcf1b8560a1d1aa308008b88420298522a9f761e5aa1024fbe74e5aa853cfc933cd1219327d1232e91847a185021b184c027f97ae732b3708ee6beb80ba5db6628ced43f1196fe/0789fd4f049c3ca2a49b860ea5d1f456/ep.1.1677591537.360.m3u8
Also tried zoho links.
It's not working.

@shrkwt
Copy link

shrkwt commented Apr 2, 2023

It says, Missing required request header. Must specify one of: origin,x-requested-with

@H4jw
Copy link

H4jw commented Apr 2, 2023

If you directly follow the link in browser it shows Missing required request header. Must specify one of: origin,x-requested-with

But if you fetch the link form browser it works,
cors_github_solution_answer

@Anuragkumarsah
Copy link

Now again it is not working, I guess, I am again getting Cors error, even with corsanywhere.

@H4jw
Copy link

H4jw commented Apr 7, 2023

Now again it is not working, I guess, I am again getting Cors error, even with corsanywhere.

But it's working for me

@Anuragkumarsah
Copy link

Now again it is not working, I guess, I am again getting Cors error, even with corsanywhere.

But it's working for me

image

It is showing Cors error to me though.

@Anuragkumarsah
Copy link

Ok nvm, I think this was a problem from corsanywhere, I used "https://cors.zimjs.com/" and now it is working again.

@IrfanKhan66
Copy link

IrfanKhan66 commented Apr 13, 2023

Ok nvm, I think this was a problem from corsanywhere, I used "https://cors.zimjs.com/" and now it is working again.

hello bro, i have tried using different hls player to play an episode m3u8 link from https://api.consumet.org/anime/zoro/watch?episodeId=tokyo-revengers-15585$episode$64630$both, but none of them worked only jwplayer worked i think its using some unique cors policy or something, can you please help me out, ive tried to run my code on replit it didnt worked, but when i downloaded replit on my mobile and ran it again the video started to play

@shrkwt
Copy link

shrkwt commented Apr 14, 2023

I guess, Replit code of yours is being prevented by Cors Policy to fetch the HLS(.m3u8) manifest and play it.

Whereas, the Replit app on mobile devices might has its own browsing environment that might not have Cors Policy.

Well, talking about JWPlayer;
Take a look at https://anihdplay.com/embedplus?id=MTY2NDQ4&token=rTS6SSjXPKJJoby90ft--Q&expires=1681475515

This link is the same as provided by API as referrer for a request at, https://api.consumet.org/anime/gogoanime/watch/dororo-dub-episode-1

Notice that the Referrer links have just the same JWPlayer in them.
So, it clarifies that the Anime HLS videos from GOGO are specifically meant to be played on JWPlayer as per the Cors Policy.

Here, a cors proxy should be used to use any other player to play on any browser (as each browser has Cors Proxy for security).

@shrkwt
Copy link

shrkwt commented Apr 14, 2023

I think that the same goes for Zoro also.

@IrfanKhan66
Copy link

I think that the same goes for Zoro also.

i solved the cors error, but im still having one issue, when i fetch animes from zoro provider then in the subordub field i only get to see sub

@saurabhgangule
Copy link

guys if i created my own instance of jwplayer to avoid cors will it work?
If yes, then what will be configuration we have to pass, if no whats the better solution to handle it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

10 participants