From f09dedf16bf952a0f690660bac419c14e0f92c52 Mon Sep 17 00:00:00 2001 From: Teromene Date: Fri, 26 Feb 2016 14:58:03 +0000 Subject: [PATCH 1/2] Corrected PinterestBridge. --- bridges/PinterestBridge.php | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/bridges/PinterestBridge.php b/bridges/PinterestBridge.php index 3bb0530..7d06fee 100644 --- a/bridges/PinterestBridge.php +++ b/bridges/PinterestBridge.php @@ -51,7 +51,8 @@ class PinterestBridge extends BridgeAbstract{ $this->username = $param['u']; $this->board = $param['b']; - $html = file_get_html($this->getURI().'/'.urlencode($this->username).'/'.urlencode($this->board)) or $this->returnError('Could not request Pinterest.', 404); + $html = file_get_html($this->getURI().'/'.urlencode($this->username).'/'.urlencode($this->board)) or $this->returnError('Username and/or board not found', 404); + } else if (isset($param['q'])) { $this->query = $param['q']; @@ -76,13 +77,17 @@ class PinterestBridge extends BridgeAbstract{ if (isset($this->query)) { - $avatar = $div->find('img.creditImg', 0); - $username = $div->find('span.creditName', 0); - $board = $div->find('span.creditTitle', 0); + $avatar = $div->find('div.creditImg', 0)->find('img', 0); + $avatar = $avatar->getAttribute('data-src'); + $avatar = str_replace("\\", "", $avatar); + + + $username = $div->find('div.creditName', 0); + $board = $div->find('div.creditTitle', 0); $item->username =$username->innertext; $item->fullname = $board->innertext; - $item->avatar = $avatar->getAttribute('src'); + $item->avatar = $avatar; $item->content .= '
'.$item->username.''; $item->content .= '
'.$item->fullname; @@ -111,6 +116,6 @@ class PinterestBridge extends BridgeAbstract{ } public function getCacheDuration(){ - return 3600; + return 0; } } From 04ec53010c6373f99eec400c5ce010c0d818c7a8 Mon Sep 17 00:00:00 2001 From: Teromene Date: Fri, 26 Feb 2016 15:10:26 +0000 Subject: [PATCH 2/2] Corrected cache time. --- bridges/PinterestBridge.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bridges/PinterestBridge.php b/bridges/PinterestBridge.php index 7d06fee..7df03c8 100644 --- a/bridges/PinterestBridge.php +++ b/bridges/PinterestBridge.php @@ -116,6 +116,6 @@ class PinterestBridge extends BridgeAbstract{ } public function getCacheDuration(){ - return 0; + return 3600; } }