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

View File

@@ -1 +1,102 @@
"use strict";var __awaiter=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))(function(o,l){function r(e){try{a(n.next(e))}catch(e){l(e)}}function s(e){try{a(n.throw(e))}catch(e){l(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(r,s)}a((n=n.apply(e,t||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0}),exports.getMeta=void 0;const getMeta=function(e){return __awaiter(this,arguments,void 0,function*({link:e,providerContext:t}){var i,n,o,l,r;try{const{axios:s,cheerio:a,getBaseUrl:c}=t,d=yield c("protonMovies"),p=(yield s.get(`${d}${e}`)).data;const u=null===(r=null===(l=null===(o=null===(n=null===(i=a.load(p)('script:contains("decodeURIComponent")').text().split(" = "))||void 0===i?void 0:i[1])||void 0===n?void 0:n.split("protomovies"))||void 0===o?void 0:o[0])||void 0===l?void 0:l.trim())||void 0===r?void 0:r.slice(0,-1),v=JSON.parse(u).join("").replace(/\\"/g,'"').replace(/\\'/g,"'").replace(/\\n/g,"\n").replace(/\\t/g,"\t").replace(/\\r/g,"\r").replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&"),f=a.load(v),m=f(".trending-text.fw-bold.texture-text.text-uppercase.my-0.fadeInLeft.animated.d-inline-block").text(),g=f("#thumbnail").attr("src"),x=e.includes("series")?"series":"movie",h=f(".col-12.iq-mb-30.animated.fadeIn").first().text()||f(".description-content").text(),y=f(".p-0.mt-2.list-inline.d-flex.flex-wrap.movie-tag").find("li").map((e,t)=>f(t).text()).slice(0,3).get(),b=[];if("movie"===x){const t=[];t.push({title:"Movie",link:d+e}),b.push({title:"Movie",directLinks:t})}else f("#episodes").children().map((e,t)=>{let i=[];f(t).find(".episode-block").map((e,t)=>{const n=d+f(t).find("a").attr("href")||"",o="Episode "+f(t).find(".episode-number").text().split("E")[1];i.push({title:o,link:n})}),b.push({title:"Season "+(e+1),directLinks:i})});return{image:g||"",imdbId:"",linkList:b,title:m||"",synopsis:h,tags:y,type:x}}catch(e){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, _c, _d, _e, _f;
try {
const { axios, cheerio, getBaseUrl } = providerContext;
const baseUrl = yield getBaseUrl("protonMovies");
console.log("all", link);
const res = yield axios.get(`${baseUrl}${link}`);
const data = res.data;
function decodeHtml(encodedArray) {
// Join array elements into a single string
const joined = encodedArray.join("");
// Replace escaped quotes
const unescaped = joined.replace(/\\"/g, '"').replace(/\\'/g, "'");
// Remove remaining escape characters
const cleaned = unescaped
.replace(/\\n/g, "\n")
.replace(/\\t/g, "\t")
.replace(/\\r/g, "\r");
// Convert literal string representations back to characters
const decoded = cleaned
.replace(/&quot;/g, '"')
.replace(/&lt;/g, "<")
.replace(/&gt;/g, ">")
.replace(/&amp;/g, "&");
return decoded;
}
const $$ = cheerio.load(data);
const htmlArray = (_f = (_e = (_d = (_c = (_b = $$('script:contains("decodeURIComponent")')
.text()
.split(" = ")) === null || _b === void 0 ? void 0 : _b[1]) === null || _c === void 0 ? void 0 : _c.split("protomovies")) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.trim()) === null || _f === void 0 ? void 0 : _f.slice(0, -1); // remove the last character
// console.log('protonGetInfo', htmlArray);
const html = decodeHtml(JSON.parse(htmlArray));
// console.log('all', html);
const $ = cheerio.load(html);
const title = $(".trending-text.fw-bold.texture-text.text-uppercase.my-0.fadeInLeft.animated.d-inline-block").text();
const image = $("#thumbnail").attr("src");
const type = link.includes("series") ? "series" : "movie";
const synopsis = $(".col-12.iq-mb-30.animated.fadeIn").first().text() ||
$(".description-content").text();
const tags = $(".p-0.mt-2.list-inline.d-flex.flex-wrap.movie-tag")
.find("li")
.map((i, el) => $(el).text())
.slice(0, 3)
.get();
const links = [];
if (type === "movie") {
const directLinks = [];
directLinks.push({ title: "Movie", link: baseUrl + link });
links.push({ title: "Movie", directLinks: directLinks });
}
else {
$("#episodes")
.children()
.map((i, element) => {
let directLinks = [];
$(element)
.find(".episode-block")
.map((j, ep) => {
const link = baseUrl + $(ep).find("a").attr("href") || "";
const title = "Episode " + $(ep).find(".episode-number").text().split("E")[1];
directLinks.push({ title, link });
});
links.push({ title: "Season " + (i + 1), directLinks: directLinks });
});
}
return {
image: image || "",
imdbId: "",
linkList: links,
title: title || "",
synopsis: synopsis,
tags: tags,
type: type,
};
}
catch (err) {
console.error("prton", err);
return {
title: "",
synopsis: "",
image: "",
imdbId: "",
type: "movie",
linkList: [],
};
}
});
};
exports.getMeta = getMeta;