fix: various small fixes (#3578)

This commit is contained in:
Dag 2023-07-29 00:14:30 +02:00 committed by GitHub
parent 11ce8b5dcd
commit 701fe3cfed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 87 additions and 39 deletions

View file

@ -66,16 +66,27 @@ class EBayBridge extends BridgeAbstract
$new_listing_label->remove();
}
$item['title'] = $listing->find('.s-item__title', 0)->plaintext;
$listingTitle = $listing->find('.s-item__title', 0);
if ($listingTitle) {
$item['title'] = $listingTitle->plaintext;
}
$subtitle = implode('', $listing->find('.s-item__subtitle'));
$item['uri'] = $listing->find('.s-item__link', 0)->href;
$listingUrl = $listing->find('.s-item__link', 0);
if ($listingUrl) {
$item['uri'] = $listingUrl->href;
} else {
$item['uri'] = null;
}
preg_match('/.*\/itm\/(\d+).*/i', $item['uri'], $matches);
$item['uid'] = $matches[1];
if (preg_match('/.*\/itm\/(\d+).*/i', $item['uri'], $matches)) {
$item['uid'] = $matches[1];
}
$priceDom = $listing->find('.s-item__details > .s-item__detail > .s-item__price', 0);
$price = $priceDom->plaintext ?? 'N/A';
$price = $listing->find('.s-item__details > .s-item__detail > .s-item__price', 0)->plaintext;
$shippingFree = $listing->find('.s-item__details > .s-item__detail > .s-item__freeXDays', 0)->plaintext ?? '';
$localDelivery = $listing->find('.s-item__details > .s-item__detail > .s-item__localDelivery', 0)->plaintext ?? '';
$logisticsCost = $listing->find('.s-item__details > .s-item__detail > .s-item__logisticsCost', 0)->plaintext ?? '';