mirror of
https://github.com/vega-org/vega-providers.git
synced 2026-04-17 23:51:44 +00:00
minify again
This commit is contained in:
88
dist/multi/meta.js
vendored
88
dist/multi/meta.js
vendored
@@ -1,87 +1 @@
|
||||
"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, }) {
|
||||
try {
|
||||
const { axios, cheerio } = providerContext;
|
||||
const url = link;
|
||||
const res = yield axios.get(url);
|
||||
const data = res.data;
|
||||
const $ = cheerio.load(data);
|
||||
const type = url.includes("tvshows") ? "series" : "movie";
|
||||
const imdbId = "";
|
||||
const title = url.split("/")[4].replace(/-/g, " ");
|
||||
const image = $(".g-item").find("a").attr("href") || "";
|
||||
const synopsis = $(".wp-content").find("p").text() || "";
|
||||
// Links
|
||||
const links = [];
|
||||
if (type === "series") {
|
||||
$("#seasons")
|
||||
.children()
|
||||
.map((i, element) => {
|
||||
const title = $(element)
|
||||
.find(".title")
|
||||
.children()
|
||||
.remove()
|
||||
.end()
|
||||
.text();
|
||||
let episodesList = [];
|
||||
$(element)
|
||||
.find(".episodios")
|
||||
.children()
|
||||
.map((i, element) => {
|
||||
const title = "Episode" +
|
||||
$(element).find(".numerando").text().trim().split("-")[1];
|
||||
const link = $(element).find("a").attr("href");
|
||||
if (title && link) {
|
||||
episodesList.push({ title, link });
|
||||
}
|
||||
});
|
||||
if (title && episodesList.length > 0) {
|
||||
links.push({
|
||||
title,
|
||||
directLinks: episodesList,
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
links.push({
|
||||
title: title,
|
||||
directLinks: [{ title: title, link: url.slice(0, -1), type: "movie" }],
|
||||
});
|
||||
}
|
||||
// console.log('multi meta', links);
|
||||
return {
|
||||
title,
|
||||
synopsis,
|
||||
image,
|
||||
imdbId,
|
||||
type,
|
||||
linkList: links,
|
||||
};
|
||||
}
|
||||
catch (err) {
|
||||
console.error(err);
|
||||
return {
|
||||
title: "",
|
||||
synopsis: "",
|
||||
image: "",
|
||||
imdbId: "",
|
||||
type: "movie",
|
||||
linkList: [],
|
||||
};
|
||||
}
|
||||
});
|
||||
};
|
||||
exports.getMeta = getMeta;
|
||||
"use strict";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())})};Object.defineProperty(exports,"__esModule",{value:!0}),exports.getMeta=void 0;const getMeta=function(_a){return __awaiter(this,arguments,void 0,function*({link:link,providerContext:providerContext}){try{const{axios:axios,cheerio:cheerio}=providerContext,url=link,data=(yield axios.get(url)).data,$=cheerio.load(data),type=url.includes("tvshows")?"series":"movie",imdbId="",title=url.split("/")[4].replace(/-/g," "),image=$(".g-item").find("a").attr("href")||"",synopsis=$(".wp-content").find("p").text()||"",links=[];return"series"===type?$("#seasons").children().map((i,element)=>{const title=$(element).find(".title").children().remove().end().text();let episodesList=[];$(element).find(".episodios").children().map((i,element)=>{const title="Episode"+$(element).find(".numerando").text().trim().split("-")[1],link=$(element).find("a").attr("href");title&&link&&episodesList.push({title:title,link:link})}),title&&episodesList.length>0&&links.push({title:title,directLinks:episodesList})}):links.push({title:title,directLinks:[{title:title,link:url.slice(0,-1),type:"movie"}]}),{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;
|
||||
Reference in New Issue
Block a user