feat: added characters and voice actors to /info endpoint response
This commit is contained in:
@@ -334,6 +334,23 @@ console.log(data);
|
|||||||
thumbnail: string | undefined
|
thumbnail: string | undefined
|
||||||
},
|
},
|
||||||
{...},
|
{...},
|
||||||
|
],
|
||||||
|
characterVoiceActor: [
|
||||||
|
{
|
||||||
|
character: {
|
||||||
|
id: string,
|
||||||
|
poster: string,
|
||||||
|
name: string,
|
||||||
|
cast: string
|
||||||
|
},
|
||||||
|
voiceActor: {
|
||||||
|
id: string,
|
||||||
|
poster: string,
|
||||||
|
name: string,
|
||||||
|
cast: string
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{...},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
moreInfo: {
|
moreInfo: {
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ async function scrapeAnimeAboutInfo(
|
|||||||
duration: null,
|
duration: null,
|
||||||
},
|
},
|
||||||
promotionalVideos: [],
|
promotionalVideos: [],
|
||||||
|
charactersVoiceActors: [],
|
||||||
},
|
},
|
||||||
moreInfo: {},
|
moreInfo: {},
|
||||||
},
|
},
|
||||||
@@ -133,6 +134,26 @@ async function scrapeAnimeAboutInfo(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// get characters and voice actors
|
||||||
|
$(".block_area.block_area-actors .block-actors-content .bac-list-wrap .bac-item").each(
|
||||||
|
(_, el) => {
|
||||||
|
res.anime.info.charactersVoiceActors.push({
|
||||||
|
character: {
|
||||||
|
id: $(el).find($(".per-info.ltr .pi-avatar")).attr("href")?.split("/")[2] || "",
|
||||||
|
poster: $(el).find($(".per-info.ltr .pi-avatar img")).attr("data-src") || "",
|
||||||
|
name: $(el).find($(".per-info.ltr .pi-detail a")).text(),
|
||||||
|
cast: $(el).find($(".per-info.ltr .pi-detail .pi-cast")).text(),
|
||||||
|
},
|
||||||
|
voiceActor: {
|
||||||
|
id: $(el).find($(".per-info.rtl .pi-avatar")).attr("href")?.split("/")[2] || "",
|
||||||
|
poster: $(el).find($(".per-info.rtl .pi-avatar img")).attr("data-src") || "",
|
||||||
|
name: $(el).find($(".per-info.rtl .pi-detail a")).text(),
|
||||||
|
cast: $(el).find($(".per-info.rtl .pi-detail .pi-cast")).text(),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
// more information
|
// more information
|
||||||
$(`${selector} .anisc-info-wrap .anisc-info .item:not(.w-hide)`).each(
|
$(`${selector} .anisc-info-wrap .anisc-info .item:not(.w-hide)`).each(
|
||||||
(i, el) => {
|
(i, el) => {
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ export interface AnimeGeneralAboutInfo
|
|||||||
quality: string | null;
|
quality: string | null;
|
||||||
} & Pick<Anime, "duration" | "episodes" | "rating" | "type">;
|
} & Pick<Anime, "duration" | "episodes" | "rating" | "type">;
|
||||||
promotionalVideos: AnimePromotionalVideo[];
|
promotionalVideos: AnimePromotionalVideo[];
|
||||||
|
charactersVoiceActors: AnimeCharactersAndVoiceActors[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface RecommendedAnime extends Anime {}
|
export interface RecommendedAnime extends Anime {}
|
||||||
@@ -66,6 +67,18 @@ export interface AnimePromotionalVideo {
|
|||||||
thumbnail: string | undefined;
|
thumbnail: string | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface AnimeCharactersAndVoiceActors {
|
||||||
|
character: AnimeCharacter;
|
||||||
|
voiceActor: AnimeCharacter;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface AnimeCharacter {
|
||||||
|
id: string;
|
||||||
|
poster: string;
|
||||||
|
name: string;
|
||||||
|
cast: string;
|
||||||
|
}
|
||||||
|
|
||||||
export interface AnimeSearchSuggestion
|
export interface AnimeSearchSuggestion
|
||||||
extends Omit<MostPopularAnime, "episodes" | "type"> {
|
extends Omit<MostPopularAnime, "episodes" | "type"> {
|
||||||
moreInfo: Array<string>;
|
moreInfo: Array<string>;
|
||||||
|
|||||||
Reference in New Issue
Block a user