Add new providers for kmMovies, movies4u,katmoviefix, and zeefliz

Co-authored-by: DHR-Store <boss@dhrgroup.ai>
This commit is contained in:
himanshu8443
2025-09-29 15:48:13 +05:30
parent 8154ac257f
commit 5704dfe6e2
40 changed files with 1799 additions and 0 deletions

View File

@@ -0,0 +1,64 @@
import { EpisodeLink, ProviderContext } from "../types";
export async function getEpisodeLinks({
url,
providerContext,
}: {
url: string;
providerContext: ProviderContext;
}): Promise<EpisodeLink[]> {
try {
const res = await providerContext.axios.get(url);
const $ = providerContext.cheerio.load(res.data || "");
const episodes: EpisodeLink[] = [];
$("h4.fittexted_for_content_h4").each((_, h4El) => {
const epTitle = $(h4El).text().trim();
if (!epTitle) return;
// Next until next <h4> or <hr> ke andar saare <a> links
$(h4El)
.nextUntil("h4, hr")
.find("a[href]") // sirf <a> tags
.each((_, linkEl) => {
let href = ($(linkEl).attr("href") || "").trim();
if (!href) return;
if (!href.startsWith("http")) href = new URL(href, url).href;
const btnText = $(linkEl).text().trim() || "Watch Episode";
// --- Sirf SkyDrop links include karo
const lowerHref = href.toLowerCase();
if (lowerHref.includes("skydro") || lowerHref.includes("flexplayer.buzz")) {
episodes.push({
title: `${epTitle} - ${btnText}`,
link: href,
});
}
});
});
// --- Sort by episode number extracted from title
episodes.sort((a, b) => {
const numA = parseInt(a.title.match(/\d+/)?.[0] || "0");
const numB = parseInt(b.title.match(/\d+/)?.[0] || "0");
return numA - numB;
});
return episodes;
} catch (err) {
console.error("getEpisodeLinks error:", err);
return [];
}
}
// --- System wrapper
export async function getEpisodes({
url,
providerContext,
}: {
url: string;
providerContext: ProviderContext;
}): Promise<EpisodeLink[]> {
return await getEpisodeLinks({ url, providerContext });
}