Actualiser api.php
This commit is contained in:
@@ -109,10 +109,6 @@ function extractYear($dateStr) {
|
|||||||
function fetchDVDFr($ean, $pdo) {
|
function fetchDVDFr($ean, $pdo) {
|
||||||
if (empty($ean) || strlen($ean) < 8) return null;
|
if (empty($ean) || strlen($ean) < 8) return null;
|
||||||
|
|
||||||
$cacheKey = 'dvdfr_html_' . md5($ean);
|
|
||||||
$cached = getCache($pdo, $cacheKey);
|
|
||||||
if ($cached) return $cached;
|
|
||||||
|
|
||||||
$ua = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36';
|
$ua = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36';
|
||||||
|
|
||||||
// Étape 1 : Recherche par EAN sur le site DVDfr
|
// Étape 1 : Recherche par EAN sur le site DVDfr
|
||||||
@@ -243,11 +239,6 @@ function fetchDVDFr($ean, $pdo) {
|
|||||||
return trim(strip_tags(html_entity_decode($val, ENT_QUOTES | ENT_HTML5, 'UTF-8')));
|
return trim(strip_tags(html_entity_decode($val, ENT_QUOTES | ENT_HTML5, 'UTF-8')));
|
||||||
}, $result);
|
}, $result);
|
||||||
|
|
||||||
// Mise en cache si on a au moins une donnée
|
|
||||||
if (!empty($result['poster']) || !empty($result['publisher'])) {
|
|
||||||
setCache($pdo, $cacheKey, $result, 'dvdfr');
|
|
||||||
}
|
|
||||||
|
|
||||||
return (!empty($result['poster']) || !empty($result['publisher'])) ? $result : null;
|
return (!empty($result['poster']) || !empty($result['publisher'])) ? $result : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user