fix: update getStream function to use dynamic base URL from provider context

This commit is contained in:
himanshu8443
2025-07-23 17:08:25 +05:30
parent 12f6713c22
commit e906a2d583
4 changed files with 11 additions and 6 deletions

View File

@@ -1 +1 @@
"use strict";var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){var value;result.done?resolve(result.value):(value=result.value,value instanceof P?value:new P(function(resolve){resolve(value)})).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0}),exports.getStream=void 0;const getStream=_a=>__awaiter(void 0,[_a],void 0,function*({link:id,providerContext:providerContext}){const{getBaseUrl:getBaseUrl}=providerContext;try{const baseUrl="https://netfree2.cc",url=`https://netmirror.8man.dev/api/net-proxy?url=${baseUrl}${"netflixMirror"==="netflixMirror"?"/mobile/playlist.php?id=":"/pv/playlist.php?id="}${id}&t=${Math.round((new Date).getTime()/1e3)}`,res=yield fetch(url,{credentials:"omit"}),resJson=yield res.json(),data=null==resJson?void 0:resJson[0],streamLinks=[];return null==data||data.sources.forEach(source=>{var _a;streamLinks.push({server:source.label,link:null===(_a=source.file)||void 0===_a?void 0:_a.replace(":su",":ni"),type:"m3u8",headers:{Referer:baseUrl,origin:baseUrl,Cookie:"hd=on"}})}),streamLinks}catch(err){return[]}});exports.getStream=getStream;
"use strict";var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){var value;result.done?resolve(result.value):(value=result.value,value instanceof P?value:new P(function(resolve){resolve(value)})).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0}),exports.getStream=void 0;const getStream=_a=>__awaiter(void 0,[_a],void 0,function*({link:id,providerContext:providerContext}){const{getBaseUrl:getBaseUrl}=providerContext;try{let providerValue="netflixMirror";const baseUrl=yield getBaseUrl("nfMirror"),url=`https://netmirror.8man.dev/api/net-proxy?url=${baseUrl}${"netflixMirror"===providerValue?"/mobile/playlist.php?id=":"/pv/playlist.php?id="}${id}&t=${Math.round((new Date).getTime()/1e3)}`,res=yield fetch(url,{credentials:"omit"}),resJson=yield res.json(),data=null==resJson?void 0:resJson[0],streamLinks=[];return null==data||data.sources.forEach(source=>{var _a;streamLinks.push({server:source.label,link:(null===(_a=source.file)||void 0===_a?void 0:_a.startsWith("http"))?source.file:`${baseUrl}${source.file}`,type:"m3u8",headers:{Referer:baseUrl,origin:baseUrl,Cookie:"hd=on"}})}),streamLinks}catch(err){return[]}});exports.getStream=getStream;

View File

@@ -1 +1 @@
"use strict";var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){var value;result.done?resolve(result.value):(value=result.value,value instanceof P?value:new P(function(resolve){resolve(value)})).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0}),exports.getStream=void 0;const getStream=_a=>__awaiter(void 0,[_a],void 0,function*({link:id,providerContext:providerContext}){const{getBaseUrl:getBaseUrl}=providerContext;try{const baseUrl="https://netfree2.cc",url=`https://netmirror.8man.dev/api/net-proxy?url=${baseUrl}${"netflixMirror"==="primeMirror"?"/mobile/playlist.php?id=":"/pv/playlist.php?id="}${id}&t=${Math.round((new Date).getTime()/1e3)}`,res=yield fetch(url,{credentials:"omit"}),resJson=yield res.json(),data=null==resJson?void 0:resJson[0],streamLinks=[];return null==data||data.sources.forEach(source=>{var _a;streamLinks.push({server:source.label,link:null===(_a=baseUrl+source.file)||void 0===_a?void 0:_a.replace(":su",":ni"),type:"m3u8",headers:{Referer:baseUrl,origin:baseUrl,Cookie:"hd=on"}})}),streamLinks}catch(err){return[]}});exports.getStream=getStream;
"use strict";var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){var value;result.done?resolve(result.value):(value=result.value,value instanceof P?value:new P(function(resolve){resolve(value)})).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0}),exports.getStream=void 0;const getStream=_a=>__awaiter(void 0,[_a],void 0,function*({link:id,providerContext:providerContext}){const{getBaseUrl:getBaseUrl}=providerContext;try{let providerValue="primeMirror";const baseUrl=yield getBaseUrl("nfMirror"),url=`https://netmirror.8man.dev/api/net-proxy?url=${baseUrl}${"netflixMirror"===providerValue?"/mobile/playlist.php?id=":"/pv/playlist.php?id="}${id}&t=${Math.round((new Date).getTime()/1e3)}`,res=yield fetch(url,{credentials:"omit"}),resJson=yield res.json(),data=null==resJson?void 0:resJson[0],streamLinks=[];return null==data||data.sources.forEach(source=>{var _a;streamLinks.push({server:source.label,link:(null===(_a=source.file)||void 0===_a?void 0:_a.startsWith("http"))?source.file:`${baseUrl}${source.file}`,type:"m3u8",headers:{Referer:baseUrl,origin:baseUrl,Cookie:"hd=on"}})}),streamLinks}catch(err){return[]}});exports.getStream=getStream;

View File

@@ -10,7 +10,8 @@ export const getStream = async ({
const { getBaseUrl } = providerContext;
try {
let providerValue = "netflixMirror";
const baseUrl = "https://netfree2.cc";
const baseUrl = await getBaseUrl("nfMirror");
console.log("nfGetStream, baseUrl:", baseUrl);
const url = `https://netmirror.8man.dev/api/net-proxy?url=${baseUrl}${
providerValue === "netflixMirror"
? "/mobile/playlist.php?id="
@@ -26,7 +27,9 @@ export const getStream = async ({
data?.sources.forEach((source: any) => {
streamLinks.push({
server: source.label,
link: source.file?.replace(":su", ":ni"),
link: source.file?.startsWith("http")
? source.file
: `${baseUrl}${source.file}`,
type: "m3u8",
headers: {
Referer: baseUrl,

View File

@@ -10,7 +10,7 @@ export const getStream = async ({
const { getBaseUrl } = providerContext;
try {
let providerValue = "primeMirror";
const baseUrl = "https://netfree2.cc";
const baseUrl = await getBaseUrl("nfMirror");
const url = `https://netmirror.8man.dev/api/net-proxy?url=${baseUrl}${
providerValue === "netflixMirror"
? "/mobile/playlist.php?id="
@@ -26,7 +26,9 @@ export const getStream = async ({
data?.sources.forEach((source: any) => {
streamLinks.push({
server: source.label,
link: (baseUrl + source.file)?.replace(":su", ":ni"),
link: source.file?.startsWith("http")
? source.file
: `${baseUrl}${source.file}`,
type: "m3u8",
headers: {
Referer: baseUrl,