From 62ba04874d1030193b0200c0a17aa7583b202273 Mon Sep 17 00:00:00 2001 From: Karl <Karl Hasselbring> Date: Wed, 11 Jan 2017 10:39:59 +0100 Subject: [PATCH] =?UTF-8?q?Ich=20habe=20den=20base=20Parser=20jetzt=20theo?= =?UTF-8?q?retisch=20wieder=20eingef=C3=BCgt,=20konnte=20ihn=20allerdings?= =?UTF-8?q?=20aufgrund=20fehlender=20zugelassener=20IP=20noch=20nicht=20te?= =?UTF-8?q?sten?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Models/parserSkripte/BASE.php | 44 ++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/app/Models/parserSkripte/BASE.php b/app/Models/parserSkripte/BASE.php index e5c223e45..aaee5b1f7 100644 --- a/app/Models/parserSkripte/BASE.php +++ b/app/Models/parserSkripte/BASE.php @@ -3,6 +3,7 @@ namespace app\Models\parserSkripte; use App\Models\Searchengine; +use Log; class BASE extends Searchengine { @@ -15,6 +16,47 @@ class BASE extends Searchengine public function loadResults($result) { - return; + $result = preg_replace("/\r\n/si", "", $result); + try { + $content = simplexml_load_string($result); + if (!$content) { + return; + } + + $results = $content->xpath('//response/result'); + foreach ($results as $result) { + // searches for the fitting values of name as in + // <str name = "dctitle">Digitisation of library collections</str> + foreach ($result as $attribute) { + switch ((string) $attribute['name']) { + case 'dctitle': + $title = $attribute; + break; + case 'dclink': + $link = $attribute; + $anzeigeLink = $link; + break; + case 'dcdescription': + $descr = $attribute; + break; + } + } + if (isset($title) && isset($link) && isset($anzeigeLink) && isset($descr)) { + $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"); + return; + } } } -- GitLab