This commit is contained in:
himanshu8443
2025-07-11 19:45:14 +05:30
parent 13f71510d5
commit 35f1e57a0b
139 changed files with 10578 additions and 139 deletions

88
dist/mod/catalog.js vendored
View File

@@ -1 +1,87 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.genres=exports.catalog=void 0,exports.catalog=[{title:"Latest",filter:""},{title:"Netflix",filter:"/ott/netflix"},{title:"HBO Max",filter:"/ott/hbo-max"},{title:"Amazon Prime",filter:"/ott/amazon-prime-video"}],exports.genres=[{title:"Apple TV+",filter:"/ott/apple-tv"},{title:"Disney+",filter:"/ott/disney-plus"},{title:"Hulu",filter:"/ott/hulu"},{title:"Crunchyroll",filter:"/ott/crunchyroll"},{title:"Action",filter:"/movies-by-genre/action/"},{title:"Adventure",filter:"/movies-by-genre/adventure/"},{title:"Animation",filter:"/movies-by-genre/animated/"},{title:"Comedy",filter:"/movies-by-genre/comedy/"},{title:"Crime",filter:"/movies-by-genre/crime/"},{title:"Documentary",filter:"/movies-by-genre/documentary/"},{title:"Fantasy",filter:"/movies-by-genre/fantasy/"},{title:"Horror",filter:"/movies-by-genre/horror/"},{title:"Mystery",filter:"/movies-by-genre/mystery/"},{title:"Romance",filter:"/movies-by-genre/romance/"},{title:"Thriller",filter:"/movies-by-genre/thriller/"},{title:"Sci-Fi",filter:"/movies-by-genre/sci-fi/"}];
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.genres = exports.catalog = void 0;
exports.catalog = [
{
title: "Latest",
filter: "",
},
{
title: "Netflix",
filter: "/ott/netflix",
},
{
title: "HBO Max",
filter: "/ott/hbo-max",
},
{
title: "Amazon Prime",
filter: "/ott/amazon-prime-video",
},
];
exports.genres = [
{
title: "Apple TV+",
filter: "/ott/apple-tv",
},
{
title: "Disney+",
filter: "/ott/disney-plus",
},
{
title: "Hulu",
filter: "/ott/hulu",
},
{
title: "Crunchyroll",
filter: "/ott/crunchyroll",
},
{
title: "Action",
filter: "/movies-by-genre/action/",
},
{
title: "Adventure",
filter: "/movies-by-genre/adventure/",
},
{
title: "Animation",
filter: "/movies-by-genre/animated/",
},
{
title: "Comedy",
filter: "/movies-by-genre/comedy/",
},
{
title: "Crime",
filter: "/movies-by-genre/crime/",
},
{
title: "Documentary",
filter: "/movies-by-genre/documentary/",
},
{
title: "Fantasy",
filter: "/movies-by-genre/fantasy/",
},
{
title: "Horror",
filter: "/movies-by-genre/horror/",
},
{
title: "Mystery",
filter: "/movies-by-genre/mystery/",
},
{
title: "Romance",
filter: "/movies-by-genre/romance/",
},
{
title: "Thriller",
filter: "/movies-by-genre/thriller/",
},
{
title: "Sci-Fi",
filter: "/movies-by-genre/sci-fi/",
},
];

61
dist/mod/episodes.js vendored
View File

