Update vidfast/vidfast.js

This commit is contained in:
aka paul 2025-11-02 15:00:14 +00:00
parent 4914c74686
commit a35f2b94c2

View file

@ -373,15 +373,31 @@ async function ilovefeet(imdbId, isSeries = false, season = null, episode = null
const sourceCharsMatch = configText.match(/source_chars\s*=\s*['"]([^'"]+)['"]/); const sourceCharsMatch = configText.match(/source_chars\s*=\s*['"]([^'"]+)['"]/);
const targetCharsMatch = configText.match(/target_chars\s*=\s*['"]([^'"]+)['"]/); const targetCharsMatch = configText.match(/target_chars\s*=\s*['"]([^'"]+)['"]/);
const apiServersMatch = configText.match(/api_servers\s*=\s*f?['"]([^'"]+)['"]/);
const apiStreamMatch = configText.match(/api_stream\s*=\s*f?['"]([^'"]+)['"]/);
const baseUrlMatch = configText.match(/base_url\s*=\s*['"]([^'"]+)['"]/);
const userAgentMatch = configText.match(/user_agent\s*=\s*['"]([^'"]+)['"]/);
const csrfTokenMatch = configText.match(/["']X-Csrf-Token["']:\s*["']([^'"]+)['"]/);
const refererMatch = configText.match(/["']Referer["']:\s*["']([^'"]+)['"]/);
if (!keyHexMatch || !ivHexMatch || !xorKeyMatch || !staticPathMatch || !sourceCharsMatch || !targetCharsMatch) { if (!keyHexMatch || !ivHexMatch || !xorKeyMatch || !staticPathMatch || !sourceCharsMatch || !targetCharsMatch) {
throw new Error('Failed to extract config values'); throw new Error('Failed to extract config values');
} }
const convertPythonFString = (str) => {
if (!str) return null;
return str
.replace(/\{static_path\}/g, '{STATIC_PATH}')
.replace(/\{encoded_final\}/g, '{ENCODED_FINAL}')
.replace(/\{server\}/g, '{SERVER}');
};
const config = { const config = {
pageMovie: "https://vidfast.pro/movie/{IMDB_ID}", pageMovie: "https://vidfast.pro/movie/{IMDB_ID}",
pageSeries: "https://vidfast.pro/tv/{IMDB_ID}/{SEASON}/{EPISODE}", pageSeries: "https://vidfast.pro/tv/{IMDB_ID}/{SEASON}/{EPISODE}",
apiServers: "https://vidfast.pro/{STATIC_PATH}/3xNAjSIxZx0b/{ENCODED_FINAL}", apiServers: apiServersMatch ? convertPythonFString(apiServersMatch[1]) : "https://vidfast.pro/{STATIC_PATH}/wfPFjh__qQ/{ENCODED_FINAL}",
apiStream: "https://vidfast.pro/{STATIC_PATH}/Ici0cUs4soE/{SERVER}", apiStream: apiStreamMatch ? convertPythonFString(apiStreamMatch[1]) : "https://vidfast.pro/{STATIC_PATH}/AddlBFe5/{SERVER}",
aesKeyHex: keyHexMatch[1], aesKeyHex: keyHexMatch[1],
aesIvHex: ivHexMatch[1], aesIvHex: ivHexMatch[1],
@ -401,13 +417,25 @@ async function ilovefeet(imdbId, isSeries = false, season = null, episode = null
baseUrl = config.pageMovie.replace('{IMDB_ID}', imdbId); baseUrl = config.pageMovie.replace('{IMDB_ID}', imdbId);
} }
let defaultDomain = "https://vidfast.pro/";
if (baseUrlMatch && baseUrlMatch[1]) {
const urlParts = baseUrlMatch[1].match(/^(https?:\/\/[^\/]+)/);
if (urlParts && urlParts[1]) {
defaultDomain = urlParts[1] + '/';
}
}
const headers = { const headers = {
"Accept": "*/*", "Accept": "*/*",
"User-Agent": "Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Mobile Safari/537.36", "User-Agent": userAgentMatch ? userAgentMatch[1] : "Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Mobile Safari/537.36",
"Referer": "https://vidfast.pro/", "Referer": refererMatch ? refererMatch[1] : defaultDomain,
"X-Requested-With": "XMLHttpRequest" "X-Requested-With": "XMLHttpRequest"
}; };
if (csrfTokenMatch && csrfTokenMatch[1]) {
headers["X-Csrf-Token"] = csrfTokenMatch[1];
}
const pageResponse = await fetchv2(baseUrl, headers); const pageResponse = await fetchv2(baseUrl, headers);
const pageText = await pageResponse.text(); const pageText = await pageResponse.text();