mirror of
https://github.com/vega-org/vega-providers.git
synced 2026-04-18 08:01:43 +00:00
unminify
This commit is contained in:
86
dist/drive/meta.js
vendored
86
dist/drive/meta.js
vendored
@@ -1 +1,85 @@
|
||||
"use strict";var __awaiter=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))(function(a,o){function r(t){try{c(i.next(t))}catch(t){o(t)}}function s(t){try{c(i.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?a(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(r,s)}c((i=i.apply(t,e||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0}),exports.getMeta=void 0;const getMeta=function(t){return __awaiter(this,arguments,void 0,function*({link:t,providerContext:e}){var n;try{const{axios:i,cheerio:a}=e,o=t,r=(yield i.get(o)).data,s=a.load(r),c=s(".left-wrapper").text().toLocaleLowerCase().includes("movie name")?"movie":"series",p=(null===(n=s('a:contains("IMDb")').attr("href"))||void 0===n?void 0:n.split("/")[4])||"",l=s(".left-wrapper").find('strong:contains("Name")').next().text()||s(".left-wrapper").find('strong:contains("Name"),h5:contains("Name")').find("span:first").text(),d=s(".left-wrapper").find('h2:contains("Storyline"),h3:contains("Storyline"),h5:contains("Storyline"),h4:contains("Storyline"),h4:contains("STORYLINE")').next().text()||s(".ipc-html-content-inner-div").text()||"",u=s("img.entered.lazyloaded,img.entered,img.litespeed-loaded").attr("src")||s("img.aligncenter").attr("src")||"",v=[];return s('a:contains("1080")a:not(:contains("Zip")),a:contains("720")a:not(:contains("Zip")),a:contains("480")a:not(:contains("Zip")),a:contains("2160")a:not(:contains("Zip")),a:contains("4k")a:not(:contains("Zip"))').map((t,e)=>{var n;const i=s(e).parent("h5").prev().text(),a=s(e).attr("href"),o=(null===(n=i.match(/\b(480p|720p|1080p|2160p)\b/i))||void 0===n?void 0:n[0])||"";a&&i&&v.push({title:i,episodesLink:"series"===c?a:"",directLinks:"movie"===c?[{title:"Movie",link:a,type:"movie"}]:[],quality:o})}),{title:l,synopsis:d,image:u,imdbId:p,type:c,linkList:v}}catch(t){return{title:"",synopsis:"",image:"",imdbId:"",type:"movie",linkList:[]}}})};exports.getMeta=getMeta;
|
||||
"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;
|
||||
try {
|
||||
const { axios, cheerio } = providerContext;
|
||||
const url = link;
|
||||
const res = yield axios.get(url);
|
||||
const data = res.data;
|
||||
const $ = cheerio.load(data);
|
||||
const type = $(".left-wrapper")
|
||||
.text()
|
||||
.toLocaleLowerCase()
|
||||
.includes("movie name")
|
||||
? "movie"
|
||||
: "series";
|
||||
const imdbId = ((_b = $('a:contains("IMDb")').attr("href")) === null || _b === void 0 ? void 0 : _b.split("/")[4]) || "";
|
||||
const title = $(".left-wrapper").find('strong:contains("Name")').next().text() ||
|
||||
$(".left-wrapper")
|
||||
.find('strong:contains("Name"),h5:contains("Name")')
|
||||
.find("span:first")
|
||||
.text();
|
||||
const synopsis = $(".left-wrapper")
|
||||
.find('h2:contains("Storyline"),h3:contains("Storyline"),h5:contains("Storyline"),h4:contains("Storyline"),h4:contains("STORYLINE")')
|
||||
.next()
|
||||
.text() ||
|
||||
$(".ipc-html-content-inner-div").text() ||
|
||||
"";
|
||||
const image = $("img.entered.lazyloaded,img.entered,img.litespeed-loaded").attr("src") ||
|
||||
$("img.aligncenter").attr("src") ||
|
||||
"";
|
||||
// Links
|
||||
const links = [];
|
||||
$('a:contains("1080")a:not(:contains("Zip")),a:contains("720")a:not(:contains("Zip")),a:contains("480")a:not(:contains("Zip")),a:contains("2160")a:not(:contains("Zip")),a:contains("4k")a:not(:contains("Zip"))').map((i, element) => {
|
||||
var _a;
|
||||
const title = $(element).parent("h5").prev().text();
|
||||
const episodesLink = $(element).attr("href");
|
||||
const quality = ((_a = title.match(/\b(480p|720p|1080p|2160p)\b/i)) === null || _a === void 0 ? void 0 : _a[0]) || "";
|
||||
if (episodesLink && title) {
|
||||
links.push({
|
||||
title,
|
||||
episodesLink: type === "series" ? episodesLink : "",
|
||||
directLinks: type === "movie"
|
||||
? [{ title: "Movie", link: episodesLink, type: "movie" }]
|
||||
: [],
|
||||
quality: quality,
|
||||
});
|
||||
}
|
||||
});
|
||||
// console.log('drive meta', title, synopsis, image, imdbId, type, links);
|
||||
console.log("drive meta", links, type);
|
||||
return {
|
||||
title,
|
||||
synopsis,
|
||||
image,
|
||||
imdbId,
|
||||
type,
|
||||
linkList: links,
|
||||
};
|
||||
}
|
||||
catch (err) {
|
||||
console.error(err);
|
||||
return {
|
||||
title: "",
|
||||
synopsis: "",
|
||||
image: "",
|
||||
imdbId: "",
|
||||
type: "movie",
|
||||
linkList: [],
|
||||
};
|
||||
}
|
||||
});
|
||||
};
|
||||
exports.getMeta = getMeta;
|
||||
|
||||
Reference in New Issue
Block a user