diff --git a/app/Models/Searchengine.php b/app/Models/Searchengine.php index 036b0fedbf664dae1bfcdc6f08e3fba630ed7279..6f6cf9ba75820a06bc15ec68a0dbb3889c106e5b 100644 --- a/app/Models/Searchengine.php +++ b/app/Models/Searchengine.php @@ -122,7 +122,11 @@ abstract class Searchengine }else{ $url = "http://"; } - $url .= $this->host . $this->getString; + $url .= $this->host; + if($this->port !== 80 && $this->port !== 443){ + $url .= ":" . $this->port; + } + $url .= $this->getString; $url = base64_encode($url); $mission = $this->resultHash . ";" . $url . ";" . $metager->getTime(); // Submit this mission to the corresponding Redis Queue diff --git a/app/Models/parserSkripte/Yacy.php b/app/Models/parserSkripte/Yacy.php index 8ce3ae4187e7ddbd21aa0c78e6125a3d8326d6a4..37b0ce821f7f7ead742bf38e043b0b9cc86ee0de 100644 --- a/app/Models/parserSkripte/Yacy.php +++ b/app/Models/parserSkripte/Yacy.php @@ -16,34 +16,31 @@ class Yacy extends Searchengine public function loadResults($result) { - $result = preg_replace("/\r\n/si", "", $result); + try { - $content = simplexml_load_string($result); - if (!$content) { - return; - } - - $results = $content->xpath("//rss/channel/item"); - if (!$results) { - return; - } - - foreach ($results as $res) { - $title = $res->{"title"}; - $link = $res->{"link"}; - $anzeigeLink = $link; - $descr = $res->{"description"}; - - $this->counter++; - $this->results[] = new \App\Models\Result( - $this->engine, - $title, - $link, - $anzeigeLink, - $descr, - $this->gefVon, - $this->counter - ); + $content = json_decode($result, true); + $content = $content["channels"]; + + foreach($content as $channel){ + $items = $channel["items"]; + foreach($items as $item){ + $title = $item["title"]; + $link = $item["link"]; + $anzeigeLink = $link; + $descr = $item["description"]; + + $this->counter++; + $this->results[] = new \App\Models\Result( + $this->engine, + $title, + $link, + $anzeigeLink, + $descr, + $this->gefVon, + $this->counter + ); + } + } } catch (\Exception $e) { Log::error("A problem occurred parsing results from $this->name:");