1
0
Fork 0
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:
mrjvs 2023-06-17 20:18:20 +02:00 committed by GitHub
commit cffe5080f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 50 additions and 0 deletions

View file

@ -10,6 +10,7 @@ import "./providers/hdwatched";
import "./providers/2embed";
import "./providers/sflix";
import "./providers/streamflix";
import "./providers/remotestream";
// embeds
import "./embeds/streamm4u";

View 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: [],
},
};
},
});