mirror of
https://github.com/movie-web/providers.git
synced 2025-09-13 18:13:25 +00:00
added upstream embed provider
This commit is contained in:
@@ -2,6 +2,7 @@ import { Embed, Sourcerer } from '@/providers/base';
|
||||
import { mp4uploadScraper } from '@/providers/embeds/mp4upload';
|
||||
import { streamsbScraper } from '@/providers/embeds/streamsb';
|
||||
import { upcloudScraper } from '@/providers/embeds/upcloud';
|
||||
import { upstreamScraper } from '@/providers/embeds/upstream';
|
||||
import { flixhqScraper } from '@/providers/sources/flixhq/index';
|
||||
import { goMoviesScraper } from '@/providers/sources/gomovies/index';
|
||||
import { kissAsianScraper } from '@/providers/sources/kissasian/index';
|
||||
@@ -15,5 +16,5 @@ export function gatherAllSources(): Array<Sourcerer> {
|
||||
|
||||
export function gatherAllEmbeds(): Array<Embed> {
|
||||
// all embeds are gathered here
|
||||
return [upcloudScraper, mp4uploadScraper, streamsbScraper];
|
||||
return [upcloudScraper, mp4uploadScraper, streamsbScraper, upstreamScraper];
|
||||
}
|
||||
|
35
src/providers/embeds/upstream.ts
Normal file
35
src/providers/embeds/upstream.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
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 = /sources:\[{file:"(.*?)"/;
|
||||
|
||||
export const upstreamScraper = makeEmbed({
|
||||
id: 'upstream',
|
||||
name: 'UpStream',
|
||||
rank: 199,
|
||||
async scrape(ctx) {
|
||||
// Example url: https://upstream.to/embed-omscqgn6jc8r.html
|
||||
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) {
|
||||
return {
|
||||
stream: {
|
||||
type: 'hls',
|
||||
playlist: link[1],
|
||||
flags: [flags.NO_CORS],
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
throw new Error('upstream source not found');
|
||||
},
|
||||
});
|
Reference in New Issue
Block a user