diff --git a/bridges/AmazonPriceTrackerBridge.php b/bridges/AmazonPriceTrackerBridge.php index 129ed57c..1d8959a2 100644 --- a/bridges/AmazonPriceTrackerBridge.php +++ b/bridges/AmazonPriceTrackerBridge.php @@ -1,7 +1,7 @@ find('span.offer-price', 0) ?: $html->find('.a-color-price', 0); + $priceString = $priceDiv->plaintext; - preg_match('/^\s*([A-Z]{3}|£|\$)\s?([\d.,]+)\s*$/', $priceDiv->plaintext, $matches); + preg_match('/[\d.,]+/', $priceString, $matches); - if (count($matches) === 3) { + $price = $matches[0]; + $currency = trim(str_replace($price, '', $priceString)); + + if ($price != null && $currency != null) { return array( - 'price' => $matches[2], - 'currency' => $matches[1], + 'price' => $price, + 'currency' => $currency, 'shipping' => '0' ); }