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

Streaming Links endpoint not working #16

Closed
ghoshRitesh12 opened this issue Dec 20, 2023 · 26 comments
Closed

Streaming Links endpoint not working #16

ghoshRitesh12 opened this issue Dec 20, 2023 · 26 comments
Assignees
Labels
bug Something isn't working

Comments

@ghoshRitesh12
Copy link
Owner

ghoshRitesh12 commented Dec 20, 2023

Describe the bug

The route of streaming links aka /api/v2/hianime/episode/sources is not working.

Expected behavior

Streaming links endpoint:

/api/v2/hianime/episode/sources?animeEpisodeId={id}?server={server}&category={dub || sub || raw}

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.

@ghoshRitesh12 ghoshRitesh12 added the bug Something isn't working label Dec 20, 2023
@ghoshRitesh12 ghoshRitesh12 self-assigned this Dec 20, 2023
@ghoshRitesh12 ghoshRitesh12 pinned this issue Dec 20, 2023
Repository owner locked as resolved and limited conversation to collaborators Dec 20, 2023
Repository owner unlocked this conversation Dec 20, 2023
@KhadeerBashaShaik
Copy link

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
Copy link
Owner Author

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
Copy link
Contributor

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
Copy link
Owner Author

ghoshRitesh12 commented Feb 20, 2024

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
Copy link

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
Copy link
Owner Author

ghoshRitesh12 commented Feb 24, 2024

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
Copy link
Contributor

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

@ghoshRitesh12
Copy link
Owner Author

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
Copy link
Contributor

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
Copy link
Owner Author

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
Copy link
Owner Author

@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
Copy link

This is awesome i'll check it

@TECH-NINJA06
Copy link

@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
Copy link
Contributor

ayushch80 commented Feb 28, 2024

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
Copy link
Owner Author

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
Copy link
Contributor

ayushch80 commented Feb 28, 2024

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
Copy link
Owner Author

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
Copy link

Aniwatch is blocked it's Hianime now

@ghoshRitesh12
Copy link
Owner Author

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

@FallenPhoenix8
Copy link

Hello! I tried to request episode sources today and got similiar issue. Here is example log:
https://hianime.to/watch/one-piece-100?ep=230 THE SERVER: vidstreaming THE LINK: https://hianime.to/watch/ Error: cheerio.load() expects a string at load (https://raw.githubusercontent.com/cheeriojs/cheerio/d1cbc66d53392ce8bf6cd0068f675836372d2bf3/src/load.ts:101:13) at scrapeAnimeEpisodeSources (/home/luka/aniwatch-api/src/parsers/animeEpisodeSrcs.ts:75:27) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at scrapeAnimeEpisodeSources (/home/luka/aniwatch-api/src/parsers/animeEpisodeSrcs.ts:116:12) at async Promise.all (index 0) at getAnimeEpisodeSources (/home/luka/aniwatch-api/src/controllers/animeEpisodeSrcs.controller.ts:41:40) InternalServerError: cheerio.load() expects a string at scrapeAnimeEpisodeSources (/home/luka/aniwatch-api/src/parsers/animeEpisodeSrcs.ts:125:27) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at scrapeAnimeEpisodeSources (/home/luka/aniwatch-api/src/parsers/animeEpisodeSrcs.ts:116:12) at async Promise.all (index 0) at getAnimeEpisodeSources (/home/luka/aniwatch-api/src/controllers/animeEpisodeSrcs.controller.ts:41:40) InternalServerError: cheerio.load() expects a string at scrapeAnimeEpisodeSources (/home/luka/aniwatch-api/src/parsers/animeEpisodeSrcs.ts:125:27) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Promise.all (index 0) at getAnimeEpisodeSources (/home/luka/aniwatch-api/src/controllers/animeEpisodeSrcs.controller.ts:41:40) GET /anime/episode-srcs?id=one-piece-100?ep=230&server=vidstreaming&category=dub%22 500 452.316 ms - 58

@ghoshRitesh12
Copy link
Owner Author

This endpoint is a hit or miss, it happens because hianime.to rotates keys and this error is mostly related to encryption.

@WBRK-dev
Copy link
Contributor

WBRK-dev commented Aug 8, 2024

/anime/episode-srcs?id=one-piece-100?ep=230&server=vidstreaming&category=dub%22
You used vidstreaming instead of hd-1?

@FallenPhoenix8
Copy link

Yeah, I tried a few examples just changing anime name. But I was mainly looking at the docs in ReadMe

@FallenPhoenix8
Copy link

I tested it with hd-1 just now. It worked. Thanks for suggestion

@MMeetJS
Copy link

MMeetJS commented Aug 14, 2024

I should have checked this earlier but i fixed this from my side use hd-1 and hd-2

@ghoshRitesh12
Copy link
Owner Author

@MMeetJS
Apologies for the outdated document. The docs have been updated.

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

8 participants