mirror of
https://github.com/movie-web/providers.git
synced 2025-09-13 17:03:26 +00:00
added mixdrop embed provider
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { Embed, Sourcerer } from '@/providers/base';
|
||||
import { mixdropScraper } from '@/providers/embeds/mixdrop';
|
||||
import { mp4uploadScraper } from '@/providers/embeds/mp4upload';
|
||||
import { streamsbScraper } from '@/providers/embeds/streamsb';
|
||||
import { upcloudScraper } from '@/providers/embeds/upcloud';
|
||||
@@ -16,5 +17,5 @@ export function gatherAllSources(): Array<Sourcerer> {
|
||||
|
||||
export function gatherAllEmbeds(): Array<Embed> {
|
||||
// all embeds are gathered here
|
||||
return [upcloudScraper, mp4uploadScraper, streamsbScraper, upstreamScraper];
|
||||
return [upcloudScraper, mp4uploadScraper, streamsbScraper, upstreamScraper, mixdropScraper];
|
||||
}
|
||||
|
49
src/providers/embeds/mixdrop.ts
Normal file
49
src/providers/embeds/mixdrop.ts
Normal file
@@ -0,0 +1,49 @@
|
||||
import * as unpacker from 'unpacker';
|
||||
|
||||
import { flags } from '@/main/targets';
|
||||
import { makeEmbed } from '@/providers/base';
|
||||
|
||||
const packedRegex = /(eval\(function\(p,a,c,k,e,d\){.*{}\)\))/;
|
||||
const linkRegex = /MDCore\.wurl="(.*?)";/;
|
||||
|
||||
export const mixdropScraper = makeEmbed({
|
||||
id: 'mixdrop',
|
||||
name: 'MixDrop',
|
||||
rank: 198,
|
||||
async scrape(ctx) {
|
||||
// Example url: https://mixdrop.co/e/pkwrgp0pizgod0
|
||||
// Example url: https://mixdrop.vc/e/pkwrgp0pizgod0
|
||||
const streamRes = await ctx.proxiedFetcher<string>(ctx.url);
|
||||
const packed = streamRes.match(packedRegex);
|
||||
|
||||
if (packed) {
|
||||
const unpacked = unpacker.unpack(packed[1]);
|
||||
const link = unpacked.match(linkRegex);
|
||||
|
||||
if (link) {
|
||||
const url = link[1];
|
||||
return {
|
||||
stream: {
|
||||
type: 'file',
|
||||
flags: [flags.NO_CORS],
|
||||
qualities: {
|
||||
// TODO - Allow unknown qualitys?
|
||||
// MixDrop does not give quality info
|
||||
// This is just so it's even visible
|
||||
'1080': {
|
||||
type: 'mp4',
|
||||
url: url.startsWith('http') ? url : `https:${url}`, // URLs don't always start with the protocol
|
||||
headers: {
|
||||
// MixDrop requires this header on all streams
|
||||
Referer: 'https://mixdrop.co/',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
throw new Error('mixdrop source not found');
|
||||
},
|
||||
});
|
@@ -3,6 +3,7 @@ import { Flags } from '@/main/targets';
|
||||
export type StreamFile = {
|
||||
type: 'mp4';
|
||||
url: string;
|
||||
headers?: Record<string, string>;
|
||||
};
|
||||
|
||||
export type Qualities = '360' | '480' | '720' | '1080';
|
||||
|
Reference in New Issue
Block a user