Commit 6711ae16 authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

Für ebay verwenden wir nun die offizielle API.

Beschreibung bei Fairmondo Ergebnissen geändert
parent c2fe32c7
......@@ -349,7 +349,7 @@ class MetaGer
{
# Hier ist ein Advertiser:
# Das Logo hinzufügen:
$result->image = "https://img.smartredirect.de/logos_v2/120x60/" . $hash . ".gif";
$result->logo = "https://img.smartredirect.de/logos_v2/60x30/" . $hash . ".gif";
# Den Link hinzufügen:
$publicKey = $publicKey;
$targetUrl = $result->anzeigeLink;
......@@ -748,11 +748,6 @@ class MetaGer
}
$request->replace($newInput);
}
if( $request->has('ebay') )
{
$this->time = 2000;
$this->warnings[] = "Hinweis: Sie haben Ebay aktiviert. Die Suche kann deshalb länger dauern und die maximale Suchzeit wurde auf 2 Sekunden hochgesetzt.";
}
if( App::isLocale("en") )
{
$this->sprueche = "off";
......
......@@ -7,12 +7,12 @@ namespace App\Models;
class Result
{
function __construct ( \SimpleXMLElement $provider, $titel, $link, $anzeigeLink , $descr, $gefVon, $sourceRank, $partnershop = false, $image = "" )
function __construct ( \SimpleXMLElement $provider, $titel, $link, $anzeigeLink , $descr, $gefVon, $sourceRank, $partnershop = false, $image = "", $price = 0 )
{
$this->titel = strip_tags(trim($titel));
$this->link = trim($link);
$this->anzeigeLink = trim($anzeigeLink);
$this->descr = strip_tags(trim($descr));
$this->descr = strip_tags(trim($descr), '<p>');
$this->descr = preg_replace("/\n+/si", " ", $this->descr);
if( strlen($this->descr) > 250 )
{
......
......@@ -2,6 +2,8 @@
namespace app\Models\parserSkripte;
use App\Models\Searchengine;
use DateTimeZone;
use DateTime;
class Ebay extends Searchengine
{
......@@ -24,22 +26,26 @@ class Ebay extends Searchengine
{
return;
}
$results = $content->xpath('//rss/channel/item');
$results = $content;
$results = $results->{"searchResult"};
$count = 0;
foreach($results as $result)
foreach($results->{"item"} as $result)
{
if($count > 10)
break;
$title = $result->{"title"}->__toString();
$link = $result->{"link"}->__toString();
$link = $result->{"viewItemURL"}->__toString();
$anzeigeLink = $link;
if(preg_match("/.*?href=\"(.+?)\".*src=\"(.+?)\".*<strong><b>EUR<\/b> (.+?)<\/strong>.*?<span>(.+?)<\/span>.*/si", $result->{"description"}->__toString(), $matches) === 1);
$descr = "Ebay-Auktion: l&auml;uft bis " . $matches[4] . " | " . $matches[3] . " &euro;";
$image = $matches[2];
# die($result->{"description"}->__toString());
# $descr = strip_tags($result->{"description"}->__toString());
# $descr = $result->{"description"}->__toString();
# .*?href="(.+?)".*src="(.+?)".*<strong><b>EUR<\/b> (.+?)<\/strong>.*?<div>(.+?)<\/div>.*
$time = $result->{"listingInfo"}->{"endTime"}->__toString();
$time = date(DATE_RFC2822, strtotime($time));
$price = intval($result->{"sellingStatus"}->{"convertedCurrentPrice"}->__toString()) * 100;
$descr = "<p>Preis: " . $result->{"sellingStatus"}->{"convertedCurrentPrice"}->__toString() . " €</p>";
$descr .= "<p>Versandkosten: " . $result->{"shippingInfo"}->{"shippingServiceCost"}->__toString() . " €</p>";
if( isset($result->{"listingInfo"}->{"listingType"}))
$descr .= "<p>Auktionsart: " . $result->{"listingInfo"}->{"listingType"}->__toString() . "</p>";
$descr .= "<p>Auktionsende: " . $time . "</p>";
if( isset($result->{"primaryCategory"}->{"categoryName"}))
$descr .= "<p class=\"text-muted\">Kategorie: " . $result->{"primaryCategory"}->{"categoryName"}->__toString() . "</p>";
$image = $result->{"galleryURL"}->__toString();
$this->counter++;
$this->results[] = new \App\Models\Result(
$this->engine,
......@@ -50,7 +56,8 @@ class Ebay extends Searchengine
$this->gefVon,
$this->counter,
false,
$image
$image,
$price
);
$count++;
......
......@@ -39,11 +39,12 @@ class Exalead extends Searchengine
}
$results->registerXPathNamespace($prefix,$namespace);
try{
$results = $results->xpath("//a:hits/a:Hit");
$results = $results->xpath("//a:searchResult/a:item");
} catch(\ErrorException $e)
{
return;
}
die(var_dump($results));
foreach($results as $result)
{
try{
......
......@@ -23,10 +23,12 @@ class Fairmondo extends Searchengine
$title = $result["title"];
$link = "https://www.fairmondo.de/articles/" . $result["id"];
$anzeigeLink = $link;
$descr = $result["slug"];
$price = 0;
$descr = "";
if( isset($result['price_cents']))
{
$descr .= " | Preis: " . (intval($result['price_cents']) / 100.0) . " €";
$price = intval($result['price_cents']);
$descr .= "<p>Preis: " . (intval($result['price_cents']) / 100.0) . " €</p>";
}
if( isset($result['title_image_url']) )
{
......@@ -43,7 +45,8 @@ class Fairmondo extends Searchengine
$this->gefVon,
$this->counter,
false,
$image
$image,
$price
);
}
}
......
......@@ -327,6 +327,11 @@ a:hover
clear: both;
}
.result .description p {
margin: 0;
margin-bottom: 4px;
}
.result .description img {
margin:5px;
margin-left:0;
......
......@@ -3,6 +3,7 @@
{{ $result->number }})
</div>
<div class="resultInformation col-xs-12 col-sm-11">
<div class="col-xs-10 col-sm-11" style="padding:0; ">
<p class="title">
<a class="title" href="{{ $result->link }}" target="{{ $metager->getTab() }}" data-hoster="{{ strip_tags($result->gefVon) }}" data-count="{{ $result->number }}">
{{ $result->titel }}
......@@ -58,12 +59,20 @@
anonym öffnen
</a>
</div>
</div>
@if( isset($result->logo) )
<div class="col-xs-2 col-sm-1" style="padding: 0;">
<a href="{{ $result->link }}" target="{{ $metager->getTab() }}" data-hoster="{{ strip_tags($result->gefVon) }}" data-count="{{ $result->number }}">
<img src="{{ $metager->getImageProxyLink($result->logo) }}" alt="" />
</a>
</div>
@endif
@if( $result->image !== "" )
<div class="description">
<a href="{{ $result->link }}" target="{{ $metager->getTab() }}" data-hoster="{{ strip_tags($result->gefVon) }}" data-count="{{ $result->number }}">
<img src="{{ $metager->getImageProxyLink($result->image) }}" align="left" width="120px" height="60px" alt="" />
</a>
{{ $result->descr }}
{!! $result->descr !!}
</div>
@else
<div class="description">{{ $result->descr }}</div>
......
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