From f8e0a4afbc96abfa2517982323811785314e86f8 Mon Sep 17 00:00:00 2001 From: logmanoriginal Date: Sat, 17 Sep 2016 19:14:05 +0200 Subject: [PATCH] [Pinterest] Move all existing code into 'From search' section 'By username and board' requires a different search algorithm --- bridges/PinterestBridge.php | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/bridges/PinterestBridge.php b/bridges/PinterestBridge.php index bae59da2..4907f40a 100644 --- a/bridges/PinterestBridge.php +++ b/bridges/PinterestBridge.php @@ -36,17 +36,18 @@ class PinterestBridge extends BridgeAbstract { } } - foreach($html->find('div.pinWrapper') as $div){ - $a = $div->find('a.pinImageWrapper', 0); - $img = $a->find('img', 0); + if($this->queriedContext === 'From search'){ + foreach($html->find('div.pinWrapper') as $div){ + $item = array(); - $item = array(); - $item['uri'] = $this->getURI() . $a->getAttribute('href'); - $item['content'] = ''; + $a = $div->find('a.pinImageWrapper', 0); + $img = $a->find('img', 0); + + $item['uri'] = $this->getURI() . $a->getAttribute('href'); + $item['content'] = ''; - if($this->queriedContext === 'From search'){ $avatar = $div->find('div.creditImg', 0)->find('img', 0); $avatar = $avatar->getAttribute('data-src'); $avatar = str_replace("\\", "", $avatar); @@ -65,11 +66,10 @@ class PinterestBridge extends BridgeAbstract { . '' . '
' . $item['fullname']; + + $item['title'] = $img->getAttribute('alt'); + $this->items[] = $item; } - - $item['title'] = $img->getAttribute('alt'); - - $this->items[] = $item; } }