Commit 62ba0487 authored by Karl's avatar Karl

Ich habe den base Parser jetzt theoretisch wieder eingefügt, konnte ihn...

Ich habe den base Parser jetzt theoretisch wieder eingefügt, konnte ihn allerdings aufgrund fehlender zugelassener IP noch nicht testen
parent e5c6b68a
......@@ -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;
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment