Commit 3693648d authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

Yandex dürfte nur noch so lange weitersuchen, wie es auch neue Ergebnisse hat

parent 7e648795
......@@ -54,7 +54,17 @@ class Yandex extends Searchengine
public function getNext(\App\MetaGer $metager, $result)
{
if (count($this->results) <= 0) {
# Wir müssen herausfinden, ob es überhaupt noch weitere Ergebnisse von Yandex gibt:
try {
$content = simplexml_load_string($result);
$resultCount = intval($content->xpath('//yandexsearch/response/results/grouping/found[@priority="all"]')[0]->__toString());
$pageLast = $content->xpath('//yandexsearch/response/results/grouping/page')[0];
$pageLast = intval($pageLast["last"]->__toString());
} catch (\Exception $e) {
return;
}
if (count($this->results) <= 0 || $pageLast >= $resultCount) {
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