better single episode search

This commit is contained in:
stratuma 2024-06-25 02:12:44 +02:00
parent 67fff3eaf5
commit 4c54d99391
5 changed files with 14 additions and 25 deletions

View File

@ -268,7 +268,7 @@ export async function getCREpisodeSeriesID(q: string) {
return return
} }
const { data: fdata, error: ferror } = await useFetch<CrunchyEpisodeFetch>(`https://beta-api.crunchyroll.com/content/v2/cms/series/${q}`, { const { data: fdata, error: ferror } = await useFetch<CrunchyEpisodeFetch>(`https://beta-api.crunchyroll.com/content/v2/cms/objects/${q}`, {
method: 'GET', method: 'GET',
headers: { headers: {
Authorization: `Bearer ${tokeng.value.access_token}` Authorization: `Bearer ${tokeng.value.access_token}`
@ -293,5 +293,9 @@ export async function getCREpisodeSeriesID(q: string) {
const episode = data.value.data[0] 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
}
} }

View File

@ -242,8 +242,10 @@ export interface CrunchyEpisodesFetch {
export interface CrunchyEpisodeFetch { export interface CrunchyEpisodeFetch {
total: number total: number
data: Array<{ data: Array<{
id: string
episode_metadata: { episode_metadata: {
series_id: string series_id: string,
season_id: string
} }
}> }>
meta: { meta: {

View File

@ -26,11 +26,8 @@
<option :value="4">XBOX One (DRM PROTECTED)</option> <option :value="4">XBOX One (DRM PROTECTED)</option>
<option :value="5">Firefox (DRM PROTECTED)</option> <option :value="5">Firefox (DRM PROTECTED)</option>
<option :value="6">Edge (DRM PROTECTED)</option> <option :value="6">Edge (DRM PROTECTED)</option>
<!-- <option :value="7">Safari (DRM PROTECTED)</option> -->
<option :value="7">Chrome (DRM PROTECTED)</option> <option :value="7">Chrome (DRM PROTECTED)</option>
<option :value="8">Web Fallback (DRM PROTECTED)</option> <option :value="8">Web Fallback (DRM PROTECTED)</option>
<!-- <option :value="10">Iphone (DRM PROTECTED)</option>
<option :value="11">Ipad (DRM PROTECTED)</option> -->
<option :value="9">Android (DRM PROTECTED)</option> <option :value="9">Android (DRM PROTECTED)</option>
<option :value="10">Samsung TV (DRM PROTECTED)</option> <option :value="10">Samsung TV (DRM PROTECTED)</option>
</select> </select>

View File

@ -778,14 +778,15 @@ const switchToSeason = async () => {
} }
if (url.value && url.value.includes('crunchyroll') && url.value.includes('/watch/') && !CRselectedShow.value) { if (url.value && url.value.includes('crunchyroll') && url.value.includes('/watch/') && !CRselectedShow.value) {
const episodeID = url.value.split('/') var episodeID: string | string[] = url.value.split('/')
const seriesID = await getCREpisodeSeriesID(episodeID[5]) episodeID = episodeID[episodeID.length-2]
const seriesID = await getCREpisodeSeriesID(episodeID)
if (!seriesID) { if (!seriesID) {
alert('Episode not found') alert('Episode not found')
isFetchingSeasons.value-- isFetchingSeasons.value--
return return
} }
CRselectedShow.value = await getCRSeries(seriesID) CRselectedShow.value = await getCRSeries(seriesID.id)
if (!CRselectedShow.value) { if (!CRselectedShow.value) {
alert('Series not found') alert('Series not found')
isFetchingSeasons.value-- isFetchingSeasons.value--
@ -797,7 +798,7 @@ const switchToSeason = async () => {
isFetchingSeasons.value-- isFetchingSeasons.value--
return 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) episodes.value = await listEpisodeCrunchy(selectedSeason.value.id, CRselectedShow.value.Geo)
if (episodes.value) { if (episodes.value) {
selectedStartEpisode.value = episodes.value[0] selectedStartEpisode.value = episodes.value[0]

View File

@ -372,11 +372,6 @@ export async function crunchyGetPlaylist(q: string, geo: string | undefined) {
name: 'Edge', name: 'Edge',
url: `/web/edge/play` url: `/web/edge/play`
}, },
// {
// id: 7,
// name: 'Safari',
// url: `/web/safari/play`
// },
{ {
id: 7, id: 7,
name: 'Chrome', name: 'Chrome',
@ -387,16 +382,6 @@ export async function crunchyGetPlaylist(q: string, geo: string | undefined) {
name: 'Web Fallback', name: 'Web Fallback',
url: `/web/fallback/play` url: `/web/fallback/play`
}, },
// {
// id: 10,
// name: 'Iphone',
// url: `/ios/iphone/play`
// },
// {
// id: 11,
// name: 'Ipad',
// url: `/ios/ipad/play`
// },
{ {
id: 9, id: 9,
name: 'Android', name: 'Android',