mirror of
https://github.com/vega-org/vega-providers.git
synced 2026-04-17 15:41:45 +00:00
1 line
3.6 KiB
JavaScript
1 line
3.6 KiB
JavaScript
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())})};exports.getMeta=void 0;const headers={Accept:"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,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","Sec-Fetch-Site":"none","Sec-Fetch-User":"?1",Cookie:"xla=s4t; _ga=GA1.1.1081149560.1756378968; _ga_BLZGKYN5PF=GS2.1.s1756378968$o1$g1$t1756378984$j44$l0$h0","Upgrade-Insecure-Requests":"1","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 Edg/131.0.0.0"},getMeta=function(_a){return __awaiter(this,arguments,void 0,function*({link:link,providerContext:providerContext}){var _b;const{axios:axios,cheerio:cheerio}=providerContext,url=link,baseUrl=url.split("/").slice(0,3).join("/"),emptyResult={title:"",synopsis:"",image:"",imdbId:"",type:"movie",linkList:[]};try{const response=yield axios.get(url,{headers:Object.assign(Object.assign({},headers),{Referer:baseUrl})}),$=cheerio.load(response.data),infoContainer=$(".entry-content, .post-inner").first(),result={title:"",synopsis:"",image:"",imdbId:"",type:"movie",linkList:[]},downloadTitleMatch=infoContainer.find("h6 span").first().text().match(/(.*)\s*\(\d{4}\)/);if(downloadTitleMatch&&(result.title=downloadTitleMatch[1].trim()),!result.title||"Unknown Title"===result.title){const rawTitle=$("#movie_title a").text().trim();result.title=rawTitle.replace(/<small>.*<\/small>/,"").trim()||"Unknown Title"}const firstDownloadHeadingText=infoContainer.find("h6").first().text(),isSeries=firstDownloadHeadingText.includes("S01")||firstDownloadHeadingText.includes("E01")||firstDownloadHeadingText.toLowerCase().includes("season");result.type=isSeries?"series":"movie";const imdbMatch=null===(_b=$("#movie_title a").attr("href"))||void 0===_b?void 0:_b.match(/tt\d+/);result.imdbId=imdbMatch?imdbMatch[0]:"";let image=infoContainer.find('img[decoding="async"]').first().attr("src")||"";image.startsWith("//")&&(image="https:"+image),result.image=image,result.synopsis=infoContainer.find("#summary b:contains('Summary:')").parent().text().replace("Summary:","").trim()||"";const links=[];return infoContainer.find("h6").filter((_,el)=>!$(el).text().includes("Watch Online")).each((index,element)=>{var _a,_b;const el=$(element),fullTitle=el.text().trim(),qualityMatch=(null===(_a=fullTitle.match(/\d{3,4}p\b/))||void 0===_a?void 0:_a[0])||"",fileSizeMatch=(null===(_b=fullTitle.match(/\[([^\]]+)\](?=[^\[]*$)/))||void 0===_b?void 0:_b[1])||"",nextSiblings=el.nextUntil("h6, hr");nextSiblings.find("a").add(nextSiblings.filter("a")).each((i,btn)=>{const link=$(btn).attr("href"),seMatch=fullTitle.match(/(S\d{2}E\d{2}|S\d{2}|E\d{2})/),seasonEpisode=seMatch?`${seMatch[0]} | `:"";links.push({title:`${seasonEpisode}${qualityMatch}${fileSizeMatch?" | "+fileSizeMatch:""}`.trim().replace(/\|$/,"").trim(),quality:qualityMatch,episodesLink:link})})}),result.linkList=links,result}catch(err){return emptyResult}})};exports.getMeta=getMeta; |