mirror of
https://github.com/vega-org/vega-providers.git
synced 2026-04-17 15:41:45 +00:00
minify
This commit is contained in:
103
dist/autoEmbed/posts.js
vendored
103
dist/autoEmbed/posts.js
vendored
@@ -1,102 +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, signal, providerContext, }) {
|
||||
try {
|
||||
const catalog = [];
|
||||
const url = "https://cinemeta-catalogs.strem.io" + filter;
|
||||
console.log("allGetPostUrl", url);
|
||||
const res = yield providerContext.axios.get(url, {
|
||||
headers: providerContext.commonHeaders,
|
||||
signal,
|
||||
});
|
||||
const data = res.data;
|
||||
data === null || data === void 0 ? void 0 : data.metas.map((result) => {
|
||||
const title = result === null || result === void 0 ? void 0 : result.name;
|
||||
const id = (result === null || result === void 0 ? void 0 : result.imdb_id) || (result === null || result === void 0 ? void 0 : result.id);
|
||||
const type = result === null || result === void 0 ? void 0 : result.type;
|
||||
const image = result === null || result === void 0 ? void 0 : result.poster;
|
||||
if (id) {
|
||||
catalog.push({
|
||||
title: title,
|
||||
link: `https://v3-cinemeta.strem.io/meta/${type}/${id}.json`,
|
||||
image: image,
|
||||
});
|
||||
}
|
||||
});
|
||||
console.log("catalog", catalog.length);
|
||||
return catalog;
|
||||
}
|
||||
catch (err) {
|
||||
console.error("AutoEmbed error ", err);
|
||||
return [];
|
||||
}
|
||||
});
|
||||
};
|
||||
exports.getPosts = getPosts;
|
||||
const getSearchPosts = function (_a) {
|
||||
return __awaiter(this, arguments, void 0, function* ({ searchQuery, page,
|
||||
// providerValue,
|
||||
signal, providerContext, }) {
|
||||
try {
|
||||
if (page > 1) {
|
||||
return [];
|
||||
}
|
||||
const catalog = [];
|
||||
const url1 = `https://v3-cinemeta.strem.io/catalog/series/top/search=${encodeURI(searchQuery)}.json`;
|
||||
const url2 = `https://v3-cinemeta.strem.io/catalog/movie/top/search=${encodeURI(searchQuery)}.json`;
|
||||
const res = yield providerContext.axios.get(url1, {
|
||||
headers: providerContext.commonHeaders,
|
||||
signal,
|
||||
});
|
||||
const data = res.data;
|
||||
data === null || data === void 0 ? void 0 : data.metas.map((result) => {
|
||||
const title = result.name || "";
|
||||
const id = (result === null || result === void 0 ? void 0 : result.imdb_id) || (result === null || result === void 0 ? void 0 : result.id);
|
||||
const image = result === null || result === void 0 ? void 0 : result.poster;
|
||||
const type = result === null || result === void 0 ? void 0 : result.type;
|
||||
if (id) {
|
||||
catalog.push({
|
||||
title: title,
|
||||
link: `https://v3-cinemeta.strem.io/meta/${type}/${id}.json`,
|
||||
image: image,
|
||||
});
|
||||
}
|
||||
});
|
||||
const res2 = yield providerContext.axios.get(url2, {
|
||||
headers: providerContext.commonHeaders,
|
||||
signal,
|
||||
});
|
||||
const data2 = res2.data;
|
||||
data2 === null || data2 === void 0 ? void 0 : data2.metas.map((result) => {
|
||||
const title = (result === null || result === void 0 ? void 0 : result.name) || "";
|
||||
const id = (result === null || result === void 0 ? void 0 : result.imdb_id) || (result === null || result === void 0 ? void 0 : result.id);
|
||||
const image = result === null || result === void 0 ? void 0 : result.poster;
|
||||
const type = result === null || result === void 0 ? void 0 : result.type;
|
||||
if (id) {
|
||||
catalog.push({
|
||||
title: title,
|
||||
link: `https://v3-cinemeta.strem.io/meta/${type}/${id}.json`,
|
||||
image: image,
|
||||
});
|
||||
}
|
||||
});
|
||||
return catalog;
|
||||
}
|
||||
catch (err) {
|
||||
console.error("AutoEmbed error ", err);
|
||||
return [];
|
||||
}
|
||||
});
|
||||
};
|
||||
exports.getSearchPosts = getSearchPosts;
|
||||
"use strict";var __awaiter=this&&this.__awaiter||function(t,e,n,o){return new(n||(n=Promise))(function(i,s){function a(t){try{l(o.next(t))}catch(t){s(t)}}function r(t){try{l(o.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,r)}l((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,signal:e,providerContext:n}){try{const o=[],i="https://cinemeta-catalogs.strem.io"+t,s=(yield n.axios.get(i,{headers:n.commonHeaders,signal:e})).data;return null==s||s.metas.map(t=>{const e=null==t?void 0:t.name,n=(null==t?void 0:t.imdb_id)||(null==t?void 0:t.id),i=null==t?void 0:t.type,s=null==t?void 0:t.poster;n&&o.push({title:e,link:`https://v3-cinemeta.strem.io/meta/${i}/${n}.json`,image:s})}),o}catch(t){return[]}})};exports.getPosts=getPosts;const getSearchPosts=function(t){return __awaiter(this,arguments,void 0,function*({searchQuery:t,page:e,signal:n,providerContext:o}){try{if(e>1)return[];const i=[],s=`https://v3-cinemeta.strem.io/catalog/series/top/search=${encodeURI(t)}.json`,a=`https://v3-cinemeta.strem.io/catalog/movie/top/search=${encodeURI(t)}.json`,r=(yield o.axios.get(s,{headers:o.commonHeaders,signal:n})).data;null==r||r.metas.map(t=>{const e=t.name||"",n=(null==t?void 0:t.imdb_id)||(null==t?void 0:t.id),o=null==t?void 0:t.poster,s=null==t?void 0:t.type;n&&i.push({title:e,link:`https://v3-cinemeta.strem.io/meta/${s}/${n}.json`,image:o})});const l=(yield o.axios.get(a,{headers:o.commonHeaders,signal:n})).data;return null==l||l.metas.map(t=>{const e=(null==t?void 0:t.name)||"",n=(null==t?void 0:t.imdb_id)||(null==t?void 0:t.id),o=null==t?void 0:t.poster,s=null==t?void 0:t.type;n&&i.push({title:e,link:`https://v3-cinemeta.strem.io/meta/${s}/${n}.json`,image:o})}),i}catch(t){return[]}})};exports.getSearchPosts=getSearchPosts;
|
||||
Reference in New Issue
Block a user