Commit fce29d50 authored by Karl's avatar Karl

Next result methoden sind jetzt auch absturzsicherer, bei openclipart ist ein...

Next result methoden sind jetzt auch absturzsicherer, bei openclipart ist ein beispiel wie man alles komplett sichern kann
parent 750acf42
......@@ -3,6 +3,7 @@
namespace app\Models\parserSkripte;
use App\Models\Searchengine;
use Log;
class Europeana extends Searchengine
{
......
......@@ -3,6 +3,7 @@
namespace app\Models\parserSkripte;
use App\Models\Searchengine;
use Log;
class Flickr extends Searchengine
{
......
......@@ -3,6 +3,7 @@
namespace app\Models\parserSkripte;
use App\Models\Searchengine;
use Log;
class Openclipart extends Searchengine
{
......@@ -18,52 +19,54 @@ class Openclipart extends Searchengine
$result = preg_replace("/\r\n/si", "", $result);
try {
$content = json_decode($result);
if (!$content) {
return;
}
$results = $content->payload;
foreach ($results as $result) {
$title = $result->title;
$link = $result->detail_link;
$anzeigeLink = $link;
$descr = $result->description;
$image = $result->svg->png_thumb;
$this->counter++;
$this->results[] = new \App\Models\Result(
$this->engine,
$title,
$link,
$anzeigeLink,
$descr,
$this->gefVon,
$this->counter,
false,
$image
);
}
} catch (\Exception $e) {
Log::error("Results from $this->name are not a valid json string");
return;
}
if (!$content) {
return;
}
$results = $content->payload;
foreach ($results as $result) {
$title = $result->title;
$link = $result->detail_link;
$anzeigeLink = $link;
$descr = $result->description;
$image = $result->svg->png_thumb;
$this->counter++;
$this->results[] = new \App\Models\Result(
$this->engine,
$title,
$link,
$anzeigeLink,
$descr,
$this->gefVon,
$this->counter,
false,
$image
);
}
}
public function getNext(\App\MetaGer $metager, $result)
{
try {
$content = json_decode($result);
if (!$content) {
return;
}
if ($content->info->current_page > $content->info->pages) {
return;
}
$next = new Openclipart(simplexml_load_string($this->engine), $metager);
$next->getString .= "&page=" . ($metager->getPage() + 1);
$next->hash = md5($next->host . $next->getString . $next->port . $next->name);
$this->next = $next;
} catch (\Exception $e) {
Log::error("Results from $this->name are not a valid json string");
return;
}
if (!$content) {
return;
}
if ($content->info->current_page > $content->info->pages) {
return;
}
$next = new Openclipart(simplexml_load_string($this->engine), $metager);
$next->getString .= "&page=" . ($metager->getPage() + 1);
$next->hash = md5($next->host . $next->getString . $next->port . $next->name);
$this->next = $next;
}
}
......@@ -3,6 +3,7 @@
namespace app\Models\parserSkripte;
use App\Models\Searchengine;
use Log;
class Overture extends Searchengine
{
......
......@@ -3,6 +3,7 @@
namespace app\Models\parserSkripte;
use App\Models\Searchengine;
use Log;
class Pixabay extends Searchengine
{
......
......@@ -3,6 +3,7 @@
namespace app\Models\parserSkripte;
use App\Models\Searchengine;
use Log;
class Radiobrowser extends Searchengine
{
......
......@@ -3,6 +3,7 @@
namespace app\Models\parserSkripte;
use App\Models\Searchengine;
use Log;
class Yandex extends Searchengine
{
......
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