Commit 4140bcca authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

Merge branch '75-es-sind-noch-nicht-alle-suchmaschinen-eingebaut' into 'master'

Einige fehlende Suchmaschinen hinzugefügt

Closes #75

See merge request !86
parents 8602abcd df04394e
<?php
namespace app\Models\parserSkripte;
use App\Models\Searchengine;
class Beammachine extends Searchengine
{
public $results = [];
function __construct (\SimpleXMLElement $engine, \App\MetaGer $metager)
{
parent::__construct($engine, $metager);
}
public function loadResults ($result)
{
$results = trim($result);
foreach( explode("\n", $results) as $result )
{
$res = explode("|", $result);
if(sizeof($res) < 3)
{
continue;
}
$title = $res[0];
$link = $res[1];
$anzeigeLink = $link;
$descr = $res[2];
$this->counter++;
$this->results[] = new \App\Models\Result(
$this->engine,
$title,
$link,
$anzeigeLink,
$descr,
$this->gefVon,
$this->counter
);
}
}
}
<?php
namespace app\Models\parserSkripte;
use App\Models\Searchengine;
use Symfony\Component\DomCrawler\Crawler;
class Dart extends Searchengine
{
public $results = [];
function __construct (\SimpleXMLElement $engine, \App\MetaGer $metager)
{
parent::__construct($engine, $metager);
}
public function loadResults ($result)
{
$crawler = new Crawler($result);
$crawler->filter('table#search-results > tr > td')->each(function (Crawler $node, $i)
{
$i = $i - ( 6 * $this->counter);
if($i === 0)
return;
if($i === 1)
{
$this->description = $node->text();
$this->link = "http://www.dart-europe.eu/" . $node->filter('a')->attr('href');
}
if($i === 2)
$this->title = $node->text();
if($i === 3)
$this->title .= " (" . $node->text() . ")";
if($i === 4)
$this->title .= " " . $node->text();
if($i === 5)
{
$this->title .= "|" . $node->text();
$title = $this->title;
$this->title = "";
$link = $this->link;
$this->link = "";
$anzeigeLink = $link;
$descr = $this->description;
$this->description = "";
$this->counter++;
$this->results[] = new \App\Models\Result(
$this->engine,
$title,
$link,
$anzeigeLink,
$descr,
$this->gefVon,
$this->counter
);
}
} );
}
}
......@@ -2,6 +2,7 @@
namespace app\Models\parserSkripte;
use App\Models\Searchengine;
use Symfony\Component\DomCrawler\Crawler;
class Goyax extends Searchengine
{
......@@ -14,21 +15,14 @@ class Goyax extends Searchengine
public function loadResults ($result)
{
die($result);
$results = trim($result);
foreach( explode("\n", $results) as $result )
$crawler = new Crawler($result);
$crawler->filter('tr.treffer')->each(function (Crawler $node, $i)
{
$res = explode("|", $result);
if(sizeof($res) < 3)
{
continue;
}
$title = $res[0];
$link = $res[2];
$title = $node->filter('td.name')->text();
$link = "http://www.goyax.de" . $node->filter('td.name > a')->attr('href');
$anzeigeLink = $link;
$descr = $res[1];
$descr = "Aktie: " . $node->filter('td.waehrung')->text() . " " . $node->filter('td.isin')->text();
$this->counter++;
$this->results[] = new \App\Models\Result(
......@@ -40,7 +34,8 @@ class Goyax extends Searchengine
$this->gefVon,
$this->counter
);
}
} );
}
......
<?php
namespace app\Models\parserSkripte;
use App\Models\Searchengine;
use Log;
class Loklak extends Searchengine
{
public $results = [];
function __construct (\SimpleXMLElement $engine, \App\MetaGer $metager)
{
parent::__construct($engine, $metager);
}
public function loadResults ($result)
{
if(!$result)
{
return;
}
$results = json_decode($result, true);
if( !isset($results['statuses']) )
return;
foreach($results['statuses'] as $result)
{
$title = $result["screen_name"];
$link = $result['link'];
$anzeigeLink = $link;
$descr = $result["text"];
$this->counter++;
$this->results[] = new \App\Models\Result(
$this->engine,
$title,
$link,
$anzeigeLink,
$descr,
$this->gefVon,
$this->counter
);
}
}
}
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