From 9fc8c623e04c82d79eb093ccb8223e3227bafb94 Mon Sep 17 00:00:00 2001 From: Banana Date: Sun, 23 Apr 2023 17:10:07 +0200 Subject: [PATCH] fix for #19 imdb changed layout and regex did not match anymore --- webclient/lib/imdbwebparser.class.php | 33 +++++++++++++-------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/webclient/lib/imdbwebparser.class.php b/webclient/lib/imdbwebparser.class.php index 94865fb..b80873e 100644 --- a/webclient/lib/imdbwebparser.class.php +++ b/webclient/lib/imdbwebparser.class.php @@ -53,23 +53,23 @@ class IMDB const IMDB_AKA = '~]*>\s*Also\s*Known\s*As\s*\s*(.+)~Uis'; const IMDB_ASPECT_RATIO = '~]*>Aspect\s*Ratio\s*(.+)~Uis'; const IMDB_AWARDS = '~\s*Awards:(.+)~Uis'; - const IMDB_BUDGET = '~]*>Budget<\/td>\s*\s*(.*)(?:\(estimated\))\s*<\/td>~Ui'; + const IMDB_BUDGET = '~]*>Budget\s*\s*(.*)(?:\(estimated\))\s*~Ui'; const IMDB_CAST = '~]*itemprop="actor"[^>]*>\s*]*>\s*(.+)sUrl = 'https://www.imdb.com/find?q=' . rawurlencode(str_replace(' ', '+', $sSearch)) . $sParameters; + $this->sUrl = 'https://www.imdb.com/find/?q=' . rawurlencode(str_replace(' ', '+', $sSearch)) . $sParameters; $bSearch = true; // Was this search already performed and cached? @@ -298,7 +297,7 @@ class IMDB } $aCurlInfo = $this->runCurl($this->sUrl); - $sSource = $aCurlInfo['contents']; + $sSource = is_bool($aCurlInfo) ? $aCurlInfo : $aCurlInfo['contents'] ; if (false === $sSource) { if ($this->IMDB_DEBUG) { @@ -1741,7 +1740,7 @@ class IMDB [ CURLOPT_CONNECTTIMEOUT => $this->IMDB_TIMEOUT, CURLOPT_ENCODING => '', - CURLOPT_FOLLOWLOCATION => 0, + CURLOPT_FOLLOWLOCATION => true, CURLOPT_FRESH_CONNECT => 0, CURLOPT_HEADER => ($bDownload ? false : true), CURLOPT_HTTPHEADER => [ @@ -1754,7 +1753,7 @@ class IMDB CURLOPT_SSL_VERIFYPEER => 0, CURLOPT_TIMEOUT => $this->IMDB_TIMEOUT, CURLOPT_USERAGENT => $this->IMDB_BROWSER_AGENT, - CURLOPT_VERBOSE => 0, + CURLOPT_VERBOSE => 0 ] ); $sOutput = curl_exec($oCurl); @@ -1762,7 +1761,7 @@ class IMDB curl_close($oCurl); $aCurlInfo['contents'] = $sOutput; - if (200 !== $aCurlInfo['http_code'] && 302 !== $aCurlInfo['http_code']) { + if (200 !== $aCurlInfo['http_code']) { if ($this->IMDB_DEBUG) { echo '
cURL returned wrong HTTP code “' . $aCurlInfo['http_code'] . '”, aborting.
'; } -- 2.39.5