diff options
Diffstat (limited to 'pages/api/get-media.js')
| -rw-r--r-- | pages/api/get-media.js | 76 |
1 files changed, 0 insertions, 76 deletions
diff --git a/pages/api/get-media.js b/pages/api/get-media.js deleted file mode 100644 index 8558f63..0000000 --- a/pages/api/get-media.js +++ /dev/null @@ -1,76 +0,0 @@ -export default async function handler(req, res) { - const { username, status } = req.query; - - try { - const response = await fetch("https://graphql.anilist.co/", { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify({ - query: ` - query ($username: String, $status: MediaListStatus) { - MediaListCollection(userName: $username, type: ANIME, status: $status, sort: SCORE_DESC) { - user { - id - name - about (asHtml: true) - createdAt - avatar { - large - } - statistics { - anime { - count - episodesWatched - meanScore - minutesWatched - } - } - bannerImage - mediaListOptions { - animeList { - sectionOrder - } - } - } - lists { - status - name - entries { - id - mediaId - status - progress - score - media { - id - status - title { - english - romaji - } - episodes - coverImage { - large - } - } - } - } - } - } - `, - variables: { - username, - status, - }, - }), - }); - - const data = await response.json(); - res.status(200).json(data.data.MediaListCollection); - } catch (error) { - console.error(error); - res.status(500).json({ message: "Internal server error" }); - } -} |