lolcat 1 rok temu
rodzic
commit
9ca93f34c6
1 zmienionych plików z 23 dodań i 9 usunięć
  1. 23 9
      scraper/ddg.php

+ 23 - 9
scraper/ddg.php

@@ -693,7 +693,11 @@ class ddg{
 				
 				
 				$out["spelling"] = [
 				$out["spelling"] = [
 					"type" => $type,
 					"type" => $type,
-					"using" => $json["suggestion"],
+					"using" =>
+						$this->fuckhtml
+						->getTextContent(
+							$json["suggestion"]
+						),
 					"correction" => $json["recourseText"]
 					"correction" => $json["recourseText"]
 				];
 				];
 			}
 			}
@@ -1147,17 +1151,27 @@ class ddg{
 						
 						
 						foreach($snippet["citations"] as $citation){
 						foreach($snippet["citations"] as $citation){
 							
 							
-							$push[] = [
-								"type" => "quote",
-								"value" =>
-									$this->fuckhtml
-									->getTextContent(
-										$citation["cite"]
-									) . " - " .
+							if(!isset($citation["cite"])){ continue; }
+							
+							$text =
+								$this->fuckhtml
+								->getTextContent(
+									$citation["cite"]
+								);
+							
+							if(isset($citation["source"])){
+								
+								$text .=
+									" - " .
 									$this->fuckhtml
 									$this->fuckhtml
 									->getTextContent(
 									->getTextContent(
 										$citation["source"]
 										$citation["source"]
-									)
+									);
+							}
+							
+							$push[] = [
+								"type" => "quote",
+								"value" => $text
 							];
 							];
 						}
 						}
 					}
 					}