diff --git a/components/Crunchyroll/ListAnimes.ts b/components/Crunchyroll/ListAnimes.ts index 2c1adbd..352a683 100644 --- a/components/Crunchyroll/ListAnimes.ts +++ b/components/Crunchyroll/ListAnimes.ts @@ -268,7 +268,7 @@ export async function getCREpisodeSeriesID(q: string) { return } - const { data: fdata, error: ferror } = await useFetch(`https://beta-api.crunchyroll.com/content/v2/cms/series/${q}`, { + const { data: fdata, error: ferror } = await useFetch(`https://beta-api.crunchyroll.com/content/v2/cms/objects/${q}`, { method: 'GET', headers: { Authorization: `Bearer ${tokeng.value.access_token}` @@ -293,5 +293,9 @@ export async function getCREpisodeSeriesID(q: string) { const episode = data.value.data[0] - return episode.episode_metadata.series_id + return { + id: episode.episode_metadata.series_id, + season: episode.episode_metadata.season_id, + episode: episode.id + } } diff --git a/components/Crunchyroll/Types.ts b/components/Crunchyroll/Types.ts index b0b8d9f..e687f48 100644 --- a/components/Crunchyroll/Types.ts +++ b/components/Crunchyroll/Types.ts @@ -242,8 +242,10 @@ export interface CrunchyEpisodesFetch { export interface CrunchyEpisodeFetch { total: number data: Array<{ + id: string episode_metadata: { - series_id: string + series_id: string, + season_id: string } }> meta: { diff --git a/components/Settings/Crunchyroll.vue b/components/Settings/Crunchyroll.vue index b32993d..1373e12 100644 --- a/components/Settings/Crunchyroll.vue +++ b/components/Settings/Crunchyroll.vue @@ -26,11 +26,8 @@ - - diff --git a/pages/addanime.vue b/pages/addanime.vue index 609f312..20a085e 100644 --- a/pages/addanime.vue +++ b/pages/addanime.vue @@ -778,14 +778,15 @@ const switchToSeason = async () => { } if (url.value && url.value.includes('crunchyroll') && url.value.includes('/watch/') && !CRselectedShow.value) { - const episodeID = url.value.split('/') - const seriesID = await getCREpisodeSeriesID(episodeID[5]) + var episodeID: string | string[] = url.value.split('/') + episodeID = episodeID[episodeID.length-2] + const seriesID = await getCREpisodeSeriesID(episodeID) if (!seriesID) { alert('Episode not found') isFetchingSeasons.value-- return } - CRselectedShow.value = await getCRSeries(seriesID) + CRselectedShow.value = await getCRSeries(seriesID.id) if (!CRselectedShow.value) { alert('Series not found') isFetchingSeasons.value-- @@ -797,7 +798,7 @@ const switchToSeason = async () => { isFetchingSeasons.value-- return } - selectedSeason.value = seasons.value[0] + selectedSeason.value = seasons.value.find(s => s.id === seriesID.season) ?? seasons.value[0] episodes.value = await listEpisodeCrunchy(selectedSeason.value.id, CRselectedShow.value.Geo) if (episodes.value) { selectedStartEpisode.value = episodes.value[0] diff --git a/src/api/routes/crunchyroll/crunchyroll.service.ts b/src/api/routes/crunchyroll/crunchyroll.service.ts index 87b4d41..15bb374 100644 --- a/src/api/routes/crunchyroll/crunchyroll.service.ts +++ b/src/api/routes/crunchyroll/crunchyroll.service.ts @@ -372,11 +372,6 @@ export async function crunchyGetPlaylist(q: string, geo: string | undefined) { name: 'Edge', url: `/web/edge/play` }, - // { - // id: 7, - // name: 'Safari', - // url: `/web/safari/play` - // }, { id: 7, name: 'Chrome', @@ -387,16 +382,6 @@ export async function crunchyGetPlaylist(q: string, geo: string | undefined) { name: 'Web Fallback', url: `/web/fallback/play` }, - // { - // id: 10, - // name: 'Iphone', - // url: `/ios/iphone/play` - // }, - // { - // id: 11, - // name: 'Ipad', - // url: `/ios/ipad/play` - // }, { id: 9, name: 'Android',