|
16 | 16 | * - Selenium extraction support when enabled by domain / Suporte a extração via Selenium quando habilitado por domínio |
17 | 17 | */ |
18 | 18 |
|
19 | | -require_once 'Rules.php'; |
20 | | -require_once 'Cache.php'; |
21 | | -require_once 'Logger.php'; |
22 | | -require_once 'Language.php'; |
| 19 | +require_once __DIR__ . '/Rules.php'; |
| 20 | +require_once __DIR__ . '/Cache.php'; |
| 21 | +require_once __DIR__ . '/Logger.php'; |
| 22 | +require_once __DIR__ . '/Language.php'; |
23 | 23 |
|
24 | 24 | use Curl\Curl; |
25 | 25 | use Facebook\WebDriver\Remote\DesiredCapabilities; |
@@ -253,14 +253,14 @@ public function analyze($url) |
253 | 253 | $host = preg_replace('/^www\./', '', $host); |
254 | 254 |
|
255 | 255 | if (in_array($host, BLOCKED_DOMAINS)) { |
256 | | - Logger::getInstance()->log($cleanUrl, 'BLOCKED_DOMAIN'); |
| 256 | + Logger::getInstance()->logUrl($cleanUrl, 'BLOCKED_DOMAIN'); |
257 | 257 | $this->throwError(self::ERROR_BLOCKED_DOMAIN); |
258 | 258 | } |
259 | 259 |
|
260 | 260 | // Check URL status code before proceeding |
261 | 261 | $redirectInfo = $this->checkStatus($cleanUrl); |
262 | 262 | if ($redirectInfo['httpCode'] !== 200) { |
263 | | - Logger::getInstance()->log($cleanUrl, 'INVALID_STATUS_CODE', "HTTP {$redirectInfo['httpCode']}"); |
| 263 | + Logger::getInstance()->logUrl($cleanUrl, 'INVALID_STATUS_CODE', "HTTP {$redirectInfo['httpCode']}"); |
264 | 264 | if ($redirectInfo['httpCode'] === 404) { |
265 | 265 | $this->throwError(self::ERROR_NOT_FOUND); |
266 | 266 | } else { |
@@ -296,7 +296,7 @@ public function analyze($url) |
296 | 296 | return $processedContent; |
297 | 297 | } |
298 | 298 | } catch (Exception $e) { |
299 | | - Logger::getInstance()->log($cleanUrl, strtoupper($fetchStrategy) . '_ERROR', $e->getMessage()); |
| 299 | + Logger::getInstance()->logUrl($cleanUrl, strtoupper($fetchStrategy) . '_ERROR', $e->getMessage()); |
300 | 300 | throw $e; |
301 | 301 | } |
302 | 302 | } |
@@ -326,7 +326,7 @@ public function analyze($url) |
326 | 326 | } |
327 | 327 |
|
328 | 328 | // If we get here, all strategies failed |
329 | | - Logger::getInstance()->log($cleanUrl, 'GENERAL_FETCH_ERROR'); |
| 329 | + Logger::getInstance()->logUrl($cleanUrl, 'GENERAL_FETCH_ERROR'); |
330 | 330 | if ($lastError) { |
331 | 331 | $message = $lastError->getMessage(); |
332 | 332 | if (strpos($message, 'DNS') !== false) { |
|
0 commit comments