mirror of
https://github.com/vega-org/vega-providers.git
synced 2026-04-17 15:41:45 +00:00
init
This commit is contained in:
39
dist/primeMirror/pmGetStream.js
vendored
Normal file
39
dist/primeMirror/pmGetStream.js
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.pmGetStream = void 0;
|
||||
const pmGetStream = async ({ link: id, providerContext, }) => {
|
||||
const { getBaseUrl } = providerContext;
|
||||
try {
|
||||
let providerValue = 'primeMirror';
|
||||
const baseUrl = await getBaseUrl('nfMirror');
|
||||
const url = `https://netmirror.8man.me/api/net-proxy?url=${baseUrl}${providerValue === 'netflixMirror'
|
||||
? '/mobile/playlist.php?id='
|
||||
: '/pv/playlist.php?id='}${id}&t=${Math.round(new Date().getTime() / 1000)}`;
|
||||
console.log('nfGetStream, url:', url);
|
||||
const res = await fetch(url, {
|
||||
credentials: 'omit',
|
||||
});
|
||||
const resJson = await res.json();
|
||||
const data = resJson?.[0];
|
||||
const streamLinks = [];
|
||||
data?.sources.forEach((source) => {
|
||||
streamLinks.push({
|
||||
server: source.label,
|
||||
link: (baseUrl + source.file)?.replace(':su', ':ni'),
|
||||
type: 'm3u8',
|
||||
headers: {
|
||||
Referer: baseUrl,
|
||||
origin: baseUrl,
|
||||
Cookie: 'hd=on',
|
||||
},
|
||||
});
|
||||
});
|
||||
console.log(streamLinks);
|
||||
return streamLinks;
|
||||
}
|
||||
catch (err) {
|
||||
console.error(err);
|
||||
return [];
|
||||
}
|
||||
};
|
||||
exports.pmGetStream = pmGetStream;
|
||||
Reference in New Issue
Block a user