mirror of
https://github.com/vega-org/vega-providers.git
synced 2026-06-17 20:28:37 +00:00
feat: update Movies4U version to 1.4 and modify catalog titles
fix: handle anti-DDoS checks in meta and posts fetching fix: improve episode extraction logic in episodes fix: enhance stream link extraction in stream Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
+106
-34
@@ -1,6 +1,6 @@
|
||||
import { EpisodeLink, ProviderContext } from "../types";
|
||||
|
||||
// यहाँ `getEpisodes` फ़ंक्शन मान रहा है कि यह उस पेज को स्क्रैप कर रहा है
|
||||
// यहाँ `getEpisodes` फ़ंक्शन मान रहा है कि यह उस पेज को स्क्रैप कर रहा है
|
||||
// जो 'Download Links' बटन से प्राप्त हुआ है (जैसे m4ulinks.com/number/42882)
|
||||
|
||||
export const getEpisodes = async function ({
|
||||
@@ -14,7 +14,7 @@ export const getEpisodes = async function ({
|
||||
console.log("getEpisodeLinks", url);
|
||||
try {
|
||||
// Note: Cookies को URL के आधार पर अपडेट करने की आवश्यकता हो सकती है
|
||||
const res = await axios.get(url, {
|
||||
let res = await axios.get(url, {
|
||||
headers: {
|
||||
...headers,
|
||||
// Cloudflare/Bot protection के लिए Hardcoded cookie यहाँ आवश्यक हो सकता है
|
||||
@@ -22,43 +22,115 @@ export const getEpisodes = async function ({
|
||||
"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 (
|
||||
res.data &&
|
||||
res.data.includes("Please turn JavaScript on and reload the page.")
|
||||
) {
|
||||
const b1Match = res.data.match(/var b1=atob\(['"]([^'"]+)['"]\)/);
|
||||
const a2Match = res.data.match(/_0x2aa8=\[['"]([^'"]+)['"]\]/);
|
||||
const c3Match = res.data.match(/c3=toNumbers\(['"]([^'"]+)['"]\)/);
|
||||
|
||||
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' भी सेट कर सकते हैं
|
||||
if (b1Match && a2Match && c3Match) {
|
||||
const unescapeHexStr = (str: string) =>
|
||||
str.replace(/\\x([0-9A-Fa-f]{2})/g, (_, hex) =>
|
||||
String.fromCharCode(parseInt(hex, 16)),
|
||||
);
|
||||
|
||||
const baseUrl = url.split("/").slice(0, 3).join("/");
|
||||
const minJsRes = await axios.get(`${baseUrl}/min.js`, {
|
||||
headers,
|
||||
});
|
||||
|
||||
const b1Hex = atob(unescapeHexStr(b1Match[1]));
|
||||
const a2Hex = atob(unescapeHexStr(a2Match[1]));
|
||||
const c3Hex = unescapeHexStr(c3Match[1]);
|
||||
|
||||
const solver = new Function(
|
||||
"c3Hex",
|
||||
"a1Hex",
|
||||
"b2Hex",
|
||||
`
|
||||
${minJsRes.data}
|
||||
function toNumbers(d){var e=[];d.replace(/(..)/g,function(d){e.push(parseInt(d,16))});return e}
|
||||
function toHex(){for(var d=[],d=1==arguments.length&&arguments[0].constructor==Array?arguments[0]:arguments,e='',f=0;f<d.length;f++)e+=(16>d[f]?'0':'')+d[f].toString(16);return e.toLowerCase()}
|
||||
return toHex(slowAES.decrypt(toNumbers(c3Hex), 2, toNumbers(a1Hex), toNumbers(b2Hex)));
|
||||
`,
|
||||
);
|
||||
|
||||
const decrypted = solver(c3Hex, a2Hex, b1Hex);
|
||||
const newCookie = `Antiddos-systems-DH=${decrypted}`;
|
||||
|
||||
res = await axios.get(url, {
|
||||
headers: { ...headers, Cookie: newCookie },
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
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[] = [];
|
||||
|
||||
// The site changed its layout. Links are now inside <p> tags following <h3> or <h4> tags with quality info.
|
||||
// We can also just look for the <a> tags directly and find their preceding quality headers.
|
||||
const hElements = container.find("h3, h4, h5, p");
|
||||
|
||||
hElements.each((index, element) => {
|
||||
const el = $(element);
|
||||
const title = el.text().trim();
|
||||
|
||||
// The download buttons are usually in the next <p> tag
|
||||
const downloadButtons = el.nextAll().find("a").first();
|
||||
const link = downloadButtons.attr("href");
|
||||
|
||||
if (
|
||||
title &&
|
||||
link &&
|
||||
title.match(/Episode|Ep|E\d+/i) &&
|
||||
title.length < 150
|
||||
) {
|
||||
// Clean up the title
|
||||
const cleanedTitle = title.replace(/[-:]/g, "").trim();
|
||||
|
||||
// Deduplicate
|
||||
if (!episodes.some((e) => e.link === link)) {
|
||||
episodes.push({
|
||||
title: cleanedTitle,
|
||||
link: link,
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Fallback: if no episodes found by heading, just grab all mdrive/fastdl links
|
||||
if (episodes.length === 0) {
|
||||
$("a").each((i, el) => {
|
||||
const href = $(el).attr("href");
|
||||
if (
|
||||
href &&
|
||||
(href.includes("mdrive") ||
|
||||
href.includes("fastdl") ||
|
||||
href.includes("filebee") ||
|
||||
href.includes("gdflix"))
|
||||
) {
|
||||
const title =
|
||||
$(el).parent().prev().text().trim() ||
|
||||
$(el).text().trim() ||
|
||||
`Episode ${i + 1}`;
|
||||
if (!episodes.some((e) => e.link === href)) {
|
||||
episodes.push({
|
||||
title: title.replace(/[-:]/g, "").trim(),
|
||||
link: href,
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// console.log(episodes);
|
||||
return episodes;
|
||||
} catch (err) {
|
||||
@@ -66,4 +138,4 @@ export const getEpisodes = async function ({
|
||||
// console.error(err);
|
||||
return [];
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user