Explorar el Código

detect pinterest captcha

lolcat hace 3 meses
padre
commit
0861450b8a
Se han modificado 1 ficheros con 8 adiciones y 0 borrados
  1. 8 0
      scraper/pinterest.php

+ 8 - 0
scraper/pinterest.php

@@ -297,6 +297,14 @@ class pinterest{
 			throw new Exception("Failed to decode JSON");
 		}
 		
+		if(
+			isset($json["client_context"]["is_bad_bot"]) &&
+			(int)$json["client_context"]["is_bad_bot"] === 1
+		){
+			
+			throw new Exception("Pinterest blocked this instance or request proxy.");
+		}
+		
 		$out = [
 			"status" => "ok",
 			"npt" => null,