-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8473dc1
commit fbd2ccd
Showing
13 changed files
with
110 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
import { AnifyApi, AnimeApi } from "./animeapi/animetrixapi"; | ||
// trending anime | ||
export const getTrendingAnime = async () => { | ||
try { | ||
const response = await fetch(`${AnimeApi}/trending?perPage=20`); | ||
const data = await response.json(); | ||
return data.results; | ||
} catch (error) { | ||
console.error("Error fetching trending anime:", error); | ||
return []; | ||
} | ||
}; | ||
// popular anime | ||
export const getPopularAnime = async () => { | ||
try { | ||
const response = await fetch(`${AnimeApi}/popular?perPage=20`); | ||
const data = await response.json(); | ||
return data.results; | ||
} catch (error) { | ||
console.error("Error fetching popular anime:", error); | ||
return []; | ||
} | ||
}; | ||
// get anime movies | ||
export const getAnimeMovies = async () => { | ||
try { | ||
const response = await fetch(`${AnimeApi}/MOVIE?perPage=24`); | ||
const data = await response.json(); | ||
return data.results; | ||
} catch (error) { | ||
console.error("Error fetching anime movies:", error); | ||
return []; | ||
} | ||
}; | ||
|
||
// get random anime | ||
export const getRandomAnime = async () => { | ||
try { | ||
const response = await fetch(`${AnimeApi}/random-anime`, { | ||
cache: "no-store" | ||
}); | ||
|
||
const data = await response.json(); | ||
return data; | ||
} catch (error) { | ||
console.error("Error fetching random anime:", error); | ||
return null; | ||
} | ||
}; | ||
|
||
// get airing schedule | ||
export const getAiringSchedule = async () => { | ||
try { | ||
const response = await fetch(`${AnifyApi}/schedule?apikey=${process.env.NEXT_PUBLIC_ANIFY_KEY}`, { | ||
cache: 'no-cache' | ||
}); | ||
return response.json(); | ||
} catch (error) { | ||
console.error("Error getting airing list: ", error); | ||
return []; | ||
} | ||
} | ||
// upcoming seasons | ||
export const getCurrentYear = () => { | ||
return new Date().getFullYear(); | ||
}; | ||
|
||
export const getUpcomingData = async (season: string) => { | ||
try { | ||
const response = await fetch(`${AnimeApi}/advanced-search?season=${season}&&year=${getCurrentYear()}`); | ||
const data = await response.json(); | ||
return data.results; | ||
} catch (error) { | ||
console.error("Error fetching upcoming seasons:", error); | ||
return []; | ||
} | ||
}; | ||
// get anime details | ||
export const getAnimeDetails = async (animeid: number) => { | ||
try { | ||
const response = await fetch(`${AnimeApi}/info/${animeid}`); | ||
const data = await response.json(); | ||
return data; | ||
} catch (error) { | ||
console.error("Error fetching details:", error); | ||
return []; | ||
} | ||
}; | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
const AnimeApi = `https://animetrix-api.vercel.app/meta/anilist` | ||
export default AnimeApi | ||
export const AnimeApi = `https://animetrix-api.vercel.app/meta/anilist` | ||
export const AnifyApi = `https://api.anify.tv` |