@@ -1 +1,60 @@
"use strict";var __awaiter=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))(function(o,r){function a(t){try{u(i.next(t))}catch(t){r(t)}}function s(t){try{u(i.throw(t))}catch(t){r(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}u((i=i.apply(t,e||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0}),exports.getEpisodes=void 0;const getEpisodes=function(t){return __awaiter(this,arguments,void 0,function*({url:t,providerContext:e}){var n;const{axios:i,cheerio:o}=e;try{t.includes("url=")&&(t=atob(t.split("url=")[1]));const e=(yield i.get(t)).data;let r=o.load(e);if(t.includes("url=")){const e=null===(n=r("meta[http-equiv='refresh']").attr("content"))||void 0===n?void 0:n.split("url=")[1],a=(yield i.get(e||t)).data;r=o.load(a)}const a=[];return r("h3,h4").map((t,e)=>{const n=r(e).text(),i=r(e).find("a").attr("href");i&&"#"!==i&&a.push({title:n.trim()||"No title found",link:i||""})}),r("a.maxbutton").map((t,e)=>{const n=r(e).children("span").text(),i=r(e).attr("href");i&&"#"!==i&&a.push({title:n.trim()||"No title found",link:i||""})}),a}catch(t){return[]}})};exports.getEpisodes=getEpisodes;
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
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) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getEpisodes = void 0;
const getEpisodes = function (_a) {
return __awaiter(this, arguments, void 0, function* ({ url, providerContext, }) {
var _b;
const { axios, cheerio } = providerContext;
try {
if (url.includes("url=")) {
url = atob(url.split("url=")[1]);
}
const res = yield axios.get(url);
const html = res.data;
let $ = cheerio.load(html);
if (url.includes("url=")) {
const newUrl = (_b = $("meta[http-equiv='refresh']")
.attr("content")) === null || _b === void 0 ? void 0 : _b.split("url=")[1];
const res2 = yield axios.get(newUrl || url);
const html2 = res2.data;
$ = cheerio.load(html2);
}
const episodeLinks = [];
$("h3,h4").map((i, element) => {
const seriesTitle = $(element).text();
const episodesLink = $(element).find("a").attr("href");
if (episodesLink && episodesLink !== "#") {
episodeLinks.push({
title: seriesTitle.trim() || "No title found",
link: episodesLink || "",
});
}
});
$("a.maxbutton").map((i, element) => {
const seriesTitle = $(element).children("span").text();
const episodesLink = $(element).attr("href");
if (episodesLink && episodesLink !== "#") {
episodeLinks.push({
title: seriesTitle.trim() || "No title found",
link: episodesLink || "",
});
}
});
return episodeLinks;
}
catch (err) {
console.error(err);
return [];
}
});
};
exports.getEpisodes = getEpisodes;

76
dist/mod/meta.js vendored
View File

@@ -1 +1,75 @@
"use strict";var __awaiter=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))(function(o,a){function r(t){try{d(n.next(t))}catch(t){a(t)}}function s(t){try{d(n.throw(t))}catch(t){a(t)}}function d(t){var e;t.done?o(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(r,s)}d((n=n.apply(t,e||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0}),exports.getMeta=void 0;const getMeta=function(t){return __awaiter(this,arguments,void 0,function*({link:t,providerContext:e}){var i;try{const{axios:n,cheerio:o}=e,a=t,r=(yield n.get(a)).data,s=o.load(r),d={title:s(".imdbwp__title").text(),synopsis:s(".imdbwp__teaser").text(),image:s(".imdbwp__thumb").find("img").attr("src")||"",imdbId:(null===(i=s(".imdbwp__link").attr("href"))||void 0===i?void 0:i.split("/")[4])||"",type:s(".thecontent").text().toLocaleLowerCase().includes("season")?"series":"movie"},l=[];return s("h3,h4").map((t,e)=>{var i;const n=s(e).text(),o=s(e).next("p").find(".maxbutton-episode-links,.maxbutton-g-drive,.maxbutton-af-download").attr("href"),a=s(e).next("p").find(".maxbutton-download-links").attr("href");(a||o&&"javascript:void(0);"!==o)&&l.push({title:n.replace("Download ","").trim()||"Download",episodesLink:o||"",directLinks:a?[{link:a,title:"Movie",type:"movie"}]:[],quality:(null===(i=null==n?void 0:n.match(/\d+p\b/))||void 0===i?void 0:i[0])||""})}),Object.assign(Object.assign({},d),{linkList:l})}catch(t){return{title:"",synopsis:"",image:"",imdbId:"",type:"movie",linkList:[]}}})};exports.getMeta=getMeta;
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
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) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getMeta = void 0;
const getMeta = function (_a) {
return __awaiter(this, arguments, void 0, function* ({ link, providerContext, }) {
var _b;
try {
const { axios, cheerio } = providerContext;
const url = link;
const res = yield axios.get(url);
const data = res.data;
const $ = cheerio.load(data);
const meta = {
title: $(".imdbwp__title").text(),
synopsis: $(".imdbwp__teaser").text(),
image: $(".imdbwp__thumb").find("img").attr("src") || "",
imdbId: ((_b = $(".imdbwp__link").attr("href")) === null || _b === void 0 ? void 0 : _b.split("/")[4]) || "",
type: $(".thecontent").text().toLocaleLowerCase().includes("season")
? "series"
: "movie",
};
const links = [];
$("h3,h4").map((i, element) => {
var _a;
const seriesTitle = $(element).text();
// const batchZipLink = $(element)
// .next("p")
// .find(".maxbutton-batch-zip,.maxbutton-zip-download")
// .attr("href");
const episodesLink = $(element)
.next("p")
.find(".maxbutton-episode-links,.maxbutton-g-drive,.maxbutton-af-download")
.attr("href");
const movieLink = $(element)
.next("p")
.find(".maxbutton-download-links")
.attr("href");
if (movieLink ||
(episodesLink && episodesLink !== "javascript:void(0);")) {
links.push({
title: seriesTitle.replace("Download ", "").trim() || "Download",
episodesLink: episodesLink || "",
directLinks: movieLink
? [{ link: movieLink, title: "Movie", type: "movie" }]
: [],
quality: ((_a = seriesTitle === null || seriesTitle === void 0 ? void 0 : seriesTitle.match(/\d+p\b/)) === null || _a === void 0 ? void 0 : _a[0]) || "",
});
}
});
// console.log('mod meta', links);
return Object.assign(Object.assign({}, meta), { linkList: links });
}
catch (err) {
console.error(err);
return {
title: "",
synopsis: "",
image: "",
imdbId: "",
type: "movie",
linkList: [],
};
}
});
};
exports.getMeta = getMeta;

60
dist/mod/posts.js vendored
View File

@@ -1 +1,59 @@
"use strict";var __awaiter=this&&this.__awaiter||function(t,e,r,i){return new(r||(r=Promise))(function(o,s){function n(t){try{c(i.next(t))}catch(t){s(t)}}function a(t){try{c(i.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r(function(t){t(e)})).then(n,a)}c((i=i.apply(t,e||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0}),exports.getSearchPosts=exports.getPosts=void 0;const getPosts=function(t){return __awaiter(this,arguments,void 0,function*({filter:t,page:e,signal:r,providerContext:i}){const{getBaseUrl:o,axios:s,cheerio:n}=i;return posts({url:`${(yield o("Moviesmod"))+t}/page/${e}/`,signal:r,axios:s,cheerio:n})})};exports.getPosts=getPosts;const getSearchPosts=function(t){return __awaiter(this,arguments,void 0,function*({searchQuery:t,page:e,signal:r,providerContext:i}){const{getBaseUrl:o,axios:s,cheerio:n}=i;return posts({url:`${yield o("Moviesmod")}/search/${t}/page/${e}/`,signal:r,axios:s,cheerio:n})})};function posts(t){return __awaiter(this,arguments,void 0,function*({url:t,signal:e,axios:r,cheerio:i}){try{const o=(yield r.get(t,{signal:e})).data,s=i.load(o),n=[];return s(".post-cards").find("article").map((t,e)=>{const r=s(e).find("a").attr("title"),i=s(e).find("a").attr("href"),o=s(e).find("img").attr("src");r&&i&&o&&n.push({title:r,link:i,image:o})}),n}catch(t){return[]}})}exports.getSearchPosts=getSearchPosts;
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
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) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getSearchPosts = exports.getPosts = void 0;
const getPosts = function (_a) {
return __awaiter(this, arguments, void 0, function* ({ filter, page, signal, providerContext, }) {
const { getBaseUrl, axios, cheerio } = providerContext;
const baseUrl = yield getBaseUrl("Moviesmod");
const url = `${baseUrl + filter}/page/${page}/`;
return posts({ url, signal, axios, cheerio });
});
};
exports.getPosts = getPosts;
const getSearchPosts = function (_a) {
return __awaiter(this, arguments, void 0, function* ({ searchQuery, page, signal, providerContext, }) {
const { getBaseUrl, axios, cheerio } = providerContext;
const baseUrl = yield getBaseUrl("Moviesmod");
const url = `${baseUrl}/search/${searchQuery}/page/${page}/`;
return posts({ url, signal, axios, cheerio });
});
};
exports.getSearchPosts = getSearchPosts;
function posts(_a) {
return __awaiter(this, arguments, void 0, function* ({ url, signal, axios, cheerio, }) {
try {
const res = yield axios.get(url, { signal });
const data = res.data;
const $ = cheerio.load(data);
const catalog = [];
$(".post-cards")
.find("article")
.map((i, element) => {
const title = $(element).find("a").attr("title");
const link = $(element).find("a").attr("href");
const image = $(element).find("img").attr("src");
if (title && link && image) {
catalog.push({
title: title,
link: link,
image: image,
});
}
});
return catalog;
}
catch (err) {
console.error("modGetPosts error ", err);
return [];
}
});
}

275
dist/mod/stream.js vendored
View File

@@ -1 +1,274 @@
"use strict";var __awaiter=this&&this.__awaiter||function(e,t,a,i){return new(a||(a=Promise))(function(o,r){function n(e){try{d(i.next(e))}catch(e){r(e)}}function c(e){try{d(i.throw(e))}catch(e){r(e)}}function d(e){var t;e.done?o(e.value):(t=e.value,t instanceof a?t:new a(function(e){e(t)})).then(n,c)}d((i=i.apply(e,t||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0}),exports.getStream=void 0;const headers={Accept:"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7","Cache-Control":"no-store","Accept-Language":"en-US,en;q=0.9",DNT:"1","sec-ch-ua":'"Not_A Brand";v="8", "Chromium";v="120", "Microsoft Edge";v="120"',"sec-ch-ua-mobile":"?0","sec-ch-ua-platform":'"Windows"',"Sec-Fetch-Dest":"document","Sec-Fetch-Mode":"navigate",Cookie:"popads_user_id=6ba8fe60a481387a3249f05aa058822d","Sec-Fetch-Site":"none","Sec-Fetch-User":"?1","Upgrade-Insecure-Requests":"1","User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0"},getStream=function(e){return __awaiter(this,arguments,void 0,function*({link:e,type:t,providerContext:a}){var i,o;const{axios:r,cheerio:n}=a;try{const c=function(e){return __awaiter(this,arguments,void 0,function*({url:e,providerContext:t}){var a;const{axios:i,cheerio:o}=t;try{e.includes("url=")&&(e=atob(e.split("url=")[1]));const t=(yield i.get(e)).data;let r=o.load(t);if(e.includes("url=")){const t=null===(a=r("meta[http-equiv='refresh']").attr("content"))||void 0===a?void 0:a.split("url=")[1],n=(yield i.get(t||e)).data;r=o.load(n)}const n=[];return r("h3,h4").map((e,t)=>{const a=r(t).text(),i=r(t).find("a").attr("href");i&&"#"!==i&&n.push({title:a.trim()||"No title found",link:i||""})}),r("a.maxbutton").map((e,t)=>{const a=r(t).children("span").text(),i=r(t).attr("href");i&&"#"!==i&&n.push({title:a.trim()||"No title found",link:i||""})}),n}catch(e){return[]}})};if("movie"===t){e=(yield c({url:e,providerContext:a}))[0].link||e}let d=yield modExtractor(e,a);const s=(null===(o=null===(i=null==d?void 0:d.data)||void 0===i?void 0:i.match(/content="0;url=(.*?)"/))||void 0===o?void 0:o[1])||e,l=[],h=yield isDriveLink(s),p=(yield r.get(h,{headers:headers})).data,u=n.load(p);try{const e=u(".btn.btn-light").attr("href")||"",t=yield r.get(e,{headers:headers}),a=t.data.match(/formData\.append\('token', '([a-f0-9]+)'\)/)[1],i=new FormData;i.append("token",a);const o=t.data.match(/fetch\('\/download\?id=([a-zA-Z0-9\/+]+)'/)[1],n=e.split("/download")[0],c=yield fetch(n+"/download?id="+o,{method:"POST",body:i,headers:{Referer:e,Cookie:"PHPSESSID=7e9658ce7c805dab5bbcea9046f7f308"}}),d=yield c.json();l.push({server:"ResumeBot",link:d.url,type:"mkv"})}catch(e){}try{const e=h.replace("/file","/wfile")+"?type=1",t=(yield r.get(e,{headers:headers})).data,a=n.load(t);a(".btn-success").each((e,t)=>{var a;const i=null===(a=t.attribs)||void 0===a?void 0:a.href;i&&l.push({server:"Cf Worker 1."+e,link:i,type:"mkv"})})}catch(e){}try{const e=h.replace("/file","/wfile")+"?type=2",t=(yield r.get(e,{headers:headers})).data,a=n.load(t);a(".btn-success").each((e,t)=>{var a;const i=null===(a=t.attribs)||void 0===a?void 0:a.href;i&&l.push({server:"Cf Worker 2."+e,link:i,type:"mkv"})})}catch(e){}try{const e=u(".btn-danger").attr("href")||"",t=e.split("=")[1],a=new FormData;a.append("keys",t);const i=e.split("/").slice(0,3).join("/")+"/api",o=yield fetch(i,{method:"POST",body:a,headers:{"x-token":i}}),r=yield o.json();if(!1===r.error){const e=r.url;l.push({server:"Gdrive-Instant",link:e,type:"mkv"})}}catch(e){}return l}catch(e){return[]}})};exports.getStream=getStream;const isDriveLink=e=>__awaiter(void 0,void 0,void 0,function*(){if(e.includes("drive")){const t=yield fetch(e),a=(yield t.text()).match(/window\.location\.replace\("([^"]+)"\)/),i=null==a?void 0:a[1];return`https://${e.split("/")[2]}${i}`}return e});function modExtractor(e,t){return __awaiter(this,void 0,void 0,function*(){const{axios:a,cheerio:i}=t;try{const t=e.split("sid=")[1];var o=new FormData;o.append("_wp_http",t);const n=yield fetch(e.split("?")[0],{method:"POST",body:o}),c=yield n.text(),d=i.load(c),s=d("input").attr("name","_wp_http2").val();var r=new FormData;r.append("_wp_http2",s);const l=d("form").attr("action")||e.split("?")[0],h=yield fetch(l,{method:"POST",body:r}),p=(yield h.text()).match(/setAttribute\("href",\s*"(.*?)"/)[1],u=p.split("=")[1];return yield a.get(p,{headers:{Referer:l,Cookie:`${u}=${s}`}})}catch(e){}})}
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
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) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getStream = void 0;
const headers = {
Accept: "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
"Cache-Control": "no-store",
"Accept-Language": "en-US,en;q=0.9",
DNT: "1",
"sec-ch-ua": '"Not_A Brand";v="8", "Chromium";v="120", "Microsoft Edge";v="120"',
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": '"Windows"',
"Sec-Fetch-Dest": "document",
"Sec-Fetch-Mode": "navigate",
Cookie: "popads_user_id=6ba8fe60a481387a3249f05aa058822d",
"Sec-Fetch-Site": "none",
"Sec-Fetch-User": "?1",
"Upgrade-Insecure-Requests": "1",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0",
};
const getStream = function (_a) {
return __awaiter(this, arguments, void 0, function* ({ link: url, type, providerContext, }) {
var _b, _c;
const { axios, cheerio } = providerContext;
try {
const modGetEpisodeLinks = function (_a) {
return __awaiter(this, arguments, void 0, function* ({ url, providerContext, }) {
var _b;
const { axios, cheerio } = providerContext;
try {
if (url.includes("url=")) {
url = atob(url.split("url=")[1]);
}
const res = yield axios.get(url);
const html = res.data;
let $ = cheerio.load(html);
if (url.includes("url=")) {
const newUrl = (_b = $("meta[http-equiv='refresh']")
.attr("content")) === null || _b === void 0 ? void 0 : _b.split("url=")[1];
const res2 = yield axios.get(newUrl || url);
const html2 = res2.data;
$ = cheerio.load(html2);
}
const episodeLinks = [];
$("h3,h4").map((i, element) => {
const seriesTitle = $(element).text();
const episodesLink = $(element).find("a").attr("href");
if (episodesLink && episodesLink !== "#") {
episodeLinks.push({
title: seriesTitle.trim() || "No title found",
link: episodesLink || "",
});
}
});
$("a.maxbutton").map((i, element) => {
const seriesTitle = $(element).children("span").text();
const episodesLink = $(element).attr("href");
if (episodesLink && episodesLink !== "#") {
episodeLinks.push({
title: seriesTitle.trim() || "No title found",
link: episodesLink || "",
});
}
});
return episodeLinks;
}
catch (err) {
console.error(err);
return [];
}
});
};
console.log("modGetStream", type, url);
if (type === "movie") {
const servers = yield modGetEpisodeLinks({ url, providerContext });
url = servers[0].link || url;
}
let downloadLink = yield modExtractor(url, providerContext);
// console.log(downloadLink.data);
const ddl = ((_c = (_b = downloadLink === null || downloadLink === void 0 ? void 0 : downloadLink.data) === null || _b === void 0 ? void 0 : _b.match(/content="0;url=(.*?)"/)) === null || _c === void 0 ? void 0 : _c[1]) || url;
// console.log('ddl', url);
// console.log(ddl);
// console.log(ddl);
const servers = [];
const driveLink = yield isDriveLink(ddl);
const driveRes = yield axios.get(driveLink, { headers });
const driveHtml = driveRes.data;
const $drive = cheerio.load(driveHtml);
try {
const resumeBot = $drive(".btn.btn-light").attr("href") || "";
const resumeBotRes = yield axios.get(resumeBot, { headers });
const resumeBotToken = resumeBotRes.data.match(/formData\.append\('token', '([a-f0-9]+)'\)/)[1];
const resumeBotBody = new FormData();
resumeBotBody.append("token", resumeBotToken);
const resumeBotPath = resumeBotRes.data.match(/fetch\('\/download\?id=([a-zA-Z0-9\/+]+)'/)[1];
const resumeBotBaseUrl = resumeBot.split("/download")[0];
// console.log(
// 'resumeBotPath',
// resumeBotBaseUrl + '/download?id=' + resumeBotPath,
// );
// console.log('resumeBotBody', resumeBotToken);
const resumeBotDownload = yield fetch(resumeBotBaseUrl + "/download?id=" + resumeBotPath, {
method: "POST",
body: resumeBotBody,
headers: {
Referer: resumeBot,
Cookie: "PHPSESSID=7e9658ce7c805dab5bbcea9046f7f308",
},
});
const resumeBotDownloadData = yield resumeBotDownload.json();
console.log("resumeBotDownloadData", resumeBotDownloadData.url);
servers.push({
server: "ResumeBot",
link: resumeBotDownloadData.url,
type: "mkv",
});
}
catch (err) {
console.log("ResumeBot link not found", err);
}
// CF workers type 1
try {
const cfWorkersLink = driveLink.replace("/file", "/wfile") + "?type=1";
const cfWorkersRes = yield axios.get(cfWorkersLink, { headers });
const cfWorkersHtml = cfWorkersRes.data;
const $cfWorkers = cheerio.load(cfWorkersHtml);
const cfWorkersStream = $cfWorkers(".btn-success");
cfWorkersStream.each((i, el) => {
var _a;
const link = (_a = el.attribs) === null || _a === void 0 ? void 0 : _a.href;
if (link) {
servers.push({
server: "Cf Worker 1." + i,
link: link,
type: "mkv",
});
}
});
}
catch (err) {
console.log("CF workers link not found", err);
}
// CF workers type 2
try {
const cfWorkersLink = driveLink.replace("/file", "/wfile") + "?type=2";
const cfWorkersRes = yield axios.get(cfWorkersLink, { headers });
const cfWorkersHtml = cfWorkersRes.data;
const $cfWorkers = cheerio.load(cfWorkersHtml);
const cfWorkersStream = $cfWorkers(".btn-success");
cfWorkersStream.each((i, el) => {
var _a;
const link = (_a = el.attribs) === null || _a === void 0 ? void 0 : _a.href;
if (link) {
servers.push({
server: "Cf Worker 2." + i,
link: link,
type: "mkv",
});
}
});
}
catch (err) {
console.log("CF workers link not found", err);
}
// gdrive
//instant link
try {
const seed = $drive(".btn-danger").attr("href") || "";
const instantToken = seed.split("=")[1];
// console.log('InstantToken', instantToken);
const InstantFromData = new FormData();
InstantFromData.append("keys", instantToken);
const videoSeedUrl = seed.split("/").slice(0, 3).join("/") + "/api";
// console.log('videoSeedUrl', videoSeedUrl);
const instantLinkRes = yield fetch(videoSeedUrl, {
method: "POST",
body: InstantFromData,
headers: {
"x-token": videoSeedUrl,
},
});
const instantLinkData = yield instantLinkRes.json();
// console.log('instantLinkData', instantLinkData);
if (instantLinkData.error === false) {
const instantLink = instantLinkData.url;
servers.push({
server: "Gdrive-Instant",
link: instantLink,
type: "mkv",
});
}
else {
console.log("Instant link not found", instantLinkData);
}
}
catch (err) {
console.log("Instant link not found", err);
}
return servers;
}
catch (err) {
console.log("getStream error", err);
return [];
}
});
};
exports.getStream = getStream;
const isDriveLink = (ddl) => __awaiter(void 0, void 0, void 0, function* () {
if (ddl.includes("drive")) {
const driveLeach = yield fetch(ddl);
const driveLeachData = yield driveLeach.text();
const pathMatch = driveLeachData.match(/window\.location\.replace\("([^"]+)"\)/);
const path = pathMatch === null || pathMatch === void 0 ? void 0 : pathMatch[1];
const mainUrl = ddl.split("/")[2];
console.log(`driveUrl = https://${mainUrl}${path}`);
return `https://${mainUrl}${path}`;
}
else {
return ddl;
}
});
function modExtractor(url, providerContext) {
return __awaiter(this, void 0, void 0, function* () {
const { axios, cheerio } = providerContext;
try {
const wpHttp = url.split("sid=")[1];
var bodyFormData0 = new FormData();
bodyFormData0.append("_wp_http", wpHttp);
const res = yield fetch(url.split("?")[0], {
method: "POST",
body: bodyFormData0,
});
const data = yield res.text();
// console.log('', data);
const html = data;
const $ = cheerio.load(html);
// find input with name="_wp_http2"
const wpHttp2 = $("input").attr("name", "_wp_http2").val();
// console.log('wpHttp2', wpHttp2);
// form data
var bodyFormData = new FormData();
bodyFormData.append("_wp_http2", wpHttp2);
const formUrl1 = $("form").attr("action");
const formUrl = formUrl1 || url.split("?")[0];
const res2 = yield fetch(formUrl, {
method: "POST",
body: bodyFormData,
});
const html2 = yield res2.text();
const link = html2.match(/setAttribute\("href",\s*"(.*?)"/)[1];
console.log(link);
const cookie = link.split("=")[1];
console.log("cookie", cookie);
const downloadLink = yield axios.get(link, {
headers: {
Referer: formUrl,
Cookie: `${cookie}=${wpHttp2}`,
},
});
return downloadLink;
}
catch (err) {
console.log("modGetStream error", err);
}
});
}