Skip to content

Commit

Permalink
Merge pull request #116 from zisra/primewire
Browse files Browse the repository at this point in the history
Primewire
  • Loading branch information
JorrinKievit authored Mar 28, 2024
2 parents acb9531 + f7592cb commit 943c8b8
Show file tree
Hide file tree
Showing 11 changed files with 631 additions and 3 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ module.exports = {
plugins: ['@typescript-eslint', 'import', 'prettier'],
rules: {
'no-plusplus': 'off',
'class-methods-use-this': 'off',
'no-bitwise': 'off',
'no-underscore-dangle': 'off',
'@typescript-eslint/no-explicit-any': 'off',
Expand Down
8 changes: 8 additions & 0 deletions src/providers/all.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,16 @@ import { fileMoonScraper } from './embeds/filemoon';
import { ridooScraper } from './embeds/ridoo';
import { smashyStreamDScraper } from './embeds/smashystream/dued';
import { smashyStreamFScraper } from './embeds/smashystream/video1';
import { streamtapeScraper } from './embeds/streamtape';
import { streamvidScraper } from './embeds/streamvid';
import { vidCloudScraper } from './embeds/vidcloud';
import { vidplayScraper } from './embeds/vidplay';
import { voeScraper } from './embeds/voe';
import { wootlyScraper } from './embeds/wootly';
import { goojaraScraper } from './sources/goojara';
import { hdRezkaScraper } from './sources/hdrezka';
import { nepuScraper } from './sources/nepu';
import { primewireScraper } from './sources/primewire';
import { ridooMoviesScraper } from './sources/ridomovies';
import { smashyStreamScraper } from './sources/smashystream';
import { vidSrcToScraper } from './sources/vidsrcto';
Expand All @@ -50,6 +54,7 @@ export function gatherAllSources(): Array<Sourcerer> {
nepuScraper,
goojaraScraper,
hdRezkaScraper,
primewireScraper,
];
}

Expand All @@ -74,5 +79,8 @@ export function gatherAllEmbeds(): Array<Embed> {
vidplayScraper,
wootlyScraper,
doodScraper,
streamvidScraper,
voeScraper,
streamtapeScraper,
];
}
11 changes: 8 additions & 3 deletions src/providers/embeds/dood.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,20 @@ import { customAlphabet } from 'nanoid';
import { makeEmbed } from '@/providers/base';

const nanoid = customAlphabet('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789', 10);
const baseUrl = 'https://d000d.com';

export const doodScraper = makeEmbed({
id: 'dood',
name: 'dood',
rank: 173,
async scrape(ctx) {
const baseUrl = 'https://d0000d.com';
let url = ctx.url;
if (ctx.url.includes('primewire')) {
const request = await ctx.proxiedFetcher.full(ctx.url);
url = request.finalUrl;
}

const id = ctx.url.split('/d/')[1] || ctx.url.split('/e/')[1];
const id = url.split('/d/')[1] || url.split('/e/')[1];

const doodData = await ctx.proxiedFetcher<string>(`/e/${id}`, {
method: 'GET',
Expand Down Expand Up @@ -46,7 +51,7 @@ export const doodScraper = makeEmbed({
},
},
headers: {
Referer: 'https://d0000d.com/',
Referer: baseUrl,
},
},
],
Expand Down
39 changes: 39 additions & 0 deletions src/providers/embeds/streamtape.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { flags } from '@/entrypoint/utils/targets';
import { makeEmbed } from '@/providers/base';

export const streamtapeScraper = makeEmbed({
id: 'streamtape',
name: 'Streamtape',
rank: 160,
async scrape(ctx) {
const embed = await ctx.proxiedFetcher<string>(ctx.url);

const match = embed.match(/robotlink'\).innerHTML = (.*)'/);
if (!match) throw new Error('No match found');

const [fh, sh] = match?.[1]?.split("+ ('") ?? [];
if (!fh || !sh) throw new Error('No match found');

const url = `https:${fh?.replace(/'/g, '').trim()}${sh?.substring(3).trim()}`;

return {
stream: [
{
id: 'primary',
type: 'file',
flags: [flags.CORS_ALLOWED, flags.IP_LOCKED],
captions: [],
qualities: {
unknown: {
type: 'mp4',
url,
},
},
headers: {
Referer: 'https://streamtape.com',
},
},
],
};
},
});
36 changes: 36 additions & 0 deletions src/providers/embeds/streamvid.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import * as unpacker from 'unpacker';

import { flags } from '@/entrypoint/utils/targets';
import { makeEmbed } from '@/providers/base';

const packedRegex = /(eval\(function\(p,a,c,k,e,d\).*\)\)\))/;
const linkRegex = /src:"(https:\/\/[^"]+)"/;

export const streamvidScraper = makeEmbed({
id: 'streamvid',
name: 'Streamvid',
rank: 215,
async scrape(ctx) {
// Example url: https://streamvid.net/fu1jaf96vofx
const streamRes = await ctx.proxiedFetcher<string>(ctx.url);
const packed = streamRes.match(packedRegex);

if (!packed) throw new Error('streamvid packed not found');

const unpacked = unpacker.unpack(packed[1]);
const link = unpacked.match(linkRegex);

if (!link) throw new Error('streamvid link not found');
return {
stream: [
{
type: 'hls',
id: 'primary',
playlist: link[1],
flags: [flags.CORS_ALLOWED],
captions: [],
},
],
};
},
});
33 changes: 33 additions & 0 deletions src/providers/embeds/voe.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { flags } from '@/entrypoint/utils/targets';
import { makeEmbed } from '@/providers/base';

const linkRegex = /'hls': ?'(http.*?)',/;

export const voeScraper = makeEmbed({
id: 'voe',
name: 'voe.sx',
rank: 180,
async scrape(ctx) {
const embed = await ctx.proxiedFetcher<string>(ctx.url);

const playerSrc = embed.match(linkRegex) ?? [];

const streamUrl = playerSrc[1];
if (!streamUrl) throw new Error('Stream url not found in embed code');

return {
stream: [
{
type: 'hls',
id: 'primary',
playlist: streamUrl,
flags: [flags.CORS_ALLOWED],
captions: [],
headers: {
Referer: 'https://voe.sx',
},
},
],
};
},
});
2 changes: 2 additions & 0 deletions src/providers/sources/primewire/common.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export const primewireBase = 'https://www.primewire.tf';
export const primewireApiKey = atob('bHpRUHNYU0tjRw==');
7 changes: 7 additions & 0 deletions src/providers/sources/primewire/decryption/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Maintaining decryption

This folder contains the decryption logic for the primewire provider

The code in `blowfish.ts` is a de-obfuscated version of the original code that is used to decrypt the video links. You can find original the code [in this JavaScript file](https://www.primewire.tf/js/app-21205005105979fb964d17bf03570023.js?vsn=d]) by searching for the keyword "sBox0".

The code is minified, so use prettier to deobfuscate it. In the case that the URL changes, you can find it used in the [primewire homepage](https://www.primewire.tf/).
Loading

0 comments on commit 943c8b8

Please sign in to comment.