diff --git a/api.php b/api.php
index 4c693cc..256b302 100644
--- a/api.php
+++ b/api.php
@@ -668,4 +668,44 @@ switch ($action) {
echo json_encode(["success" => false, "error" => "Erreur serveur : " . $e->getMessage(), "debug" => $debugLog]);
}
break;
+
+ case 'debug_dvdfr':
+ checkAuth($pdo);
+ $ean = $_GET['ean'] ?? '';
+ if (!$ean) { echo json_encode(['error' => 'EAN manquant']); exit; }
+
+ $ua = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 Chrome/124.0.0.0 Safari/537.36';
+
+ // Étape 1 : page de recherche
+ $ch = curl_init('https://www.dvdfr.com/search/?q=' . urlencode($ean));
+ curl_setopt_array($ch, [
+ CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 10,
+ CURLOPT_SSL_VERIFYPEER => false, CURLOPT_USERAGENT => $ua,
+ CURLOPT_FOLLOWLOCATION => true, CURLOPT_ENCODING => '',
+ CURLOPT_HTTPHEADER => ['Accept-Language: fr-FR,fr;q=0.9'],
+ ]);
+ $searchHtml = curl_exec($ch);
+ $searchCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
+ $searchFinal = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
+ curl_close($ch);
+
+ // Extraire tous les liens .html
+ preg_match_all('@href=["\']([^"\']+\.html)["\']@i', $searchHtml, $links);
+ $allLinks = array_unique($links[1]);
+
+ // Chercher og:image dans la page de recherche
+ preg_match('/]+property=["\']og:image["\'][^>]+content=["\']([^"\']+)["\']/i', $searchHtml, $ogSearch);
+
+ // Chercher toutes les
+ preg_match_all('/
]+src=["\']([^"\']+)["\'][^>]*>/i', $searchHtml, $allImgs);
+
+ echo json_encode([
+ 'search_http_code' => $searchCode,
+ 'search_final_url' => $searchFinal,
+ 'search_og_image' => $ogSearch[1] ?? null,
+ 'search_links_html' => array_slice($allLinks, 0, 20),
+ 'search_imgs' => array_slice($allImgs[1], 0, 15),
+ 'search_html_sample' => substr($searchHtml, 0, 3000),
+ ], JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
+ break;
}
\ No newline at end of file