mirror of
https://github.com/vega-org/vega-providers.git
synced 2026-04-17 15:41:45 +00:00
Add new providers for kmMovies, movies4u,katmoviefix, and zeefliz
Co-authored-by: DHR-Store <boss@dhrgroup.ai>
This commit is contained in:
10
providers/movies4u/catalog.ts
Normal file
10
providers/movies4u/catalog.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
export const catalog = [
|
||||
{
|
||||
title: "Trending",
|
||||
filter: "",
|
||||
},
|
||||
{
|
||||
title: "Anime",
|
||||
filter: "/category/anime/",
|
||||
},
|
||||
];
|
||||
69
providers/movies4u/episodes.ts
Normal file
69
providers/movies4u/episodes.ts
Normal file
@@ -0,0 +1,69 @@
|
||||
import { EpisodeLink, ProviderContext } from "../types";
|
||||
|
||||
// यहाँ `getEpisodes` फ़ंक्शन मान रहा है कि यह उस पेज को स्क्रैप कर रहा है
|
||||
// जो 'Download Links' बटन से प्राप्त हुआ है (जैसे m4ulinks.com/number/42882)
|
||||
|
||||
export const getEpisodes = async function ({
|
||||
url,
|
||||
providerContext,
|
||||
}: {
|
||||
url: string;
|
||||
providerContext: ProviderContext;
|
||||
}): Promise<EpisodeLink[]> {
|
||||
const { axios, cheerio, commonHeaders: headers } = providerContext;
|
||||
console.log("getEpisodeLinks", url);
|
||||
try {
|
||||
// Note: Cookies को URL के आधार पर अपडेट करने की आवश्यकता हो सकती है
|
||||
const res = await axios.get(url, {
|
||||
headers: {
|
||||
...headers,
|
||||
// Cloudflare/Bot protection के लिए Hardcoded cookie यहाँ आवश्यक हो सकता है
|
||||
cookie:
|
||||
"ext_name=ojplmecpdpgccookcobabopnaifgidhf; cf_clearance=Zl2yiOCN3pzGUd0Bgs.VyBXniJooDbG2Tk1g7DEoRnw-1756381111-1.2.1.1-RVPZoWGCAygGNAHavrVR0YaqASWZlJyYff8A.oQfPB5qbcPrAVud42BzsSwcDgiKAP0gw5D92V3o8XWwLwDRNhyg3DuL1P8wh2K4BCVKxWvcy.iCCxczKtJ8QSUAsAQqsIzRWXk29N6X.kjxuOTYlfB2jrlq12TRDld_zTbsskNcTxaA.XQekUcpGLseYqELuvlNOQU568NZD6LiLn3ICyFThMFAx6mIcgXkxVAvnxU; xla=s4t",
|
||||
},
|
||||
});
|
||||
const $ = cheerio.load(res.data);
|
||||
const container = $(".entry-content,.entry-inner, .download-links-div");
|
||||
|
||||
// .unili-content,.code-block-1 जैसे अवांछित तत्वों को हटा दें
|
||||
$(".unili-content,.code-block-1").remove();
|
||||
|
||||
const episodes: EpisodeLink[] = [];
|
||||
|
||||
// HubCloud Links को लक्षित करने के लिए:
|
||||
// 1. Episode Title (h5) से शुरू करें
|
||||
// 2. उसके बाद के downloads-btns-div में HubCloud बटन खोजें
|
||||
|
||||
container.find("h5").each((index, element) => {
|
||||
const el = $(element);
|
||||
const title = el.text().trim(); // e.g., "-:Episodes: 1:- (Grand Premiere)"
|
||||
|
||||
// HubCloud लिंक को विशिष्ट स्टाइल और टेक्स्ट से खोजें
|
||||
// बटन सेलेक्टर: style="background: linear-gradient(135deg,#e629d0,#007bff);color: white;"
|
||||
const hubCloudLink = el
|
||||
.next(".downloads-btns-div")
|
||||
.find(
|
||||
'a[style*="background: linear-gradient(135deg,#e629d0,#007bff);"]'
|
||||
)
|
||||
.attr("href");
|
||||
|
||||
if (title && hubCloudLink) {
|
||||
// टाइटल को साफ़ करें (e.g., सिर्फ़ Episode 1: Grand Premiere रखें)
|
||||
const cleanedTitle = title.replace(/[-:]/g, "").trim();
|
||||
|
||||
episodes.push({
|
||||
title: cleanedTitle,
|
||||
link: hubCloudLink,
|
||||
// यदि यह HubCloud/Streaming लिंक है, तो आप 'type' को यहाँ 'stream' भी सेट कर सकते हैं
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// console.log(episodes);
|
||||
return episodes;
|
||||
} catch (err) {
|
||||
console.log("getEpisodeLinks error: ");
|
||||
// console.error(err);
|
||||
return [];
|
||||
}
|
||||
};
|
||||
167
providers/movies4u/meta.ts
Normal file
167
providers/movies4u/meta.ts
Normal file
@@ -0,0 +1,167 @@
|
||||
import { Info, Link, ProviderContext } from "../types";
|
||||
|
||||
// Headers
|
||||
const headers = {
|
||||
Accept:
|
||||
"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
|
||||
"Cache-Control": "no-store",
|
||||
"Accept-Language": "en-US,en;q=0.9",
|
||||
DNT: "1",
|
||||
"sec-ch-ua":
|
||||
'"Not_A Brand";v="8", "Chromium";v="120", "Microsoft Edge";v="120"',
|
||||
"sec-ch-ua-mobile": "?0",
|
||||
"sec-ch-ua-platform": '"Windows"',
|
||||
"Sec-Fetch-Dest": "document",
|
||||
"Sec-Fetch-Mode": "navigate",
|
||||
"Sec-Fetch-Site": "none",
|
||||
"Sec-Fetch-User": "?1",
|
||||
Cookie:
|
||||
"xla=s4t; _ga=GA1.1.1081149560.1756378968; _ga_BLZGKYN5PF=GS2.1.s1756378968$o1$g1$t1756378984$j44$l0$h0",
|
||||
"Upgrade-Insecure-Requests": "1",
|
||||
"User-Agent":
|
||||
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 Edg/131.0.0.0",
|
||||
};
|
||||
|
||||
export const getMeta = async function ({
|
||||
link,
|
||||
providerContext,
|
||||
}: {
|
||||
link: string;
|
||||
providerContext: ProviderContext;
|
||||
}): Promise<Info> {
|
||||
const { axios, cheerio } = providerContext;
|
||||
const url = link;
|
||||
const baseUrl = url.split("/").slice(0, 3).join("/");
|
||||
|
||||
const emptyResult: Info = {
|
||||
title: "",
|
||||
synopsis: "",
|
||||
image: "",
|
||||
imdbId: "",
|
||||
type: "movie",
|
||||
linkList: [],
|
||||
};
|
||||
|
||||
try {
|
||||
const response = await axios.get(url, {
|
||||
headers: { ...headers, Referer: baseUrl },
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
const infoContainer = $(".entry-content, .post-inner").length
|
||||
? $(".entry-content, .post-inner")
|
||||
: $("body");
|
||||
|
||||
const result: Info = {
|
||||
title: "",
|
||||
synopsis: "",
|
||||
image: "",
|
||||
imdbId: "",
|
||||
type: "movie",
|
||||
linkList: [],
|
||||
};
|
||||
|
||||
// --- Type determination ---
|
||||
const infoParagraph = $("h2.movie-title").next("p").text();
|
||||
if (
|
||||
infoParagraph.includes("Season:") ||
|
||||
infoParagraph.includes("Episode:") ||
|
||||
infoParagraph.includes("SHOW Name:")
|
||||
) {
|
||||
result.type = "series";
|
||||
} else {
|
||||
result.type = "movie";
|
||||
}
|
||||
|
||||
// --- Title ---
|
||||
const rawTitle = $("h1").text().trim() || $("h2").text().trim();
|
||||
result.title = rawTitle.split(/\[| \d+p| x\d+/)[0].trim();
|
||||
const showNameMatch =
|
||||
infoParagraph.match(/SHOW Name: (.+)/) ||
|
||||
infoParagraph.match(/Name: (.+)/);
|
||||
if (showNameMatch && showNameMatch[1]) {
|
||||
result.title = result.title || showNameMatch[1].trim();
|
||||
}
|
||||
|
||||
// --- IMDb ID ---
|
||||
const imdbMatch =
|
||||
infoContainer.html()?.match(/tt\d+/) ||
|
||||
$("a[href*='imdb.com/title/']").attr("href")?.match(/tt\d+/);
|
||||
result.imdbId = imdbMatch ? imdbMatch[0] : "";
|
||||
|
||||
// --- Image ---
|
||||
let image =
|
||||
infoContainer.find(".post-thumbnail img").attr("src") ||
|
||||
infoContainer.find("img[src]").first().attr("src") ||
|
||||
"";
|
||||
if (image.startsWith("//")) image = "https:" + image;
|
||||
else if (image.startsWith("/")) image = baseUrl + image;
|
||||
if (image.includes("no-thumbnail") || image.includes("placeholder"))
|
||||
image = "";
|
||||
result.image = image;
|
||||
|
||||
// --- Synopsis ---
|
||||
result.synopsis =
|
||||
$("h3.movie-title")
|
||||
.filter((i, el) => $(el).text().includes("Storyline"))
|
||||
.next("p")
|
||||
.text()
|
||||
.trim() ||
|
||||
infoContainer.find("p").first().text().trim() ||
|
||||
"";
|
||||
|
||||
// --- LinkList extraction ---
|
||||
const links: Link[] = [];
|
||||
const h4Elements = $(".download-links-div").find("> h4");
|
||||
|
||||
h4Elements.each((index, element) => {
|
||||
const el = $(element);
|
||||
const titleText = el.text().trim();
|
||||
const qualityMatch = titleText.match(/\d+p\b/)?.[0];
|
||||
const fullTitle = titleText;
|
||||
|
||||
const downloadButtons = el.next(".downloads-btns-div").find("a");
|
||||
|
||||
if (downloadButtons.length && qualityMatch) {
|
||||
if (result.type === "series") {
|
||||
links.push({
|
||||
title: fullTitle,
|
||||
quality: qualityMatch,
|
||||
episodesLink: downloadButtons.attr("href") || "",
|
||||
directLinks: [],
|
||||
});
|
||||
} else {
|
||||
// Movie: collect all direct download buttons
|
||||
const directLinks: Link["directLinks"] = [];
|
||||
|
||||
downloadButtons.each((i, btn) => {
|
||||
const btnEl = $(btn);
|
||||
const link = btnEl.attr("href");
|
||||
if (link) {
|
||||
directLinks.push({
|
||||
title: btnEl.text().trim() || "Download",
|
||||
link,
|
||||
type: "movie", // literal type
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
if (directLinks.length) {
|
||||
links.push({
|
||||
title: fullTitle,
|
||||
quality: qualityMatch,
|
||||
episodesLink: "",
|
||||
directLinks,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
result.linkList = links;
|
||||
return result;
|
||||
} catch (err) {
|
||||
console.log("getMeta error:", err);
|
||||
return emptyResult;
|
||||
}
|
||||
};
|
||||
142
providers/movies4u/posts.ts
Normal file
142
providers/movies4u/posts.ts
Normal file
@@ -0,0 +1,142 @@
|
||||
import { Post, ProviderContext } from "../types";
|
||||
|
||||
const defaultHeaders = {
|
||||
Referer: "https://www.google.com",
|
||||
"User-Agent":
|
||||
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 " +
|
||||
"(KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36",
|
||||
Accept: "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
|
||||
"Accept-Language": "en-US,en;q=0.9",
|
||||
Pragma: "no-cache",
|
||||
"Cache-Control": "no-cache",
|
||||
};
|
||||
|
||||
// --- Normal catalog posts ---
|
||||
export async function getPosts({
|
||||
filter,
|
||||
page = 1,
|
||||
signal,
|
||||
providerContext,
|
||||
}: {
|
||||
filter?: string;
|
||||
page?: number;
|
||||
signal?: AbortSignal;
|
||||
providerContext: ProviderContext;
|
||||
}): Promise<Post[]> {
|
||||
return fetchPosts({ filter, page, query: "", signal, providerContext });
|
||||
}
|
||||
|
||||
// --- Search posts ---
|
||||
export async function getSearchPosts({
|
||||
searchQuery,
|
||||
page = 1,
|
||||
signal,
|
||||
providerContext,
|
||||
}: {
|
||||
searchQuery: string;
|
||||
page?: number;
|
||||
signal?: AbortSignal;
|
||||
providerContext: ProviderContext;
|
||||
}): Promise<Post[]> {
|
||||
return fetchPosts({
|
||||
filter: "",
|
||||
page,
|
||||
query: searchQuery,
|
||||
signal,
|
||||
providerContext,
|
||||
});
|
||||
}
|
||||
|
||||
// --- Core function ---
|
||||
async function fetchPosts({
|
||||
filter,
|
||||
query,
|
||||
page = 1,
|
||||
signal,
|
||||
providerContext,
|
||||
}: {
|
||||
filter?: string;
|
||||
query?: string;
|
||||
page?: number;
|
||||
signal?: AbortSignal;
|
||||
providerContext: ProviderContext;
|
||||
}): Promise<Post[]> {
|
||||
try {
|
||||
const baseUrl = await providerContext.getBaseUrl("movies4u");
|
||||
let url: string;
|
||||
|
||||
// --- Build URL for category filter or search query
|
||||
if (query && query.trim()) {
|
||||
url = `${baseUrl}/?s=${encodeURIComponent(query)}${
|
||||
page > 1 ? `&paged=${page}` : ""
|
||||
}`;
|
||||
} else if (filter) {
|
||||
url = filter.startsWith("/")
|
||||
? `${baseUrl}${filter.replace(/\/$/, "")}${
|
||||
page > 1 ? `/page/${page}` : ""
|
||||
}`
|
||||
: `${baseUrl}/${filter}${page > 1 ? `/page/${page}` : ""}`;
|
||||
} else {
|
||||
url = `${baseUrl}${page > 1 ? `/page/${page}` : ""}`;
|
||||
}
|
||||
|
||||
const { axios, cheerio } = providerContext;
|
||||
const res = await axios.get(url, { headers: defaultHeaders, signal });
|
||||
const $ = cheerio.load(res.data || "");
|
||||
|
||||
const resolveUrl = (href: string) =>
|
||||
href?.startsWith("http") ? href : new URL(href, url).href;
|
||||
|
||||
const seen = new Set<string>();
|
||||
const catalog: Post[] = [];
|
||||
|
||||
// --- HDMovie2 selectors
|
||||
const POST_SELECTORS = [
|
||||
".pstr_box",
|
||||
"article",
|
||||
".result-item",
|
||||
".post",
|
||||
".item",
|
||||
".thumbnail",
|
||||
".latest-movies",
|
||||
".movie-item",
|
||||
].join(",");
|
||||
|
||||
$(POST_SELECTORS).each((_, el) => {
|
||||
const card = $(el);
|
||||
let link = card.find("a[href]").first().attr("href") || "";
|
||||
if (!link) return;
|
||||
link = resolveUrl(link);
|
||||
if (seen.has(link)) return;
|
||||
|
||||
let title =
|
||||
card.find("h2").first().text().trim() ||
|
||||
card.find("a[title]").first().attr("title")?.trim() ||
|
||||
card.text().trim();
|
||||
title = title
|
||||
.replace(/\[.*?\]/g, "")
|
||||
.replace(/\(.+?\)/g, "")
|
||||
.replace(/\s{2,}/g, " ")
|
||||
.trim();
|
||||
if (!title) return;
|
||||
|
||||
const img =
|
||||
card.find("img").first().attr("src") ||
|
||||
card.find("img").first().attr("data-src") ||
|
||||
card.find("img").first().attr("data-original") ||
|
||||
"";
|
||||
const image = img ? resolveUrl(img) : "";
|
||||
|
||||
seen.add(link);
|
||||
catalog.push({ title, link, image });
|
||||
});
|
||||
|
||||
return catalog.slice(0, 100);
|
||||
} catch (err) {
|
||||
console.error(
|
||||
"HDMovie2 fetchPosts error:",
|
||||
err instanceof Error ? err.message : String(err)
|
||||
);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
117
providers/movies4u/stream.ts
Normal file
117
providers/movies4u/stream.ts
Normal file
@@ -0,0 +1,117 @@
|
||||
import { ProviderContext, Stream } from "../types";
|
||||
|
||||
const headers = {
|
||||
Accept:
|
||||
"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
|
||||
"Cache-Control": "no-store",
|
||||
"Accept-Language": "en-US,en;q=0.9",
|
||||
DNT: "1",
|
||||
"sec-ch-ua":
|
||||
'"Not_A Brand";v="8", "Chromium";v="120", "Microsoft Edge";v="120"',
|
||||
"sec-ch-ua-mobile": "?0",
|
||||
"sec-ch-ua-platform": '"Windows"',
|
||||
"Sec-Fetch-Dest": "document",
|
||||
"Sec-Fetch-Mode": "navigate",
|
||||
"Sec-Fetch-Site": "none",
|
||||
"Sec-Fetch-User": "?1",
|
||||
Cookie:
|
||||
"xla=s4t; _ga=GA1.1.1081149560.1756378968; _ga_BLZGKYN5PF=GS2.1.s1756378968$o1$g1$t1756378984$j44$l0$h0",
|
||||
"Upgrade-Insecure-Requests": "1",
|
||||
"User-Agent":
|
||||
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 Edg/131.0.0.0",
|
||||
};
|
||||
|
||||
export async function getStream({
|
||||
link,
|
||||
type,
|
||||
signal,
|
||||
providerContext,
|
||||
}: {
|
||||
link: string;
|
||||
type: string;
|
||||
signal: AbortSignal;
|
||||
providerContext: ProviderContext;
|
||||
}) {
|
||||
const { axios, cheerio, extractors } = providerContext;
|
||||
const { hubcloudExtracter } = extractors;
|
||||
try {
|
||||
const streamLinks: Stream[] = [];
|
||||
console.log("dotlink", link);
|
||||
if (type === "movie") {
|
||||
// vlink
|
||||
const dotlinkRes = await axios(`${link}`, { headers });
|
||||
const dotlinkText = dotlinkRes.data;
|
||||
// console.log('dotlinkText', dotlinkText);
|
||||
const vlink = dotlinkText.match(/<a\s+href="([^"]*cloud\.[^"]*)"/i) || [];
|
||||
// console.log('vLink', vlink[1]);
|
||||
link = vlink[1];
|
||||
|
||||
// filepress link
|
||||
try {
|
||||
const $ = cheerio.load(dotlinkText);
|
||||
const filepressLink = $(
|
||||
'.btn.btn-sm.btn-outline[style="background:linear-gradient(135deg,rgb(252,185,0) 0%,rgb(0,0,0)); color: #fdf8f2;"]'
|
||||
)
|
||||
.parent()
|
||||
.attr("href");
|
||||
// console.log('filepressLink', filepressLink);
|
||||
const filepressID = filepressLink?.split("/").pop();
|
||||
const filepressBaseUrl = filepressLink
|
||||
?.split("/")
|
||||
.slice(0, -2)
|
||||
.join("/");
|
||||
// console.log('filepressID', filepressID);
|
||||
// console.log('filepressBaseUrl', filepressBaseUrl);
|
||||
const filepressTokenRes = await axios.post(
|
||||
filepressBaseUrl + "/api/file/downlaod/",
|
||||
{
|
||||
id: filepressID,
|
||||
method: "indexDownlaod",
|
||||
captchaValue: null,
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Referer: filepressBaseUrl,
|
||||
},
|
||||
}
|
||||
);
|
||||
// console.log('filepressTokenRes', filepressTokenRes.data);
|
||||
if (filepressTokenRes.data?.status) {
|
||||
const filepressToken = filepressTokenRes.data?.data;
|
||||
const filepressStreamLink = await axios.post(
|
||||
filepressBaseUrl + "/api/file/downlaod2/",
|
||||
{
|
||||
id: filepressToken,
|
||||
method: "indexDownlaod",
|
||||
captchaValue: null,
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Referer: filepressBaseUrl,
|
||||
},
|
||||
}
|
||||
);
|
||||
// console.log('filepressStreamLink', filepressStreamLink.data);
|
||||
streamLinks.push({
|
||||
server: "filepress",
|
||||
link: filepressStreamLink.data?.data?.[0],
|
||||
type: "mkv",
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.log("filepress error: ");
|
||||
// console.error(error);
|
||||
}
|
||||
}
|
||||
|
||||
return await hubcloudExtracter(link, signal);
|
||||
} catch (error: any) {
|
||||
console.log("getStream error: ", error);
|
||||
if (error.message.includes("Aborted")) {
|
||||
} else {
|
||||
}
|
||||
return [];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user