aboutsummaryrefslogtreecommitdiffstats
path: root/scraper/ddg.php
diff options
context:
space:
mode:
authorlolcat <will@lolcat.ca>2024-12-17 21:01:36 -0500
committerlolcat <will@lolcat.ca>2024-12-17 21:01:36 -0500
commit9ca93f34c6f8d8d40134550b51961d16727e8050 (patch)
tree1d27f0da47826df773c7cfdacaa642a402e49cf9 /scraper/ddg.php
parent0a43b9c84968a40527fad72d9b94deedfff5a584 (diff)
ddg hotfix
Diffstat (limited to 'scraper/ddg.php')
-rw-r--r--scraper/ddg.php32
1 files changed, 23 insertions, 9 deletions
diff --git a/scraper/ddg.php b/scraper/ddg.php
index 8b1e714..a2d43c7 100644
--- a/scraper/ddg.php
+++ b/scraper/ddg.php
@@ -693,7 +693,11 @@ class ddg{
$out["spelling"] = [
"type" => $type,
- "using" => $json["suggestion"],
+ "using" =>
+ $this->fuckhtml
+ ->getTextContent(
+ $json["suggestion"]
+ ),
"correction" => $json["recourseText"]
];
}
@@ -1147,17 +1151,27 @@ class ddg{
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
->getTextContent(
$citation["source"]
- )
+ );
+ }
+
+ $push[] = [
+ "type" => "quote",
+ "value" => $text
];
}
}
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage