commit
96b090a033
|
@ -4,6 +4,14 @@ import { makeEmbed } from '@/providers/base';
|
||||||
const hlsURLRegex = /file:"(.*?)"/;
|
const hlsURLRegex = /file:"(.*?)"/;
|
||||||
const setPassRegex = /var pass_path = "(.*set_pass\.php.*)";/;
|
const setPassRegex = /var pass_path = "(.*set_pass\.php.*)";/;
|
||||||
|
|
||||||
|
function formatHlsB64(data: string): string {
|
||||||
|
const encodedB64 = data.replace(/\/@#@\/[^=/]+==/g, '');
|
||||||
|
if (encodedB64.match(/\/@#@\/[^=/]+==/)) {
|
||||||
|
return formatHlsB64(encodedB64);
|
||||||
|
}
|
||||||
|
return encodedB64;
|
||||||
|
}
|
||||||
|
|
||||||
export const vidsrcembedScraper = makeEmbed({
|
export const vidsrcembedScraper = makeEmbed({
|
||||||
id: 'vidsrcembed', // VidSrc is both a source and an embed host
|
id: 'vidsrcembed', // VidSrc is both a source and an embed host
|
||||||
name: 'VidSrc',
|
name: 'VidSrc',
|
||||||
|
@ -15,10 +23,12 @@ export const vidsrcembedScraper = makeEmbed({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const match = html.match(hlsURLRegex)?.[1]?.replace(/(\/\/\S+?=)|#2|=/g, '');
|
// When this eventually breaks see the player js @ pjs_main.js
|
||||||
if (!match) throw new Error('Unable to find HLS playlist');
|
// If you know what youre doing and are slightly confused about how to reverse this feel free to reach out to ciaran_ds on discord with any queries
|
||||||
const finalUrl = atob(match);
|
let hlsMatch = html.match(hlsURLRegex)?.[1]?.slice(2);
|
||||||
|
if (!hlsMatch) throw new Error('Unable to find HLS playlist');
|
||||||
|
hlsMatch = formatHlsB64(hlsMatch);
|
||||||
|
const finalUrl = atob(hlsMatch);
|
||||||
if (!finalUrl.includes('.m3u8')) throw new Error('Unable to find HLS playlist');
|
if (!finalUrl.includes('.m3u8')) throw new Error('Unable to find HLS playlist');
|
||||||
|
|
||||||
let setPassLink = html.match(setPassRegex)?.[1];
|
let setPassLink = html.match(setPassRegex)?.[1];
|
||||||
|
|
Loading…
Reference in New Issue