Преглед изворни кода

error handling for invalid pagetype

lolcat пре 2 година
родитељ
комит
0f39d9c187
2 измењених фајлова са 11 додато и 1 уклоњено
  1. 2 0
      lib/backend.php
  2. 9 1
      scraper/google.php

+ 2 - 0
lib/backend.php

@@ -32,6 +32,8 @@ class backend{
 		
 		$proxylist = array_values($proxylist);
 		
+		echo $proxy_index_raw % count($proxylist);
+		
 		return $proxylist[$proxy_index_raw % count($proxylist)];
 	}
 	

+ 9 - 1
scraper/google.php

@@ -1020,7 +1020,15 @@ class google{
 						self::is_class
 					),
 					"div"
-				)[1];
+				);
+			
+			if(!isset($description[1])){
+				
+				throw new Exception("Google returned an unsupported page format (will fix)");
+			}else{
+				
+				$description = $description[1];
+			}
 			
 			// get date (rare)
 			$date =