From 3cdd1970693fd928faa919e2b4719620a897c4d5 Mon Sep 17 00:00:00 2001 From: Karl <Karl Hasselbring> Date: Mon, 12 Sep 2016 08:45:27 +0200 Subject: [PATCH] =?UTF-8?q?Dailymotion=20ist=20jetzt=20als=20Videosuche=20?= =?UTF-8?q?eingef=C3=BCgt=20und=20funktioniert=20super.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Models/parserSkripte/Dailymotion.php | 50 ++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 app/Models/parserSkripte/Dailymotion.php diff --git a/app/Models/parserSkripte/Dailymotion.php b/app/Models/parserSkripte/Dailymotion.php new file mode 100644 index 000000000..e21138d77 --- /dev/null +++ b/app/Models/parserSkripte/Dailymotion.php @@ -0,0 +1,50 @@ +<?php + +namespace app\Models\parserSkripte; + +use App\Models\Searchengine; + +class Dailymotion extends Searchengine +{ + public $results = []; + + public function __construct(\SimpleXMLElement $engine, \App\MetaGer $metager) + { + parent::__construct($engine, $metager); + } + + public function loadResults($result) + { + $result = preg_replace("/\r\n/si", "", $result); + try { + $content = json_decode($result); + } catch (\Exception $e) { + abort(500, "$result is not a valid xml string"); + } + + if (!$content) { + return; + } + + $results = $content->list; + foreach ($results as $result) { + $title = $result->title; + $link = $result->url; + $anzeigeLink = $link; + $descr = $result->description; + $image = $result->thumbnail_240_url; + $this->counter++; + $this->results[] = new \App\Models\Result( + $this->engine, + $title, + $link, + $anzeigeLink, + $descr, + $this->gefVon, + $this->counter, + false, + $image + ); + } + } +} -- GitLab