mirror of
https://github.com/vega-org/vega-providers.git
synced 2026-04-17 23:51:44 +00:00
unminify
This commit is contained in:
42
dist/tokyoInsider/stream.js
vendored
42
dist/tokyoInsider/stream.js
vendored
@@ -1 +1,41 @@
|
||||
"use strict";var __awaiter=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{s(r.next(t))}catch(t){o(t)}}function c(t){try{s(r.throw(t))}catch(t){o(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,c)}s((r=r.apply(t,e||[])).next())})};Object.defineProperty(exports,"__esModule",{value:!0}),exports.getStream=void 0;const getStream=function(t){return __awaiter(this,arguments,void 0,function*({link:t,providerContext:e}){try{const{cheerio:n}=e,r=t,i=yield fetch(r),o=yield i.text(),a=n.load(o),c=[];return a(".c_h1,.c_h2").map((t,e)=>{a(e).find("span").remove();const n=a(e).find("a").text()||"",r=a(e).find("a").attr("href")||"";n&&r.includes("media")&&c.push({server:n,link:r,type:r.split(".").pop()||"mkv"})}),c}catch(t){return[]}})};exports.getStream=getStream;
|
||||
"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.getStream = void 0;
|
||||
const getStream = function (_a) {
|
||||
return __awaiter(this, arguments, void 0, function* ({ link, providerContext, }) {
|
||||
try {
|
||||
const { cheerio } = providerContext;
|
||||
const url = link;
|
||||
const res = yield fetch(url);
|
||||
const data = yield res.text();
|
||||
const $ = cheerio.load(data);
|
||||
const streamLinks = [];
|
||||
$(".c_h1,.c_h2").map((i, element) => {
|
||||
$(element).find("span").remove();
|
||||
const title = $(element).find("a").text() || "";
|
||||
const link = $(element).find("a").attr("href") || "";
|
||||
if (title && link.includes("media")) {
|
||||
streamLinks.push({
|
||||
server: title,
|
||||
link,
|
||||
type: link.split(".").pop() || "mkv",
|
||||
});
|
||||
}
|
||||
});
|
||||
return streamLinks;
|
||||
}
|
||||
catch (err) {
|
||||
return [];
|
||||
}
|
||||
});
|
||||
};
|
||||
exports.getStream = getStream;
|
||||
|
||||
Reference in New Issue
Block a user