mirror of
https://github.com/sussy-code/smov.git
synced 2024-12-30 16:17:41 +01:00
Merge branch 'dev' into external_ids
This commit is contained in:
commit
a5cd05b144
2 changed files with 27 additions and 16 deletions
1
.gitattributes
vendored
Normal file
1
.gitattributes
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
* text=auto eol=lf
|
|
@ -1,6 +1,6 @@
|
||||||
import { proxiedFetch } from "../helpers/fetch";
|
import { proxiedFetch } from "../helpers/fetch";
|
||||||
import { registerProvider } from "../helpers/register";
|
import { registerProvider } from "../helpers/register";
|
||||||
import { MWStreamQuality, MWStreamType } from "../helpers/streams";
|
import { MWCaptionType, MWStreamQuality, MWStreamType } from "../helpers/streams";
|
||||||
import { MWMediaType } from "../metadata/types";
|
import { MWMediaType } from "../metadata/types";
|
||||||
|
|
||||||
const netfilmBase = "https://net-film.vercel.app";
|
const netfilmBase = "https://net-film.vercel.app";
|
||||||
|
@ -18,7 +18,6 @@ registerProvider({
|
||||||
displayName: "NetFilm",
|
displayName: "NetFilm",
|
||||||
rank: 15,
|
rank: 15,
|
||||||
type: [MWMediaType.MOVIE, MWMediaType.SERIES],
|
type: [MWMediaType.MOVIE, MWMediaType.SERIES],
|
||||||
disabled: true, // https://github.com/lamhoang1256/netfilm/issues/25
|
|
||||||
|
|
||||||
async scrape({ media, episode, progress }) {
|
async scrape({ media, episode, progress }) {
|
||||||
// search for relevant item
|
// search for relevant item
|
||||||
|
@ -41,27 +40,31 @@ registerProvider({
|
||||||
|
|
||||||
// get stream info from media
|
// get stream info from media
|
||||||
progress(75);
|
progress(75);
|
||||||
const watchInfo = await proxiedFetch<any>(
|
const watchInfo = await proxiedFetch<any>(`/api/episode?id=${netfilmId}`, {
|
||||||
`/api/episode?id=${netfilmId}`,
|
baseURL: netfilmBase,
|
||||||
{
|
});
|
||||||
baseURL: netfilmBase,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
const { qualities } = watchInfo.data;
|
const data = watchInfo.data;
|
||||||
|
|
||||||
// get best quality source
|
// get best quality source
|
||||||
const source = qualities.reduce((p: any, c: any) =>
|
const source = data.qualities.reduce((p: any, c: any) =>
|
||||||
c.quality > p.quality ? c : p
|
c.quality > p.quality ? c : p
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const mappedCaptions = data.subtitles.map((sub: Record<string, any>) => ({
|
||||||
|
needsProxy: false,
|
||||||
|
url: sub.url.replace("https://convert-srt-to-vtt.vercel.app/?url=", ""),
|
||||||
|
type: MWCaptionType.SRT,
|
||||||
|
langIso: sub.language,
|
||||||
|
}))
|
||||||
|
|
||||||
return {
|
return {
|
||||||
embeds: [],
|
embeds: [],
|
||||||
stream: {
|
stream: {
|
||||||
streamUrl: source.url,
|
streamUrl: source.url.replace("akm-cdn", "aws-cdn").replace("gg-cdn", "aws-cdn"),
|
||||||
quality: qualityMap[source.quality as QualityInMap],
|
quality: qualityMap[source.quality as QualityInMap],
|
||||||
type: MWStreamType.HLS,
|
type: MWStreamType.HLS,
|
||||||
captions: [],
|
captions: mappedCaptions,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -109,20 +112,27 @@ registerProvider({
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const { qualities } = episodeStream.data;
|
const data = episodeStream.data;
|
||||||
|
|
||||||
// get best quality source
|
// get best quality source
|
||||||
const source = qualities.reduce((p: any, c: any) =>
|
const source = data.qualities.reduce((p: any, c: any) =>
|
||||||
c.quality > p.quality ? c : p
|
c.quality > p.quality ? c : p
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const mappedCaptions = data.subtitles.map((sub: Record<string, any>) => ({
|
||||||
|
needsProxy: false,
|
||||||
|
url: sub.url.replace("https://convert-srt-to-vtt.vercel.app/?url=", ""),
|
||||||
|
type: MWCaptionType.SRT,
|
||||||
|
langIso: sub.language,
|
||||||
|
}))
|
||||||
|
|
||||||
return {
|
return {
|
||||||
embeds: [],
|
embeds: [],
|
||||||
stream: {
|
stream: {
|
||||||
streamUrl: source.url,
|
streamUrl: source.url.replace("akm-cdn", "aws-cdn").replace("gg-cdn", "aws-cdn"),
|
||||||
quality: qualityMap[source.quality as QualityInMap],
|
quality: qualityMap[source.quality as QualityInMap],
|
||||||
type: MWStreamType.HLS,
|
type: MWStreamType.HLS,
|
||||||
captions: [],
|
captions: mappedCaptions,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue