Skip to content

Commit

Permalink
fix(use-episodes): replace anify with tmdb (#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
hoangvu12 authored Feb 2, 2024
1 parent 24206c1 commit 42ed182
Show file tree
Hide file tree
Showing 6 changed files with 662 additions and 15 deletions.
6 changes: 3 additions & 3 deletions src/gql/gql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const documents = {
types.WrongTitleFragmentDoc,
'\n fragment UseAnimeId on Media {\n id\n title {\n english\n native\n romaji\n userPreferred\n }\n }\n':
types.UseAnimeIdFragmentDoc,
'\n fragment UseAnimeEpisode on Media {\n ...UseAnimeId\n id\n bannerImage\n coverImage {\n large\n extraLarge\n }\n }\n':
'\n fragment UseAnimeEpisode on Media {\n ...UseAnimeId\n id\n bannerImage\n coverImage {\n large\n extraLarge\n }\n startDate {\n year\n month\n day\n }\n episodes\n format\n title {\n english\n userPreferred\n }\n }\n':
types.UseAnimeEpisodeFragmentDoc,
'\n fragment CharacterListMedia on CharacterConnection {\n edges {\n ...CharacterCard\n node {\n id\n }\n role\n }\n }\n':
types.CharacterListMediaFragmentDoc,
Expand Down Expand Up @@ -207,8 +207,8 @@ export function graphql(
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
export function graphql(
source: '\n fragment UseAnimeEpisode on Media {\n ...UseAnimeId\n id\n bannerImage\n coverImage {\n large\n extraLarge\n }\n }\n'
): (typeof documents)['\n fragment UseAnimeEpisode on Media {\n ...UseAnimeId\n id\n bannerImage\n coverImage {\n large\n extraLarge\n }\n }\n'];
source: '\n fragment UseAnimeEpisode on Media {\n ...UseAnimeId\n id\n bannerImage\n coverImage {\n large\n extraLarge\n }\n startDate {\n year\n month\n day\n }\n episodes\n format\n title {\n english\n userPreferred\n }\n }\n'
): (typeof documents)['\n fragment UseAnimeEpisode on Media {\n ...UseAnimeId\n id\n bannerImage\n coverImage {\n large\n extraLarge\n }\n startDate {\n year\n month\n day\n }\n episodes\n format\n title {\n english\n userPreferred\n }\n }\n'];
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
Expand Down
125 changes: 125 additions & 0 deletions src/gql/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4896,11 +4896,24 @@ export type UseAnimeEpisodeFragment = ({
__typename?: 'Media';
id: number;
bannerImage?: string | null;
episodes?: number | null;
format?: MediaFormat | null;
coverImage?: {
__typename?: 'MediaCoverImage';
large?: string | null;
extraLarge?: string | null;
} | null;
startDate?: {
__typename?: 'FuzzyDate';
year?: number | null;
month?: number | null;
day?: number | null;
} | null;
title?: {
__typename?: 'MediaTitle';
english?: string | null;
userPreferred?: string | null;
} | null;
} & { ' $fragmentRefs'?: { UseAnimeIdFragment: UseAnimeIdFragment } }) & {
' $fragmentName'?: 'UseAnimeEpisodeFragment';
};
Expand Down Expand Up @@ -5683,6 +5696,34 @@ export const UseAnimeEpisodeFragmentDoc = {
],
},
},
{
kind: 'Field',
name: { kind: 'Name', value: 'startDate' },
selectionSet: {
kind: 'SelectionSet',
selections: [
{ kind: 'Field', name: { kind: 'Name', value: 'year' } },
{ kind: 'Field', name: { kind: 'Name', value: 'month' } },
{ kind: 'Field', name: { kind: 'Name', value: 'day' } },
],
},
},
{ kind: 'Field', name: { kind: 'Name', value: 'episodes' } },
{ kind: 'Field', name: { kind: 'Name', value: 'format' } },
{
kind: 'Field',
name: { kind: 'Name', value: 'title' },
selectionSet: {
kind: 'SelectionSet',
selections: [
{ kind: 'Field', name: { kind: 'Name', value: 'english' } },
{
kind: 'Field',
name: { kind: 'Name', value: 'userPreferred' },
},
],
},
},
],
},
},
Expand Down Expand Up @@ -5835,6 +5876,34 @@ export const EpisodeContainerFragmentDoc = {
],
},
},
{
kind: 'Field',
name: { kind: 'Name', value: 'startDate' },
selectionSet: {
kind: 'SelectionSet',
selections: [
{ kind: 'Field', name: { kind: 'Name', value: 'year' } },
{ kind: 'Field', name: { kind: 'Name', value: 'month' } },
{ kind: 'Field', name: { kind: 'Name', value: 'day' } },
],
},
},
{ kind: 'Field', name: { kind: 'Name', value: 'episodes' } },
{ kind: 'Field', name: { kind: 'Name', value: 'format' } },
{
kind: 'Field',
name: { kind: 'Name', value: 'title' },
selectionSet: {
kind: 'SelectionSet',
selections: [
{ kind: 'Field', name: { kind: 'Name', value: 'english' } },
{
kind: 'Field',
name: { kind: 'Name', value: 'userPreferred' },
},
],
},
},
],
},
},
Expand Down Expand Up @@ -10119,6 +10188,34 @@ export const InfoDetailsScreenDocument = {
],
},
},
{
kind: 'Field',
name: { kind: 'Name', value: 'startDate' },
selectionSet: {
kind: 'SelectionSet',
selections: [
{ kind: 'Field', name: { kind: 'Name', value: 'year' } },
{ kind: 'Field', name: { kind: 'Name', value: 'month' } },
{ kind: 'Field', name: { kind: 'Name', value: 'day' } },
],
},
},
{ kind: 'Field', name: { kind: 'Name', value: 'episodes' } },
{ kind: 'Field', name: { kind: 'Name', value: 'format' } },
{
kind: 'Field',
name: { kind: 'Name', value: 'title' },
selectionSet: {
kind: 'SelectionSet',
selections: [
{ kind: 'Field', name: { kind: 'Name', value: 'english' } },
{
kind: 'Field',
name: { kind: 'Name', value: 'userPreferred' },
},
],
},
},
],
},
},
Expand Down Expand Up @@ -10457,6 +10554,34 @@ export const AnimeWatchScreenQueryDocument = {
],
},
},
{
kind: 'Field',
name: { kind: 'Name', value: 'startDate' },
selectionSet: {
kind: 'SelectionSet',
selections: [
{ kind: 'Field', name: { kind: 'Name', value: 'year' } },
{ kind: 'Field', name: { kind: 'Name', value: 'month' } },
{ kind: 'Field', name: { kind: 'Name', value: 'day' } },
],
},
},
{ kind: 'Field', name: { kind: 'Name', value: 'episodes' } },
{ kind: 'Field', name: { kind: 'Name', value: 'format' } },
{
kind: 'Field',
name: { kind: 'Name', value: 'title' },
selectionSet: {
kind: 'SelectionSet',
selections: [
{ kind: 'Field', name: { kind: 'Name', value: 'english' } },
{
kind: 'Field',
name: { kind: 'Name', value: 'userPreferred' },
},
],
},
},
],
},
},
Expand Down
5 changes: 4 additions & 1 deletion src/metadata/anify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ export type Metadata = {
export const getContentMetadata = async (anilistId: number) => {
try {
const { data } = await axios.get<ContentMetadata[]>(
`https://api.anify.tv/content-metadata/${anilistId}`
`https://api.anify.tv/content-metadata/${anilistId}`,
{
timeout: 2000,
}
);

if (!data.length) {
Expand Down
Loading

0 comments on commit 42ed182

Please sign in to comment.