diff --git a/api.php b/api.php
index 96c1c45..4c06bab 100644
--- a/api.php
+++ b/api.php
@@ -500,6 +500,66 @@ function fetchFromBlurayCom($ean) {
return $empty;
}
+function fetchFromMovieCovers($title, $year = '') {
+ $empty = [
+ 'title' => '', 'year' => '', 'director' => '', 'actors' => '',
+ 'poster' => '', 'description' => '', 'length' => '',
+ 'publisher' => '', 'format' => 'DVD', 'number_of_discs' => 1,
+ 'aspect_ratio' => ''
+ ];
+
+ // Nettoyer le titre pour l'URL
+ $urlTitle = strtoupper(str_replace(' ', '+', $title));
+ $url = "https://moviecovers.com/film/titre_{$urlTitle}.html";
+
+ $html = httpGet($url, 10);
+ if (!$html) return $empty;
+
+ // Extraire le titre
+ if (preg_match('/
([^<]+)<\/TITLE>/i', $html, $m)) {
+ $empty['title'] = trim($m[1]);
+ }
+
+ // Extraire l'affiche
+ if (preg_match('/
]*src="(https:\/\/moviecovers\.com\/DATA\/thumbs\/[^"]+)"[^>]*title="Recto/i', $html, $m)) {
+ $empty['poster'] = $m[1];
+ } elseif (preg_match('/]*property="og:image"[^>]*content="([^"]+)"/i', $html, $m)) {
+ $empty['poster'] = $m[1];
+ }
+
+ // Extraire le réalisateur
+ if (preg_match('/Réalisateur<\/TH>\s*]*>.*?]*>([^<]+)<\/a>/is', $html, $m)) {
+ $empty['director'] = trim($m[1]);
+ }
+
+ // Extraire l'année
+ if (preg_match('/Année<\/TH>\s* | ]*>.*?]*>(\d{4})<\/a>/is', $html, $m)) {
+ $empty['year'] = $m[1];
+ }
+
+ // Extraire la durée
+ if (preg_match('/Durée<\/TH>\s* | ]*>([\dH]+[\dmin]*)/is', $html, $m)) {
+ $empty['length'] = trim($m[1]);
+ }
+
+ // Extraire les acteurs
+ if (preg_match_all('/([^<]+)<\/a>/i', $html, $matches)) {
+ $empty['actors'] = implode(', ', array_slice($matches[1], 0, 5));
+ }
+
+ // Extraire le synopsis
+ if (preg_match('/]*property="og:description"[^>]*content="([^"]+)"/i', $html, $m)) {
+ $empty['description'] = html_entity_decode($m[1]);
+ }
+
+ // Format haute qualité de l'affiche
+ if ($empty['poster']) {
+ $empty['poster'] = str_replace('/thumbs/', '/films-l/', $empty['poster']);
+ }
+
+ return $empty;
+}
+
// ── ROUTEUR PRINCIPAL ──
$action = $_GET['action'] ?? '';
$data = json_decode(file_get_contents('php://input'), true) ?? [];
|