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:
43
dist/vadapav/episodes.js
vendored
43
dist/vadapav/episodes.js
vendored
@@ -1,42 +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.getEpisodes = void 0;
|
||||
const getEpisodes = function (_a) {
|
||||
return __awaiter(this, arguments, void 0, function* ({ url, providerContext, }) {
|
||||
const { axios, cheerio } = providerContext;
|
||||
try {
|
||||
const baseUrl = url === null || url === void 0 ? void 0 : url.split("/").slice(0, 3).join("/");
|
||||
const res = yield axios.get(url);
|
||||
const html = res.data;
|
||||
let $ = cheerio.load(html);
|
||||
const episodeLinks = [];
|
||||
$('.file-entry:not(:contains("Parent Directory"))').map((i, element) => {
|
||||
var _a, _b, _c, _d, _e, _f;
|
||||
const link = $(element).attr("href");
|
||||
if (link &&
|
||||
(((_a = $(element).text()) === null || _a === void 0 ? void 0 : _a.includes(".mp4")) ||
|
||||
((_b = $(element).text()) === null || _b === void 0 ? void 0 : _b.includes(".mkv")))) {
|
||||
episodeLinks.push({
|
||||
title: ((_e = (_d = (_c = $(element).text()) === null || _c === void 0 ? void 0 : _c.match(/E\d+/)) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.replace("E", "Episode ")) ||
|
||||
i + 1 + ". " + ((_f = $(element).text()) === null || _f === void 0 ? void 0 : _f.replace(".mkv", "")),
|
||||
link: baseUrl + link,
|
||||
});
|
||||
}
|
||||
});
|
||||
return episodeLinks;
|
||||
}
|
||||
catch (err) {
|
||||
return [];
|
||||
}
|
||||
});
|
||||
};
|
||||
exports.getEpisodes = getEpisodes;
|
||||
"use strict";var __awaiter=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))(function(o,r){function l(t){try{c(n.next(t))}catch(t){r(t)}}function s(t){try{c(n.throw(t))}catch(t){r(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(l,s)}c((n=n.apply(t,e||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0}),exports.getEpisodes=void 0;const getEpisodes=function(t){return __awaiter(this,arguments,void 0,function*({url:t,providerContext:e}){const{axios:i,cheerio:n}=e;try{const e=null==t?void 0:t.split("/").slice(0,3).join("/"),o=(yield i.get(t)).data;let r=n.load(o);const l=[];return r('.file-entry:not(:contains("Parent Directory"))').map((t,i)=>{var n,o,s,c,d,a;const u=r(i).attr("href");u&&((null===(n=r(i).text())||void 0===n?void 0:n.includes(".mp4"))||(null===(o=r(i).text())||void 0===o?void 0:o.includes(".mkv")))&&l.push({title:(null===(d=null===(c=null===(s=r(i).text())||void 0===s?void 0:s.match(/E\d+/))||void 0===c?void 0:c[0])||void 0===d?void 0:d.replace("E","Episode "))||t+1+". "+(null===(a=r(i).text())||void 0===a?void 0:a.replace(".mkv","")),link:e+u})}),l}catch(t){return[]}})};exports.getEpisodes=getEpisodes;
|
||||
Reference in New Issue
Block a user