Files
vega-providers/dist/kmMovies/meta.js
Himanshu a179a130d6 build
2026-02-03 21:48:37 +05:30

1 line
3.4 KiB
JavaScript

"use strict";var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__name=(t,e)=>__defProp(t,"name",{value:e,configurable:!0}),__export=(t,e)=>{for(var o in e)__defProp(t,o,{get:e[o],enumerable:!0})},__copyProps=(t,e,o,r)=>{if(e&&"object"==typeof e||"function"==typeof e)for(let a of __getOwnPropNames(e))__hasOwnProp.call(t,a)||a===o||__defProp(t,a,{get:()=>e[a],enumerable:!(r=__getOwnPropDesc(e,a))||r.enumerable});return t},__toCommonJS=t=>__copyProps(__defProp({},"__esModule",{value:!0}),t),__async=(t,e,o)=>new Promise((r,a)=>{var n=t=>{try{s(o.next(t))}catch(t){a(t)}},i=t=>{try{s(o.throw(t))}catch(t){a(t)}},s=t=>t.done?r(t.value):Promise.resolve(t.value).then(n,i);s((o=o.apply(t,e)).next())}),meta_exports={};__export(meta_exports,{getMeta:()=>getMeta});var kmmHeaders={Referer:"https://google.com","User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36"},getMeta=__name(function(t){return __async(this,arguments,function*({link:t,providerContext:e}){var o,r;try{const{axios:a,cheerio:n}=e;t.startsWith("http")||(t=`${yield e.getBaseUrl("kmmovies")}${t.startsWith("/")?"":"/"}${t}`);const i=yield a.get(t,{headers:kmmHeaders}),s=n.load(i.data),l=s("h1, h2, .animated-text").first().text().trim()||(null==(o=s("meta[property='og:title']").attr("content"))?void 0:o.trim())||s("title").text().trim()||"Unknown";let c=s("div.wp-slider-container img").first().attr("src")||s("meta[property='og:image']").attr("content")||s("meta[name='twitter:image']").attr("content")||"";c&&c.startsWith("http")||(c=new URL(c||"/placeholder.png",t).href);let d="";s("p").each((t,e)=>{const o=s(e).text().trim();if(o&&o.length>40&&!o.toLowerCase().includes("download")&&!o.toLowerCase().includes("quality"))return d=o,!1}),d||(d=s("meta[property='og:description']").attr("content")||s("meta[name='description']").attr("content")||"");const p=[];i.data.toLowerCase().includes("action")&&p.push("Action"),i.data.toLowerCase().includes("drama")&&p.push("Drama"),i.data.toLowerCase().includes("romance")&&p.push("Romance"),i.data.toLowerCase().includes("thriller")&&p.push("Thriller");const m=[];s("p").each((t,e)=>{const o=s(e).text().trim();/starring|cast/i.test(o)&&o.split(",").forEach(t=>m.push(t.trim()))});let h=(null==(r=s("p").text().match(/IMDb Rating[:\s]*([0-9.]+)/i))?void 0:r[1])||"";h&&!h.includes("/")&&(h+="/10");const _=s("p a[href*='imdb.com']").attr("href")||"",u=_&&_.includes("/tt")?"tt"+_.split("/tt")[1].split("/")[0]:"",g=[],f=s(".download-options-grid").length>0;return f?s(".download-card").each((t,e)=>{const o=s(e),r=o.find(".download-quality-text").text().trim(),a=o.find(".download-size-info").text().trim()||"",n=o.find("a.tabs-download-button").attr("href")||"";if(n){const t=`Download ${r} ${a}`.trim();g.push({title:t,quality:r||"AUTO",directLinks:[{link:n,title:t,type:"series"}]})}}):s("a.modern-download-button").each((t,e)=>{const o=s(e).closest(".modern-option-card").find(".modern-badge").text().trim()||"AUTO",r=s(e).attr("href")||"",a=`Download ${o}`;r&&g.push({title:a,quality:o,directLinks:[{link:r,title:a,type:"movie"}]})}),{title:l,synopsis:d,image:c,imdbId:u,type:f?"series":"movie",tags:p,cast:m,rating:h,linkList:g}}catch(t){return{title:"",synopsis:"",image:"https://via.placeholder.com/300x450",imdbId:"",type:"movie",tags:[],cast:[],rating:"",linkList:[]}}})},"getMeta");exports.getMeta=getMeta;