From 5b44a1bd1c5411a47fa8c2fe7533e6eb0e77b3e1 Mon Sep 17 00:00:00 2001 From: Yaman Qalieh Date: Fri, 1 Apr 2022 10:38:37 -0400 Subject: [PATCH] [CraigslistBridge] Fix notice with nearby results (#2588) If the search query includes searchNearby=1, nearby results do not have .result-hood to indicate location, instead using .nearby. --- bridges/CraigslistBridge.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bridges/CraigslistBridge.php b/bridges/CraigslistBridge.php index b2a3c3aae75..3acffab99af 100644 --- a/bridges/CraigslistBridge.php +++ b/bridges/CraigslistBridge.php @@ -74,6 +74,7 @@ public function collectData() { foreach($results as $post) { // Skip "nearby results" banner and results + // This only appears when searchNearby is not specified if ($post->tag == 'h4') { break; } @@ -86,7 +87,8 @@ public function collectData() { $item['timestamp'] = $post->find('.result-date', 0)->datetime; $item['uid'] = $heading->id; $item['content'] = $post->find('.result-price', 0)->plaintext . ' ' - . $post->find('.result-hood', 0)->plaintext; + // Find the location (local and nearby results if searchNearby=1) + . $post->find('.result-hood, span.nearby', 0)->plaintext; $images = $post->find('.result-image[data-ids]', 0); if (!is_null($images)) {