mirror of
https://github.com/vega-org/vega-providers.git
synced 2026-04-17 23:51:44 +00:00
minify
This commit is contained in:
95
dist/ridoMovies/meta.js
vendored
95
dist/ridoMovies/meta.js
vendored
@@ -1,94 +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, }) {
|
||||
var _b, _c, _d, _e, _f, _g, _h;
|
||||
try {
|
||||
const { getBaseUrl, axios } = providerContext;
|
||||
const res = yield axios.get(link);
|
||||
const data = res.data;
|
||||
const meta = {
|
||||
title: "",
|
||||
synopsis: "",
|
||||
image: "",
|
||||
imdbId: ((_b = data === null || data === void 0 ? void 0 : data.meta) === null || _b === void 0 ? void 0 : _b.imdb_id) || "",
|
||||
type: ((_c = data === null || data === void 0 ? void 0 : data.meta) === null || _c === void 0 ? void 0 : _c.type) || "movie",
|
||||
};
|
||||
const baseUrl = yield getBaseUrl("ridomovies");
|
||||
let slug = "";
|
||||
try {
|
||||
const res2 = yield axios.get(baseUrl + "/core/api/search?q=" + meta.imdbId);
|
||||
const data2 = res2.data;
|
||||
slug = (_e = (_d = data2 === null || data2 === void 0 ? void 0 : data2.data) === null || _d === void 0 ? void 0 : _d.items[0]) === null || _e === void 0 ? void 0 : _e.fullSlug;
|
||||
if (!slug || (meta === null || meta === void 0 ? void 0 : meta.type) === "series") {
|
||||
return {
|
||||
title: "",
|
||||
synopsis: "",
|
||||
image: "",
|
||||
imdbId: ((_f = data === null || data === void 0 ? void 0 : data.meta) === null || _f === void 0 ? void 0 : _f.imdb_id) || "",
|
||||
type: (meta === null || meta === void 0 ? void 0 : meta.type) || "movie",
|
||||
linkList: [],
|
||||
};
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
return {
|
||||
title: "",
|
||||
synopsis: "",
|
||||
image: "",
|
||||
imdbId: (meta === null || meta === void 0 ? void 0 : meta.imdbId) || "",
|
||||
type: (meta === null || meta === void 0 ? void 0 : meta.type) || "movie",
|
||||
linkList: [],
|
||||
};
|
||||
}
|
||||
const links = [];
|
||||
let directLinks = [];
|
||||
let season = new Map();
|
||||
if (meta.type === "series") {
|
||||
(_h = (_g = data === null || data === void 0 ? void 0 : data.meta) === null || _g === void 0 ? void 0 : _g.videos) === null || _h === void 0 ? void 0 : _h.map((video) => {
|
||||
if ((video === null || video === void 0 ? void 0 : video.season) <= 0)
|
||||
return;
|
||||
if (!season.has(video === null || video === void 0 ? void 0 : video.season)) {
|
||||
season.set(video === null || video === void 0 ? void 0 : video.season, []);
|
||||
}
|
||||
season.get(video === null || video === void 0 ? void 0 : video.season).push({
|
||||
title: "Episode " + (video === null || video === void 0 ? void 0 : video.episode),
|
||||
link: "",
|
||||
});
|
||||
});
|
||||
for (const [seasonNum, episodes] of season.entries()) {
|
||||
links.push({
|
||||
title: "Season " + seasonNum,
|
||||
directLinks: episodes,
|
||||
});
|
||||
}
|
||||
}
|
||||
else {
|
||||
directLinks.push({ title: "Movie", link: link });
|
||||
links.push({ title: "Movie", directLinks: directLinks });
|
||||
}
|
||||
return Object.assign(Object.assign({}, meta), { linkList: links });
|
||||
}
|
||||
catch (err) {
|
||||
return {
|
||||
title: "",
|
||||
synopsis: "",
|
||||
image: "",
|
||||
imdbId: "",
|
||||
type: "movie",
|
||||
linkList: [],
|
||||
};
|
||||
}
|
||||
});
|
||||
};
|
||||
exports.getMeta = getMeta;
|
||||
"use strict";var __awaiter=this&&this.__awaiter||function(i,e,t,n){return new(t||(t=Promise))(function(o,l){function s(i){try{a(n.next(i))}catch(i){l(i)}}function d(i){try{a(n.throw(i))}catch(i){l(i)}}function a(i){var e;i.done?o(i.value):(e=i.value,e instanceof t?e:new t(function(i){i(e)})).then(s,d)}a((n=n.apply(i,e||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0}),exports.getMeta=void 0;const getMeta=function(i){return __awaiter(this,arguments,void 0,function*({link:i,providerContext:e}){var t,n,o,l,s,d,a;try{const{getBaseUrl:u,axios:v}=e,r=(yield v.get(i)).data,c={title:"",synopsis:"",image:"",imdbId:(null===(t=null==r?void 0:r.meta)||void 0===t?void 0:t.imdb_id)||"",type:(null===(n=null==r?void 0:r.meta)||void 0===n?void 0:n.type)||"movie"},p=yield u("ridomovies");let m="";try{const i=(yield v.get(p+"/core/api/search?q="+c.imdbId)).data;if(m=null===(l=null===(o=null==i?void 0:i.data)||void 0===o?void 0:o.items[0])||void 0===l?void 0:l.fullSlug,!m||"series"===(null==c?void 0:c.type))return{title:"",synopsis:"",image:"",imdbId:(null===(s=null==r?void 0:r.meta)||void 0===s?void 0:s.imdb_id)||"",type:(null==c?void 0:c.type)||"movie",linkList:[]}}catch(i){return{title:"",synopsis:"",image:"",imdbId:(null==c?void 0:c.imdbId)||"",type:(null==c?void 0:c.type)||"movie",linkList:[]}}const y=[];let f=[],g=new Map;if("series"===c.type){null===(a=null===(d=null==r?void 0:r.meta)||void 0===d?void 0:d.videos)||void 0===a||a.map(i=>{(null==i?void 0:i.season)<=0||(g.has(null==i?void 0:i.season)||g.set(null==i?void 0:i.season,[]),g.get(null==i?void 0:i.season).push({title:"Episode "+(null==i?void 0:i.episode),link:""}))});for(const[i,e]of g.entries())y.push({title:"Season "+i,directLinks:e})}else f.push({title:"Movie",link:i}),y.push({title:"Movie",directLinks:f});return Object.assign(Object.assign({},c),{linkList:y})}catch(i){return{title:"",synopsis:"",image:"",imdbId:"",type:"movie",linkList:[]}}})};exports.getMeta=getMeta;
|
||||
Reference in New Issue
Block a user