mirror of
https://github.com/sussy-code/smov.git
synced 2024-12-30 16:17:41 +01:00
feat(embed): add mp4upload embed scraper
This commit is contained in:
parent
e912ea4715
commit
9003bf6788
2 changed files with 33 additions and 0 deletions
32
src/backend/embeds/mp4upload.ts
Normal file
32
src/backend/embeds/mp4upload.ts
Normal file
|
@ -0,0 +1,32 @@
|
|||
import { MWEmbedType } from "@/backend/helpers/embed";
|
||||
import { registerEmbedScraper } from "@/backend/helpers/register";
|
||||
import { MWStreamQuality, MWStreamType } from "@/backend/helpers/streams";
|
||||
|
||||
import { proxiedFetch } from "../helpers/fetch";
|
||||
|
||||
registerEmbedScraper({
|
||||
id: "mp4upload",
|
||||
displayName: "mp4upload",
|
||||
for: MWEmbedType.MP4UPLOAD,
|
||||
rank: 170,
|
||||
async getStream({ url }) {
|
||||
const embed = await proxiedFetch<any>(url);
|
||||
|
||||
const playerSrcRegex =
|
||||
/(?<=player\.src\()\s*{\s*type:\s*"[^"]+",\s*src:\s*"([^"]+)"\s*}\s*(?=\);)/s;
|
||||
|
||||
const playerSrc = embed.match(playerSrcRegex);
|
||||
|
||||
const streamUrl = playerSrc[1];
|
||||
|
||||
if (!streamUrl) throw new Error("Stream url not found");
|
||||
|
||||
return {
|
||||
embedId: MWEmbedType.MP4UPLOAD,
|
||||
streamUrl,
|
||||
quality: MWStreamQuality.Q1080P,
|
||||
captions: [],
|
||||
type: MWStreamType.MP4,
|
||||
};
|
||||
},
|
||||
});
|
|
@ -17,5 +17,6 @@ import "./embeds/streamm4u";
|
|||
import "./embeds/playm4u";
|
||||
import "./embeds/upcloud";
|
||||
import "./embeds/streamsb";
|
||||
import "./embeds/mp4upload";
|
||||
|
||||
initializeScraperStore();
|
||||
|
|
Loading…
Reference in a new issue