ghoshRitesh12 / aniwatch-api

Node.js API for obtaining anime information from hianime.to (formerly aniwatch.to) written in TypeScript, made with Cheerio & Axios
https://api-aniwatch.onrender.com
MIT License
183 stars 92 forks source link

Streaming Links endpoint not working #16

Open ghoshRitesh12 opened 6 months ago

ghoshRitesh12 commented 6 months ago

Describe the bug

The route of streaming links aka /episode-srcs is not working.

Expected behavior

Streaming links endpoint:

https://api-aniwatch.onrender.com/anime/episode-srcs?id={episodeId}&server={server}&category={category}

should work as expected and the response should be this response schema:

{
  headers: {
    Referer: string,
    "User-Agent": string,
    ...
  },
  sources: [
    {
      url: string, // .m3u8 hls streaming file
      isM3U8: boolean,
      quality?: string,
    },
    {...}
  ],
  subtitles: [
    {
      lang: "English",
      url: string, // .vtt subtitle file
    },
    {...}
  ],
  anilistID: number | null
}

Actual behavior

It's not working or giving a 500 or >500 error status code.

Additional context

Well it' s not working because of several reasons stated below:

  1. Maybe the extractor is outdated
  2. Maybe the keys used to decode encrypted text is invalid or stale
  3. Maybe there is a network error

Well in most cases the endpoints should work after a certain amount of downtime (consider 2 days to be max).

If the downtime is more than 1 or 2 days, then option 1 is the problem, in which case please open an issue informing the same.

KhadeerBashaShaik commented 4 months ago

same error from 2 days this endpoint is not working perfectly error response -- {"status":500,"message":"Cannot decrypt sources. Perhaps the key is invalid."} requesting to fix the issue error endpoint -- https://api-aniwatch.onrender.com/anime/episode-srcs?id={episodeId}&server={server}&category={category}

ghoshRitesh12 commented 4 months ago

same error from 2 days this endpoint is not working perfectly error response -- {"status":500,"message":"Cannot decrypt sources. Perhaps the key is invalid."} requesting to fix the issue error endpoint -- https://api-aniwatch.onrender.com/anime/episode-srcs?id={episodeId}&server={server}&category={category}

There is an issue with the key, I will look for a fix.

ayushch80 commented 4 months ago

Probably this issue is not with keys but with the scraped url

PS C:\Users\*******\aniwatch-api\src\parsers> tsx animeEpisodeSrcs.ts
https://aniwatchtv.to/watch/steinsgate-3?ep=230
THE SERVER:  vidstreaming
SERVER_ID:  641987
THE LINK:  https://megacloud.tv/embed-2/e-1/k7jCM2morfb0?k=1
Malformed UTF-8 data
Cannot decrypt sources. Perhaps the key is invalid.
Error: Cannot decrypt sources. Perhaps the key is invalid.
ghoshRitesh12 commented 4 months ago

Probably this issue is not with keys but with the scraped url

PS C:\Users\*******\aniwatch-api\src\parsers> tsx animeEpisodeSrcs.ts
https://aniwatchtv.to/watch/steinsgate-3?ep=230
THE SERVER:  vidstreaming
SERVER_ID:  641987
THE LINK:  https://megacloud.tv/embed-2/e-1/k7jCM2morfb0?k=1
Malformed UTF-8 data
Cannot decrypt sources. Perhaps the key is invalid.
Error: Cannot decrypt sources. Perhaps the key is invalid.

Yes, you are right, Malformed UTF-8 data. The problem must have been either the key or the encrypted data being received.

massi-css commented 4 months ago

hello the error remains the same and i noticed this error in many apis for this website do have any idea how to fix that and i'll by my self thank you

ghoshRitesh12 commented 4 months ago

hello the error remains the same and i noticed this error in many apis for this website do have any idea how to fix that and i'll by my self thank you

I currently have no fixes for this. If I find one, then the code would be updated.

ayushch80 commented 4 months ago

actually in src/extractors/rapidcloud.ts line 51 why were you finding substring. This might be a cause

ghoshRitesh12 commented 4 months ago

actually in src/extractors/rapidcloud.ts line 51 why were you finding substring. This might be a cause

Did you find anything regarding that? If this problem persists then I might make another scraper api for anicrush.to. They also have good servers.

ayushch80 commented 4 months ago

src/extractors/rapidcloud.ts line 73,74 Here both constants start and stop are invalid and their values at first are c0 c0undefined respectively [using fallback key] and length of index is 1 so index[1] is undefined

ghoshRitesh12 commented 4 months ago

src/extractors/rapidcloud.ts line 73,74 Here both constants start and stop are invalid and their values at first are c0 c0undefined respectively [using fallback key] and length of index is 1 so index[1] is undefined

yeah I was just inspecting that, and also this extractor belongs to consumet, but I have a found a new way to decrypt the encrypted string, so if I have time then I will push a new api endpoint that will work(I think).

ghoshRitesh12 commented 4 months ago

@massi-css, @KhadeerBashaShaik , @ayushch80 I have added another extractor for getting anime episodes. The response is a bit all over the place, I will arrange it sometime.

massi-css commented 4 months ago

This is awesome i'll check it

TECH-NINJA06 commented 4 months ago

@massi-css, @KhadeerBashaShaik , @ayushch80 I have added another extractor for getting anime episodes. The response is a bit all over the place, I will arrange it sometime.

What's the api endpoint for this?? If it's d same as the previous one then it's giving 404 error

ayushch80 commented 4 months ago

What's the api endpoint for this?? If it's d same as the previous one then it's giving 404 error

https://github.com/ghoshRitesh12/aniwatch-api?tab=readme-ov-file#get-anime-episode-streaming-links

and it's giving 404 error cuz aniwatch.to is down rn

ghoshRitesh12 commented 4 months ago

What's the api endpoint for this?? If it's d same as the previous one then it's giving 404 error

https://github.com/ghoshRitesh12/aniwatch-api?tab=readme-ov-file#get-anime-episode-streaming-links

and it's giving 404 error cuz aniwatch.to is down rn

If that's the case, then there's nothing to do. We have to wait. I was thinking of making another api for anicrush.to, but lets see.

ayushch80 commented 4 months ago

If that's the case, then there's nothing to do. We have to wait. I was thinking of making another api for anicrush.to, but lets see.

I've noticed that for the past two days, whenever aniwatch is down, the APIs of anicrush also don't work. This suggests that they're most likely using aniwatch APIs. So, try for gogoanime instead.

ghoshRitesh12 commented 4 months ago

If that's the case, then there's nothing to do. We have to wait. I was thinking of making another api for anicrush.to, but lets see.

I've noticed that for the past two days, whenever aniwatch is down, the APIs of anicrush also don't work. This suggests that they're most likely using aniwatch APIs. So, try for gogoanime instead.

Ok, I wasn't aware of that. Recently many people were facing issues while streaming anime, it was buffering for a long time. At that time, not only aniwatch, but anix, anilab (android app) were facing the same issues, on the other hand, anicrush's servers were in a good condition.

TECH-NINJA06 commented 4 months ago

Aniwatch is blocked it's Hianime now

ghoshRitesh12 commented 4 months ago

Aniwatch is blocked it's Hianime now

yeah I noticed that, will see if the all those routes work or not, then I will apply the changes