mirror of
https://github.com/vega-org/vega-providers.git
synced 2026-04-17 23:51:44 +00:00
1 line
1.9 KiB
JavaScript
1 line
1.9 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 getMeta=function(_a){return __awaiter(this,arguments,void 0,function*({link:link,providerContext:providerContext}){var _b;try{const{axios:axios,cheerio:cheerio}=providerContext,url=link,data=(yield axios.get(url)).data,$=cheerio.load(data),type=$(".entry-content").text().toLocaleLowerCase().includes("movie name")?"movie":"series",imdbId=(null===(_b=$(".imdb_left").find("a").attr("href"))||void 0===_b?void 0:_b.split("/")[4])||"",title=$(".entry-content").find('strong:contains("Name")').children().remove().end().text().replace(":",""),synopsis=$(".entry-content").find('p:contains("Synopsis"),p:contains("Plot"),p:contains("Story")').children().remove().end().text(),image=$(".wp-caption").find("img").attr("data-src")||$(".entry-content").find("img").attr("data-src")||"",links=[];return $(".my-button").map((i,element)=>{var _a;const title=$(element).parent().parent().prev().text(),episodesLink=$(element).attr("href"),quality=(null===(_a=title.match(/\b(480p|720p|1080p|2160p)\b/i))||void 0===_a?void 0:_a[0])||"";episodesLink&&title&&links.push({title:title,episodesLink:"series"===type?episodesLink:"",directLinks:"movie"===type?[{link:episodesLink,title:title,type:"movie"}]:[],quality:quality})}),{title:title,synopsis:synopsis,image:image,imdbId:imdbId,type:type,linkList:links}}catch(err){return{title:"",synopsis:"",image:"",imdbId:"",type:"movie",linkList:[]}}})};exports.getMeta=getMeta; |