amvstrm / api

Open source anime streaming provider API with Gogoanime + Anilist for amvstrm
https://api.amvstr.me
GNU General Public License v3.0
74 stars 45 forks source link

Update the URL #22

Closed AdalynBlack closed 9 months ago

AdalynBlack commented 9 months ago

The current URL returns error 502. Switching to the updated URL seems to work perfectly fine

adgsenpai commented 9 months ago

@TonyGamer dude what is the new fucking URL. You can save my asshole by telling me that!

Mekomancer commented 9 months ago

image image @adgsenpai your asshole is saved

adgsenpai commented 9 months ago

image image @adgsenpai your asshole is saved

I'm talking about the episode endpoint?

/api/v1/episode/one-piece

and also streaming end point

For example doesn't work?

I self host it on animeapiv2.adgstudios.co.za

adgsenpai commented 9 months ago

Screenshot_20231129-055048_Samsung Internet.jpg

My observation is that the streaming works but the episodes metadata doesn't work on the owners website?

That's fine I'll play around. I got the other GraphQL stuff giving me the data.

Thanks guys for letting me know.

adgsenpai commented 9 months ago

Wtf it seems like it's back up FFS Screenshot_20231129-055520_Samsung Internet.jpg

I'm over the moon 🌙 🌚 ✨️

Back to patching

adgsenpai commented 9 months ago

Okay status update i think the dudes server just got that requests cached :-( still fails.

image

adgsenpai commented 9 months ago

Okay guys your really did save my asshole. I think the dev never just update the production api etc.

My assumption his that the vercel account has the CD/CI updates. i do see the other guys website is back up. Just need to sort out my self hosting in the main while gonna leverage his domain to buy time lol. Thanks guys

addEventListener('fetch', event => {
  event.respondWith(handleRequest(event.request));
});

async function handleRequest(request) {
  const url = new URL(request.url);
  const apiURL = `https://api-amvstrm.vercel.app/${url.pathname}`;

  let response;
  switch (request.method) {
    case 'GET':
      response = await fetch(apiURL, { method: 'GET' });
      break;
    case 'POST':
      response = await fetch(apiURL, {
        method: 'POST',
        headers: request.headers,
        body: await request.text()
      });
      break;
    default:
      return new Response('Method not allowed', { status: 405 });
  }

  // Add CORS headers to the response
  const headers = new Headers(response.headers);
  headers.set('Access-Control-Allow-Origin', 'https://anime.adgstudios.co.za');
  headers.set('Access-Control-Allow-Methods', 'GET, POST, OPTIONS');
  headers.set('Access-Control-Allow-Headers', request.headers.get('Access-Control-Request-Headers'));

  // Create a new response with the added headers
  return new Response(response.body, {
    status: response.status,
    statusText: response.statusText,
    headers: headers
  });
}

My cloudflare worker code

adgsenpai commented 9 months ago

This route is broken

image

adgsenpai commented 9 months ago

image

Streaming works

adgsenpai commented 9 months ago

Everything is working 100%. Thanks to whatever people who contributed! This issue can be closed!

NYT92 commented 9 months ago

I already deploy my API with the new gogoanime domain both prod and public API, It seem that the data might be cache by the browser but now everything is working fine. If you have any problems I will help.