mirror of
https://github.com/sussy-code/smov.git
synced 2024-12-29 16:07:40 +01:00
Merge branch 'dev' into dev
This commit is contained in:
commit
cffe5080f6
2 changed files with 50 additions and 0 deletions
|
@ -10,6 +10,7 @@ import "./providers/hdwatched";
|
|||
import "./providers/2embed";
|
||||
import "./providers/sflix";
|
||||
import "./providers/streamflix";
|
||||
import "./providers/remotestream";
|
||||
|
||||
// embeds
|
||||
import "./embeds/streamm4u";
|
||||
|
|
49
src/backend/providers/remotestream.ts
Normal file
49
src/backend/providers/remotestream.ts
Normal file
|
@ -0,0 +1,49 @@
|
|||
import { mwFetch } from "@/backend/helpers/fetch";
|
||||
import { registerProvider } from "@/backend/helpers/register";
|
||||
import { MWStreamQuality, MWStreamType } from "@/backend/helpers/streams";
|
||||
import { MWMediaType } from "@/backend/metadata/types";
|
||||
|
||||
const remotestreamBase = `https://fsa.remotestre.am`;
|
||||
|
||||
registerProvider({
|
||||
id: "remotestream",
|
||||
displayName: "Remote Stream",
|
||||
disabled: false,
|
||||
rank: 55,
|
||||
type: [MWMediaType.MOVIE, MWMediaType.SERIES],
|
||||
|
||||
async scrape({ media, episode, progress }) {
|
||||
if (!this.type.includes(media.meta.type)) {
|
||||
throw new Error("Unsupported type");
|
||||
}
|
||||
|
||||
progress(30);
|
||||
const type = media.meta.type === MWMediaType.MOVIE ? "Movies" : "Shows";
|
||||
let playlistLink = `${remotestreamBase}/${type}/${media.tmdbId}`;
|
||||
|
||||
if (media.meta.type === MWMediaType.SERIES) {
|
||||
const seasonNumber = media.meta.seasonData.number;
|
||||
const episodeNumber = media.meta.seasonData.episodes.find(
|
||||
(e) => e.id === episode
|
||||
)?.number;
|
||||
|
||||
playlistLink += `/${seasonNumber}/${episodeNumber}/${episodeNumber}.m3u8`;
|
||||
} else {
|
||||
playlistLink += `/${media.tmdbId}.m3u8`;
|
||||
}
|
||||
|
||||
const streamRes = await mwFetch<Blob>(playlistLink);
|
||||
if (streamRes.type !== "application/x-mpegurl")
|
||||
throw new Error("No watchable item found");
|
||||
progress(90);
|
||||
return {
|
||||
embeds: [],
|
||||
stream: {
|
||||
streamUrl: playlistLink,
|
||||
quality: MWStreamQuality.QUNKNOWN,
|
||||
type: MWStreamType.HLS,
|
||||
captions: [],
|
||||
},
|
||||
};
|
||||
},
|
||||
});
|
Loading…
Reference in a new issue