diff --git a/api.php b/api.php index abc7b44..4f1b1ec 100644 --- a/api.php +++ b/api.php @@ -122,26 +122,25 @@ function fetchCinemaPassion($title, $year = '', $ean = '', $pdo = null) { $defaultPoster = 'assets/img/default_physical_media.jpg'; $cleanTitle = cleanTitle($title); - // ÉTAPE 1 : URL de recherche standardisée + // URL de recherche (comme avant) $searchUrl = "https://www.cinemapassion.com/recherche.php?recherche=" . urlencode($cleanTitle); $searchRes = httpGet($searchUrl); - if ($searchRes) { - // Extraction du lien du premier résultat - if (preg_match('/ $imgMatches[1], - 'title' => $cleanTitle, - 'format' => 'Blu-ray' - ]; - } + if (preg_match($pattern, $filmRes, $imgMatches)) { + return [ + 'poster' => $imgMatches[1], + 'title' => $cleanTitle, + 'format' => 'Blu-ray' + ]; } } }