v1.5.9 (Actuel)

This commit is contained in:
2026-09-15 21:56:10 +02:00
parent c21cd3ab5e
commit bff992aa4a
56 changed files with 3404 additions and 327 deletions
+25 -5
View File
@@ -64,9 +64,17 @@ function detectType(href: string): 'movie' | 'series' | 'anime' {
}
function absUrl(url: string, baseUrl: string): string {
if (url.startsWith('http')) return url;
let path = url;
if (url.startsWith('http')) {
try {
const u = new URL(url);
path = u.pathname + u.search + u.hash;
} catch {
return url;
}
}
const cleanedBase = baseUrl.replace(/\/$/, '');
return cleanedBase + '/' + url.replace(/^\//, '');
return cleanedBase + '/' + path.replace(/^\//, '');
}
/**
@@ -83,9 +91,15 @@ export function parseSearchResults(html: string, baseUrl: string): SearchResult[
const href = absUrl(hrefRaw, baseUrl);
const title = m[3]!.replace(/<[^>]+>/g, '').replace(/\s+/g, ' ').trim();
if (!title) continue;
let year: string | null = null;
const yearMatch = title.match(/\(\s*(\d{4})\s*\)/) || hrefRaw.match(/-(\d{4})-/);
if (yearMatch) {
year = yearMatch[1];
}
results.push({
title,
year: null,
year,
image,
hrefPath: href,
type: detectType(hrefRaw),
@@ -106,9 +120,15 @@ export function parseTrendingResults(html: string, baseUrl: string): SearchResul
const hrefRaw = m[1]!;
const title = m[2]!.trim();
const image = absUrl(m[3]!, baseUrl);
let year: string | null = null;
const yearMatch = title.match(/\(\s*(\d{4})\s*\)/) || hrefRaw.match(/-(\d{4})-/);
if (yearMatch) {
year = yearMatch[1];
}
results.push({
title,
year: null,
year,
image,
hrefPath: absUrl(hrefRaw, baseUrl),
type: detectType(hrefRaw),
@@ -127,7 +147,7 @@ export function parseContentHTML(html: string, isSeries: boolean): ContentLinks
const links: VideoLink[] = [];
if (isSeries) {
const episodeRegex = /<input[^>]+name="lien"\s+value="(https?:\/\/liens\.free-telecharger\.cam\/[^"]+)"/gi;
const episodeRegex = /<input[^>]+name="lien"\s+value="(https?:\/\/liens\.free-telecharger\.[a-z]+\/[^"]+)"/gi;
let m: RegExpExecArray | null;
let idx = 0;
while ((m = episodeRegex.exec(html)) !== null) {