aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar logmanoriginal <logmanoriginal@users.noreply.github.com> 2017-08-05 22:38:22 +0200
committerGravatar logmanoriginal <logmanoriginal@users.noreply.github.com> 2017-08-05 22:38:24 +0200
commitfc0ae42450e9e7bf8bd0b5241396ab14d6cb9b39 (patch)
treea9966e8e21a53999a8923d0932d4bfad7d163178
parent9599f921a502581b48656f70e66b7399a2c3c0f3 (diff)
downloadrss-bridge-fc0ae42450e9e7bf8bd0b5241396ab14d6cb9b39.tar.gz
rss-bridge-fc0ae42450e9e7bf8bd0b5241396ab14d6cb9b39.tar.zst
rss-bridge-fc0ae42450e9e7bf8bd0b5241396ab14d6cb9b39.zip
[GelbooruBridge] Fix bridge not getting tags correctly
Tags are embedded in the 'title' attribute instead of 'alt' as defined by the ancestor (DanbooruBridge). The 'title' attribute also contains statistics data ('score:...', 'rating:...') that is now filtered by a custom implementation of the 'getTags' function (elements that contain a colon are removed) Closes #560
-rw-r--r--bridges/GelbooruBridge.php13
1 files changed, 13 insertions, 0 deletions
diff --git a/bridges/GelbooruBridge.php b/bridges/GelbooruBridge.php
index fa4ce11a..4fe30e21 100644
--- a/bridges/GelbooruBridge.php
+++ b/bridges/GelbooruBridge.php
@@ -10,6 +10,7 @@ class GelbooruBridge extends DanbooruBridge {
const PATHTODATA = '.thumb';
const IDATTRIBUTE = 'id';
+ const TAGATTRIBUTE = 'title';
const PIDBYPAGE = 63;
@@ -19,4 +20,16 @@ class GelbooruBridge extends DanbooruBridge {
. ($this->getInput('p') ? ($this->getInput('p') - 1) * static::PIDBYPAGE : '')
. '&tags=' . urlencode($this->getInput('t'));
}
+
+ protected function getTags($element){
+ $tags = parent::getTags($element);
+ $tags = explode(' ', $tags);
+
+ // Remove statistics from the tags list (identified by colon)
+ foreach($tags as $key => $tag) {
+ if(strpos($tag, ':') !== false) unset($tags[$key]);
+ }
+
+ return implode(' ', $tags);
+ }
}