diff --git a/src/yajra/Zillow/ZillowClient.php b/src/yajra/Zillow/ZillowClient.php index 75d3f67..b3b90f5 100644 --- a/src/yajra/Zillow/ZillowClient.php +++ b/src/yajra/Zillow/ZillowClient.php @@ -48,9 +48,9 @@ class ZillowClient protected $results; /** - * @var array + * @var Illuminate\Support\Collection */ - protected $photos = []; + protected $photos = collect(); /** * @var array - valid callbacks @@ -200,13 +200,19 @@ public function __call($name, $arguments) */ public function getPhotos($uri) { - $this->photos = []; + $this->photos = collect(); + $client = new GoutteClient; $crawler = $client->request('GET', $uri); // Get the latest post in this category and display the titles - $crawler->filter('.photos a')->each(function ($node) { - $this->photos[] = $node->filter('img')->attr('src') ?: $node->filter('img')->attr('href'); + $crawler->filter('.photo-tile-image')->each(function ($node) { + $this->photos->push($node->attr('src') ?: $node->filter('img')->attr('href')); + }); + + // convert url to get a larger image + $this->photos = $this->photos->map(function ($photo) { + return preg_replace('/\/p_c\//', '/p_h/', $photo); }); $this->response = $this->photos;