Commit 52821444 authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

Wenn Bing beim Parsen der Ergebnisseite abstürzt, gibt es nun einfach ein leeres Ergebnis zurück

parent 32133fef
...@@ -16,27 +16,33 @@ class Bing extends Searchengine ...@@ -16,27 +16,33 @@ class Bing extends Searchengine
public function loadResults ($result) public function loadResults ($result)
{ {
$crawler = new Crawler($result); try
$crawler->filter('ol#b_results > li.b_algo')->each(function (Crawler $node, $i)
{ {
$title = $node->filter('li h2 > a')->text(); $crawler = new Crawler($result);
$link = $node->filter('li h2 > a')->attr('href'); $crawler->filter('ol#b_results > li.b_algo')->each(function (Crawler $node, $i)
$anzeigeLink = $link; {
$descr = $node->filter('li div > p')->text(); $title = $node->filter('li h2 > a')->text();
$link = $node->filter('li h2 > a')->attr('href');
#die($result); $anzeigeLink = $link;
$descr = $node->filter('li div > p')->text();
$this->counter++;
$this->results[] = new \App\Models\Result( #die($result);
$this->engine,
$title, $this->counter++;
$link, $this->results[] = new \App\Models\Result(
$anzeigeLink, $this->engine,
$descr, $title,
$this->gefVon, $link,
$this->counter $anzeigeLink,
); $descr,
} ); $this->gefVon,
$this->counter
);
} );
} catch ( \ErrorException $e)
{
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