diff --git a/bridges/PinterestBridge.php b/bridges/PinterestBridge.php new file mode 100644 index 00000000..8bb813ae --- /dev/null +++ b/bridges/PinterestBridge.php @@ -0,0 +1,61 @@ +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); + } + else { + $this->returnError('You must specify a Pinterest username and a board name (?u=...&b=...).', 400); + } + + $innertext = null; + + foreach($html->find('div.pinWrapper') as $div) + { + $a = $div->find('a.pinImageWrapper',0); + + $img = $a->find('img', 0); + + $item = new \Item(); + $item->uri = $this->getURI().$a->getAttribute('href'); + $item->content = ''; + + $credit = $div->find('a.creditItem',0); + + $item->content .= '
'.$credit->innertext; + + $item->title = basename($img->getAttribute('alt')); + + //$item->timestamp = $media->created_time; + $this->items[] = $item; + + } + } + + public function getName(){ + return $this->username .' - '. $this->board; + } + + public function getURI(){ + return 'http://www.pinterest.com'; + } + + public function getCacheDuration(){ + return 0; + } +}