This commit is contained in:
himanshu8443
2025-06-18 11:42:29 +05:30
parent 490a4bd71d
commit 9621597865
100 changed files with 6898 additions and 5740 deletions

69
dist/vega/episodes.js vendored
View File

@@ -1,34 +1,45 @@
"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 = async function ({ url, providerContext, }) {
const { axios, cheerio, commonHeaders: headers } = providerContext;
console.log("getEpisodeLinks", url);
try {
const res = await axios.get(url, { headers });
const $ = cheerio.load(res.data);
const container = $(".entry-content,.entry-inner");
$(".unili-content,.code-block-1").remove();
const episodes = [];
container.find("h4").each((index, element) => {
const el = $(element);
const title = el.text().replaceAll("-", "").replaceAll(":", "");
const link = el
.next("p")
.find('.btn-outline[style="background:linear-gradient(135deg,#ed0b0b,#f2d152); color: white;"]')
.parent()
.attr("href");
if (title && link) {
episodes.push({ title, link });
}
});
// console.log(episodes);
return episodes;
}
catch (err) {
console.log("getEpisodeLinks error: ");
// console.error(err);
return [];
}
const getEpisodes = function (_a) {
return __awaiter(this, arguments, void 0, function* ({ url, providerContext, }) {
const { axios, cheerio, commonHeaders: headers } = providerContext;
console.log("getEpisodeLinks", url);
try {
const res = yield axios.get(url, { headers });
const $ = cheerio.load(res.data);
const container = $(".entry-content,.entry-inner");
$(".unili-content,.code-block-1").remove();
const episodes = [];
container.find("h4").each((index, element) => {
const el = $(element);
const title = el.text().replaceAll("-", "").replaceAll(":", "");
const link = el
.next("p")
.find('.btn-outline[style="background:linear-gradient(135deg,#ed0b0b,#f2d152); color: white;"]')
.parent()
.attr("href");
if (title && link) {
episodes.push({ title, link });
}
});
// console.log(episodes);
return episodes;
}
catch (err) {
console.log("getEpisodeLinks error: ");
// console.error(err);
return [];
}
});
};
exports.getEpisodes = getEpisodes;