Explorar el Código

brave pagination fix

lolcat hace 1 año
padre
commit
47a7a2a224
Se han modificado 1 ficheros con 45 adiciones y 30 borrados
  1. 45 30
      scraper/brave.php

+ 45 - 30
scraper/brave.php

@@ -403,7 +403,7 @@ class brave{
 			
 			$nextpage =
 				$this->fuckhtml
-				->getElementsByClassName("btn", "a");
+				->getElementsByClassName("button", "a");
 			
 			if(count($nextpage) !== 0){
 				
@@ -1777,42 +1777,57 @@ class brave{
 		
 		$nextpage =
 			$this->fuckhtml
-			->getElementsByClassName("btn", "a");
+			->getElementById(
+				"pagination",
+				"div"
+			);
 		
-		if(count($nextpage) !== 0){
+		if($nextpage){
+			
+			$this->fuckhtml->load($nextpage);
 			
 			$nextpage =
-				$nextpage[count($nextpage) - 1];
+				$this->fuckhtml
+				->getElementsByClassName(
+					"button",
+					"a"
+				);
 			
-			if(
-				strtolower(
-					$this->fuckhtml
-					->getTextContent(
-						$nextpage
-					)
-				) == "next"
-			){
+			if(count($nextpage) !== 0){
 				
-				preg_match(
-					'/offset=([0-9]+)/',
-					$this->fuckhtml->getTextContent($nextpage["attributes"]["href"]),
-					$nextpage
-				);
+				$nextpage =
+					$nextpage[count($nextpage) - 1];
 				
-				return
-					$this->backend->store(
-						json_encode(
-							[
-								"q" => $q,
-								"offset" => (int)$nextpage[1],
-								"nsfw" => $nsfw,
-								"country" => $country,
-								"spellcheck" => $spellcheck
-							]
-						),
-						$page,
-						$proxy
+				if(
+					strtolower(
+						$this->fuckhtml
+						->getTextContent(
+							$nextpage
+						)
+					) == "next"
+				){
+					
+					preg_match(
+						'/offset=([0-9]+)/',
+						$this->fuckhtml->getTextContent($nextpage["attributes"]["href"]),
+						$nextpage
 					);
+					
+					return
+						$this->backend->store(
+							json_encode(
+								[
+									"q" => $q,
+									"offset" => (int)$nextpage[1],
+									"nsfw" => $nsfw,
+									"country" => $country,
+									"spellcheck" => $spellcheck
+								]
+							),
+							$page,
+							$proxy
+						);
+				}
 			}
 		}