Commit 98fb73e4 authored by Dominik Hebeler's avatar Dominik Hebeler

New Qualigo Parser

parent eb0e908a
......@@ -10,6 +10,8 @@ class Qualigo extends Searchengine
public function __construct($name, \StdClass $engine, \App\MetaGer $metager)
{
parent::__construct($name, $engine, $metager);
$this->getString .= $this->addData($metager->getUrl());
$this->hash = md5($this->engine->host . $this->getString . $this->engine->port . $this->name);
}
public function loadResults($results)
......@@ -19,16 +21,19 @@ class Qualigo extends Searchengine
} catch (\Exception $e) {
abort(500, "$result is not a valid xml string");
}
if (!$content) {
return;
}
$results = $content->xpath('//RL/RANK');
$results = $content->xpath('//RANK');
foreach ($results as $result) {
$title = $result->{"TITLE"}->__toString();
$link = $result->{"URL"}->__toString();
$title = $result->{"TITLE"}->__toString();
$link = $result->{"URL"}->__toString();
$anzeigeLink = $result->{"ORIGURL"}->__toString();
$descr = $result->{"ABSTRACT"}->__toString();
$descr = $result->{"ABSTRACT"}->__toString();
$extras = [];
if (!empty($result->{"OFFER"})) {
$extras["price"] = intval(floatval($result->{"OFFER"}->__toString()) * 100);
}
$this->counter++;
$this->ads[] = new \App\Models\Result(
$this->engine,
......@@ -36,10 +41,17 @@ class Qualigo extends Searchengine
$link,
$anzeigeLink,
$descr,
$this->engine->{"display-name"},$this->engine->homepage,
$this->counter
$this->engine->{"display-name"},
$this->engine->homepage,
$this->counter,
$extras
);
}
}
private function addData()
{
# Add anonymized userdata
return "&ip=" . urlencode($this->ip) . "&agent=" . urlencode($this->useragent);
}
}
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