mirror of
https://github.com/movie-web/providers.git
synced 2025-09-13 12:23:24 +00:00
added upstream embed provider
This commit is contained in:
8
package-lock.json
generated
8
package-lock.json
generated
@@ -13,7 +13,8 @@
|
|||||||
"crypto-js": "^4.1.1",
|
"crypto-js": "^4.1.1",
|
||||||
"form-data": "^4.0.0",
|
"form-data": "^4.0.0",
|
||||||
"node-fetch": "^2.7.0",
|
"node-fetch": "^2.7.0",
|
||||||
"randombytes": "^2.1.0"
|
"randombytes": "^2.1.0",
|
||||||
|
"unpacker": "^1.0.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/crypto-js": "^4.1.1",
|
"@types/crypto-js": "^4.1.1",
|
||||||
@@ -6162,6 +6163,11 @@
|
|||||||
"node": ">= 4.0.0"
|
"node": ">= 4.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/unpacker": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/unpacker/-/unpacker-1.0.1.tgz",
|
||||||
|
"integrity": "sha512-0HTljwp8+JBdITpoHcK1LWi7X9U2BspUmWv78UWZh7NshYhbh1nec8baY/iSbe2OQTZ2bhAtVdnr6/BTD0DKVg=="
|
||||||
|
},
|
||||||
"node_modules/untildify": {
|
"node_modules/untildify": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/untildify/-/untildify-4.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/untildify/-/untildify-4.0.0.tgz",
|
||||||
|
@@ -63,6 +63,7 @@
|
|||||||
"eslint-import-resolver-typescript": "^3.5.5",
|
"eslint-import-resolver-typescript": "^3.5.5",
|
||||||
"eslint-plugin-import": "^2.27.5",
|
"eslint-plugin-import": "^2.27.5",
|
||||||
"eslint-plugin-prettier": "^4.2.1",
|
"eslint-plugin-prettier": "^4.2.1",
|
||||||
|
"node-fetch": "^2.7.0",
|
||||||
"prettier": "^2.6.2",
|
"prettier": "^2.6.2",
|
||||||
"spinnies": "^0.5.1",
|
"spinnies": "^0.5.1",
|
||||||
"ts-node": "^10.9.1",
|
"ts-node": "^10.9.1",
|
||||||
@@ -72,14 +73,14 @@
|
|||||||
"vite": "^4.0.0",
|
"vite": "^4.0.0",
|
||||||
"vite-plugin-dts": "^3.5.3",
|
"vite-plugin-dts": "^3.5.3",
|
||||||
"vite-plugin-eslint": "^1.8.1",
|
"vite-plugin-eslint": "^1.8.1",
|
||||||
"vitest": "^0.32.2",
|
"vitest": "^0.32.2"
|
||||||
"node-fetch": "^2.7.0"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"cheerio": "^1.0.0-rc.12",
|
"cheerio": "^1.0.0-rc.12",
|
||||||
"crypto-js": "^4.1.1",
|
"crypto-js": "^4.1.1",
|
||||||
"form-data": "^4.0.0",
|
"form-data": "^4.0.0",
|
||||||
"node-fetch": "^2.7.0",
|
"node-fetch": "^2.7.0",
|
||||||
"randombytes": "^2.1.0"
|
"randombytes": "^2.1.0",
|
||||||
|
"unpacker": "^1.0.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -2,6 +2,7 @@ import { Embed, Sourcerer } from '@/providers/base';
|
|||||||
import { mp4uploadScraper } from '@/providers/embeds/mp4upload';
|
import { mp4uploadScraper } from '@/providers/embeds/mp4upload';
|
||||||
import { streamsbScraper } from '@/providers/embeds/streamsb';
|
import { streamsbScraper } from '@/providers/embeds/streamsb';
|
||||||
import { upcloudScraper } from '@/providers/embeds/upcloud';
|
import { upcloudScraper } from '@/providers/embeds/upcloud';
|
||||||
|
import { upstreamScraper } from '@/providers/embeds/upstream';
|
||||||
import { flixhqScraper } from '@/providers/sources/flixhq/index';
|
import { flixhqScraper } from '@/providers/sources/flixhq/index';
|
||||||
import { goMoviesScraper } from '@/providers/sources/gomovies/index';
|
import { goMoviesScraper } from '@/providers/sources/gomovies/index';
|
||||||
import { kissAsianScraper } from '@/providers/sources/kissasian/index';
|
import { kissAsianScraper } from '@/providers/sources/kissasian/index';
|
||||||
@@ -15,5 +16,5 @@ export function gatherAllSources(): Array<Sourcerer> {
|
|||||||
|
|
||||||
export function gatherAllEmbeds(): Array<Embed> {
|
export function gatherAllEmbeds(): Array<Embed> {
|
||||||
// all embeds are gathered here
|
// 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