mirror of
https://github.com/movie-web/movie-web.git
synced 2024-12-26 11:06:05 +00:00
fix(netfilm): use different cdn
This commit is contained in:
parent
935cb2427b
commit
139a760be0
1
.gitattributes
vendored
Normal file
1
.gitattributes
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
* text=auto eol=lf
|
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
|
@ -4,5 +4,8 @@
|
|||
"eslint.format.enable": true,
|
||||
"[json]": {
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||
},
|
||||
"[typescript]": {
|
||||
"editor.defaultFormatter": "vscode.typescript-language-features"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { proxiedFetch } from "../helpers/fetch";
|
||||
import { registerProvider } from "../helpers/register";
|
||||
import { MWStreamQuality, MWStreamType } from "../helpers/streams";
|
||||
import { MWCaptionType, MWStreamQuality, MWStreamType } from "../helpers/streams";
|
||||
import { MWMediaType } from "../metadata/types";
|
||||
|
||||
const netfilmBase = "https://net-film.vercel.app";
|
||||
|
@ -18,7 +18,6 @@ registerProvider({
|
|||
displayName: "NetFilm",
|
||||
rank: 15,
|
||||
type: [MWMediaType.MOVIE, MWMediaType.SERIES],
|
||||
disabled: true, // https://github.com/lamhoang1256/netfilm/issues/25
|
||||
|
||||
async scrape({ media, episode, progress }) {
|
||||
// search for relevant item
|
||||
|
@ -41,12 +40,9 @@ registerProvider({
|
|||
|
||||
// get stream info from media
|
||||
progress(75);
|
||||
const watchInfo = await proxiedFetch<any>(
|
||||
`/api/episode?id=${netfilmId}`,
|
||||
{
|
||||
baseURL: netfilmBase,
|
||||
}
|
||||
);
|
||||
const watchInfo = await proxiedFetch<any>(`/api/episode?id=${netfilmId}`, {
|
||||
baseURL: netfilmBase,
|
||||
});
|
||||
|
||||
const { qualities } = watchInfo.data;
|
||||
|
||||
|
@ -58,7 +54,7 @@ registerProvider({
|
|||
return {
|
||||
embeds: [],
|
||||
stream: {
|
||||
streamUrl: source.url,
|
||||
streamUrl: source.url.replace("akm-cdn", "aws-cdn").replace("gg-cdn", "aws-cdn"),
|
||||
quality: qualityMap[source.quality as QualityInMap],
|
||||
type: MWStreamType.HLS,
|
||||
captions: [],
|
||||
|
@ -109,17 +105,17 @@ registerProvider({
|
|||
}
|
||||
);
|
||||
|
||||
const { qualities } = episodeStream.data;
|
||||
const data = episodeStream.data;
|
||||
|
||||
// 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
|
||||
);
|
||||
|
||||
return {
|
||||
embeds: [],
|
||||
stream: {
|
||||
streamUrl: source.url,
|
||||
streamUrl: source.url.replace("akm-cdn", "aws-cdn").replace("gg-cdn", "aws-cdn"),
|
||||
quality: qualityMap[source.quality as QualityInMap],
|
||||
type: MWStreamType.HLS,
|
||||
captions: [],
|
||||
|
|
Loading…
Reference in a new issue