diff --git a/bridges/DanbooruBridge.php b/bridges/DanbooruBridge.php index f2cddf4..36b8c08 100644 --- a/bridges/DanbooruBridge.php +++ b/bridges/DanbooruBridge.php @@ -23,6 +23,7 @@ class DanbooruBridge extends BridgeAbstract { const PATHTODATA = 'article'; const IDATTRIBUTE = 'data-id'; + const TAGATTRIBUTE = 'alt'; protected function getFullURI(){ return $this->getURI() @@ -30,6 +31,10 @@ class DanbooruBridge extends BridgeAbstract { . '&tags=' . urlencode($this->getInput('t')); } + protected function getTags($element){ + return $element->find('img', 0)->getAttribute(static::TAGATTRIBUTE); + } + protected function getItemFromElement($element){ // Fix links defaultLinkTo($element, $this->getURI()); @@ -39,7 +44,7 @@ class DanbooruBridge extends BridgeAbstract { $item['postid'] = (int)preg_replace("/[^0-9]/", '', $element->getAttribute(static::IDATTRIBUTE)); $item['timestamp'] = time(); $thumbnailUri = $element->find('img', 0)->src; - $item['tags'] = $element->find('img', 0)->getAttribute('alt'); + $item['tags'] = $this->getTags($element); $item['title'] = $this->getName() . ' | ' . $item['postid']; $item['content'] = '