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:
58
dist/moviezwap/posts.js
vendored
58
dist/moviezwap/posts.js
vendored
@@ -1,57 +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.getSearchPosts = exports.getPosts = void 0;
|
||||
const getPosts = function (_a) {
|
||||
return __awaiter(this, arguments, void 0, function* ({ filter, page, signal, providerContext, }) {
|
||||
const { getBaseUrl, cheerio } = providerContext;
|
||||
const baseUrl = yield getBaseUrl("moviezwap");
|
||||
const url = `${baseUrl}${filter}`;
|
||||
return posts({ url, signal, cheerio });
|
||||
});
|
||||
};
|
||||
exports.getPosts = getPosts;
|
||||
const getSearchPosts = function (_a) {
|
||||
return __awaiter(this, arguments, void 0, function* ({ searchQuery, page, signal, providerContext, }) {
|
||||
const { getBaseUrl, cheerio } = providerContext;
|
||||
const baseUrl = yield getBaseUrl("moviezwap");
|
||||
const url = `${baseUrl}/search.php?q=${encodeURIComponent(searchQuery)}`;
|
||||
return posts({ url, signal, cheerio });
|
||||
});
|
||||
};
|
||||
exports.getSearchPosts = getSearchPosts;
|
||||
function posts(_a) {
|
||||
return __awaiter(this, arguments, void 0, function* ({ url, signal, cheerio, }) {
|
||||
try {
|
||||
const res = yield fetch(url, { signal });
|
||||
const data = yield res.text();
|
||||
const $ = cheerio.load(data);
|
||||
const catalog = [];
|
||||
$('a[href^="/movie/"]').each((i, el) => {
|
||||
const title = $(el).text().trim();
|
||||
const link = $(el).attr("href");
|
||||
const image = "";
|
||||
if (title && link) {
|
||||
catalog.push({
|
||||
title: title,
|
||||
link: link,
|
||||
image: image,
|
||||
});
|
||||
}
|
||||
});
|
||||
return catalog;
|
||||
}
|
||||
catch (err) {
|
||||
console.error("moviezwapGetPosts error ", err);
|
||||
return [];
|
||||
}
|
||||
});
|
||||
}
|
||||
"use strict";var __awaiter=this&&this.__awaiter||function(t,e,r,o){return new(r||(r=Promise))(function(n,i){function s(t){try{c(o.next(t))}catch(t){i(t)}}function a(t){try{c(o.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r(function(t){t(e)})).then(s,a)}c((o=o.apply(t,e||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0}),exports.getSearchPosts=exports.getPosts=void 0;const getPosts=function(t){return __awaiter(this,arguments,void 0,function*({filter:t,page:e,signal:r,providerContext:o}){const{getBaseUrl:n,cheerio:i}=o;return posts({url:`${yield n("moviezwap")}${t}`,signal:r,cheerio:i})})};exports.getPosts=getPosts;const getSearchPosts=function(t){return __awaiter(this,arguments,void 0,function*({searchQuery:t,page:e,signal:r,providerContext:o}){const{getBaseUrl:n,cheerio:i}=o;return posts({url:`${yield n("moviezwap")}/search.php?q=${encodeURIComponent(t)}`,signal:r,cheerio:i})})};function posts(t){return __awaiter(this,arguments,void 0,function*({url:t,signal:e,cheerio:r}){try{const o=yield fetch(t,{signal:e}),n=yield o.text(),i=r.load(n),s=[];return i('a[href^="/movie/"]').each((t,e)=>{const r=i(e).text().trim(),o=i(e).attr("href");r&&o&&s.push({title:r,link:o,image:""})}),s}catch(t){return[]}})}exports.getSearchPosts=getSearchPosts;
|
||||
Reference in New Issue
Block a user